A task-driven document writing generation method, apparatus, device, and medium
By dividing the document template into document blocks and assigning tasks and roles to each block, and using a state machine to control the flow, the problem of chaotic division of labor in multi-person collaborative writing is solved, the orderly progress of document blocks and content merging are realized, and the efficiency and quality of collaboration are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YUDONGYUAN (BEIJING) INFORMATION TECH CO LTD
- Filing Date
- 2026-03-24
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies struggle to achieve fine-grained division of labor and block-level governance within documents during collaborative writing, leading to chaotic role assignments, content confusion, and blurred responsibility boundaries, thus affecting collaboration efficiency and standardization.
The document template to be written is divided into multiple document blocks. A continuous executable task is created for each document block and a responsibility role is assigned. The task flow is controlled by a state machine to generate the target document to be written.
It enables refined division of labor and closed-loop management for collaborative writing among multiple people, improving collaboration efficiency and output quality, and ensuring the orderly progress of document blocks and the accurate merging of content.
Smart Images

Figure CN121920792B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document generation technology, and more specifically, to a task-driven document writing generation method, apparatus, device, and medium. Background Technology
[0002] With the widespread adoption of e-office tools, enterprise knowledge production and document writing have entered a normalized mode of multi-person collaboration, cross-role cooperation, and phased implementation. Related collaboration tools and technical solutions are also constantly evolving and improving. At the mainstream office and knowledge platform level, solutions that provide page-based approval and automated workflows, locking versions after document approval, facilitate collaboration on a page or document-by-document basis, offering advantages such as page visualization and convenient workflow operation. On the engineering side, solutions rely on document-as-code routes, mapping paths to responsible parties and using protected branches to set review access controls and status checks, clarifying the review subjects and merging conditions. Meanwhile, existing patented solutions have formed two typical approaches: one is a page / document-level workflow approval method, treating the object to be processed as an instance of the overall workflow, progressing sequentially according to preset nodes; the other is a general workflow management solution, focusing on task routing and status updates across participants, coordinating the workflow progression order of multiple roles.
[0003] However, existing technical solutions have significant limitations and struggle to meet the demands of refined collaboration. Mainstream platforms concentrate their collaboration governance units at the page, file, or directory path level, failing to penetrate to the block-level units such as chapters, paragraphs, and tables within a document. When a single document contains multiple professional sections requiring different roles, issues such as approval resets and content confusion easily arise. Both types of solutions also lack block-level governance capabilities; the former binds processes and permissions to the overall node, while the latter focuses on the overall document routing allocation, neither achieving precise binding of roles, tasks, and document blocks. Furthermore, existing solutions generally suffer from vague responsibility boundaries and a lack of block-level status and permission control, hindering the efficiency and standardization of cross-role collaborative writing. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of the prior art by providing a task-driven document writing generation method, apparatus, device, and medium. This method divides the document template to be written into multiple document blocks, creates a continuous executable task for each document block and assigns a responsibility role, and finally generates the target document after all document blocks have completed all tasks. This achieves refined division of labor and closed-loop management for collaborative writing among multiple people.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows: In a first aspect, embodiments of this application provide a task-driven document generation method, including: The imported document template to be written is split into multiple document blocks; For each document block, create a series of consecutive executable tasks and assign each executable task to a corresponding responsibility role, so that the corresponding responsibility role executes the executable task for the document block; If the last executable task of all the document blocks is completed, a target document is generated based on the content of the document blocks.
[0006] In an optional implementation, the step of segmenting the imported document template to be written into multiple document blocks includes: Based on multiple preset position tags in the document template to be written, the document template to be written is divided into multiple document blocks. The multiple preset position tags include at least one type of position tag among chapter position tags, paragraph position tags, and form position tags.
[0007] In an optional implementation, the method further includes: Based on the title information of the corresponding position tags of each document block, generate the path identifier of the document block; The content type of each document block is determined based on the category of the position tag corresponding to each document block; The step of generating a target written file based on the written content of multiple document blocks includes: Based on the path identifiers and content types of the multiple document blocks, the written content of each document block is merged into the document template to be written, thereby generating the target writing file.
[0008] In an optional implementation, the plurality of executable tasks include: a writing task, an approval task, and a release confirmation task; before generating the target written file based on the writing content of the plurality of document blocks after the last executable task of the plurality of document blocks has been completed, the method further includes: If the writing task of the document block is completed, the status of the document block is updated from draft to pending review, and the approval task of the document block is triggered. If the approval task of the document block is completed, the status of the document block will be updated from pending review to approved, and the release confirmation task of the document block will be triggered. If the release confirmation task of the document block is completed, the status of the document block will be updated from the approved status to the frozen status. If multiple document blocks are in a frozen state, then it is determined that the last executable task of the multiple document blocks has been completed.
[0009] In an optional implementation, the method further includes: Obtain the operation records of multiple executable tasks corresponding to each document block; An operation ledger for the target writing file is generated based on the operation records of the multiple executable tasks corresponding to each document block.
[0010] In an optional implementation, the method further includes: A key-value structure is used to store the path identifier, content type, corresponding multiple executable tasks, and the responsibility role of each executable task for the document block.
[0011] In an optional implementation, the method further includes: Create a state machine associated with the document block and the corresponding plurality of executable tasks; The state machine is used to control the document block to switch between draft state, pending review state, approved state and frozen state in sequence.
[0012] Secondly, embodiments of this application also provide a task-driven document writing and generation apparatus, comprising: The segmentation module is used to segment the imported document template into multiple document blocks. A creation module is used to create multiple consecutive executable tasks for each document block and assign each executable task to a corresponding responsibility role, so that the corresponding responsibility role executes the executable task for the document block; The generation module is used to generate a target writing file based on the writing content of the multiple document blocks if the last executable task of the multiple document blocks has been completed.
[0013] Thirdly, embodiments of this application also provide a computer device, including: a processor, a storage medium, and a bus, wherein the storage medium stores program instructions executable by the processor, and when the computer device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the task-driven document writing generation method as described in any of the first aspects.
[0014] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the task-driven document writing generation method as described in any of the first aspects.
[0015] The beneficial effects of this application are: This application provides a task-driven document writing generation method, apparatus, device, and medium. The method includes: segmenting an imported document template to be written into multiple document blocks; creating multiple consecutive executable tasks for each document block; assigning each executable task to a corresponding responsibility role; allowing the corresponding responsibility role to execute the executable tasks for the document block; and generating a target document based on the writing content of the multiple document blocks once the last executable task for each document block is completed. This method, by segmenting the document template into multiple document blocks, creating consecutive executable tasks for each document block and assigning responsibility roles, and finally generating a target document after all tasks in all document blocks are completed, achieves refined division of labor and closed-loop management for multi-person collaborative writing. It solves the problems of chaotic division of labor and mutual delays in traditional document-level collaboration, allowing different responsibility roles to focus on the core tasks of their respective document blocks. Furthermore, the task chain ensures the orderly progress of multiple executable tasks, and multiple document blocks can be executed in parallel, improving the efficiency and quality of multi-role collaborative writing. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 One of the flowcharts for a task-driven document generation method provided in this application embodiment; Figure 2 A second flowchart illustrating a task-driven document generation method provided in this application embodiment; Figure 3 The third flowchart illustrates a task-driven document generation method provided in this application embodiment; Figure 4 The fourth flowchart illustrates a task-driven document generation method provided in this application embodiment; Figure 5 The fifth flowchart illustrates a task-driven document generation method provided in this application embodiment; Figure 6 A schematic diagram of the functional modules of a task-driven document writing and generation device provided in this application embodiment; Figure 7 This is a schematic diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.
[0019] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0020] In the description of this application, it should be noted that if the terms "upper", "lower", etc. appear to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship that the product of this application is usually placed in, it is only for the convenience of describing this application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0021] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention 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 invention described herein can be implemented in orders other than those illustrated or described herein. Additionally, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises 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 such processes, methods, products, or apparatus.
[0022] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.
[0023] The task-driven document generation method provided in this application will be explained in detail below with reference to the accompanying drawings and specific examples. The task-driven document generation method provided in this application can also be implemented by a computer device through running algorithms or software. The computer device can be, for example, a server or a terminal, and the terminal can be a user computer. Figure 1 This application provides a flowchart illustrating one of the methods for generating task-driven writing documents. Figure 1 As shown, the method includes: S101. The imported document template to be written is divided into multiple document blocks.
[0024] In this embodiment, the document template to be written includes multiple chapters, paragraphs, etc. For example, if the document template to be written is a product procurement template, then the template includes four chapters: procurement process specifications, supplier qualification requirements, contract terms template, and compliance audit points. The contract terms template chapter includes secondary paragraphs such as confidentiality clauses, liability for breach of contract, and payment terms. The compliance audit points chapter includes an audit item list table.
[0025] Upon receiving the document to be written, the system will segment the document into multiple document blocks.
[0026] Optionally, the document template to be written is divided into multiple document blocks based on multiple preset position tags in the document template to be written. The multiple preset position tags include at least one type of position tag among chapter position tags, paragraph position tags, and form position tags.
[0027] Specifically, taking the document template to be written as a product procurement template as an example, the chapter location tags include: procurement process specification location tag, supplier qualification requirement location tag, contract terms template location tag, and compliance audit key points location tag; the paragraph location tags include: contract terms template - confidentiality clause location tag, contract terms template - liability for breach of contract location tag, and contract terms template - payment terms location tag; the form location tags include: compliance audit key points - audit project list table location tag.
[0028] The document template to be written is then segmented based on at least one type of location tag to obtain multiple document blocks. For example, if the document template to be written is segmented based on three types of location tags, the following document blocks are obtained: First document block: Procurement process specifications; Second document block: Supplier qualification requirements; Third document block: Contract terms template - Confidentiality clause; Fourth document block: Contract terms template - Liability for breach of contract; Fifth document block: Contract terms template - Payment terms; Sixth document block: Compliance audit key points; Seventh document block: Audit item list table.
[0029] After segmenting the imported document template into its content, a unique identifier is generated for each document block for subsequent location.
[0030] S102. Create multiple consecutive executable tasks for each document block and assign each executable task to a corresponding responsibility role, so that the corresponding responsibility role executes the executable task for the document block.
[0031] Specifically, the multiple executable tasks may include: writing tasks, approval tasks, and release confirmation tasks. Among them, the approval tasks include review tasks and annotation tasks.
[0032] Create multiple consecutive executable tasks for each document block, and assign a corresponding responsibility role to each task so that the responsible role can receive and execute the task. For example, for the first document block: Procurement Process Specification, create a writing task, an approval task, and a release confirmation task. Assign the writing task to Procurement Personnel A, the approval task to Approver B, and the release confirmation task to Procurement Manager C. After task assignment, automatically push to-do notifications to the task panels of each responsible role. For example, send a writing task to Procurement Specialist A, requesting that the writing of the Procurement Process Specification document block be completed before November 15, 2025, along with an entry point for document block editing.
[0033] S103. If the last executable task of multiple document blocks has been completed, then generate the target writing file based on the writing content of the multiple document blocks.
[0034] Specifically, once the last task of all document blocks has been completed, the file merging process is automatically triggered. The final written content of each document block is extracted and assembled according to the original chapter order, paragraph layout, and table structure of the document template to generate a complete target document. It can also automatically mark all document blocks as having passed the full-process review and are ready for official release.
[0035] In this embodiment, this application provides a task-driven document writing generation method. The method includes: segmenting an imported document template to be written into multiple document blocks; creating multiple consecutive executable tasks for each document block; assigning each executable task to a corresponding responsibility role; allowing the corresponding responsibility role to execute the executable tasks for the document block; and generating a target document writing file based on the writing content of the multiple document blocks after the last executable task for each document block is completed. This method, by segmenting the document template to be written into multiple document blocks, creating consecutive executable tasks for each document block and assigning responsibility roles, and finally generating a target document writing file after all tasks in all document blocks are completed, achieves refined division of labor and closed-loop management for multi-person collaborative writing. It solves the problems of chaotic division of labor and mutual delays in traditional document-level collaboration, allowing different responsibility roles to focus on the core tasks of their respective document blocks. Furthermore, the task chain ensures the orderly progress of multiple executable tasks, and multiple document blocks can be executed in parallel, improving the efficiency and quality of multi-role collaborative writing.
[0036] This application also provides another possible implementation of the task-driven document generation method. Figure 2 This is a second flowchart illustrating a task-driven document generation method provided in an embodiment of this application; as shown below. Figure 2As shown, the method also includes: S201. Generate the path identifier of the document block based on the title information of the corresponding position tag of each document block.
[0037] S202. Determine the content type of the document block based on the category of the tag at the corresponding position of each document block.
[0038] In this embodiment, the path identifier of a document block is generated based on the title information of the corresponding position tag of each document block. For example, based on the title information of the corresponding position tag of the first document block, the path identifier of the first document block is determined to be "Product Procurement Module - Procurement Process Specification". Based on the title information of the corresponding position tag of the third document block, the path identifier of the third document block is determined to be "Product Procurement Module - Contract Terms Template - Confidentiality Clause".
[0039] Once the path identifier is generated, it is synchronously stored in the system database and displayed in real time on the document block editing page, task panel, and audit log, making it easy for users to quickly identify the position of the document block in the overall document template to be written.
[0040] Similarly, the content type of each document block is determined based on the category of its corresponding location tag. For example, based on the category of the first document block's corresponding location tag, the content type of the first document block is determined to be chapter-level text, and based on the category of the third document block's corresponding location tag, the content type of the third document block is determined to be paragraph-level text.
[0041] Once the content type is determined, it is bound to each document block. In subsequent processes, different editing tools can be adapted according to the type. For example, table blocks provide batch cell editing functions, and paragraph blocks provide format painter functions.
[0042] Based on the above, a target written file is generated from the content of multiple document blocks, including: S203. Based on the path identifiers and content types of multiple document blocks, merge the writing content of each document block into the document template to be written, and generate the target writing file.
[0043] Specifically, the document blocks are sorted according to the hierarchical order of the path identifiers, and then the written content of the multiple document blocks is merged according to the content type to obtain the target written document.
[0044] The method provided in this application generates path identifiers based on the location tags of document blocks, determines the content type, and accurately merges the written content accordingly, thereby achieving standardization of document block management and automation of target document generation. The path identifiers clearly define the location of each document block within the overall document, avoiding content misalignment and confusion; content type adaptation ensures consistent editing and merging formats for different types of document blocks; the combination of these two aspects allows scattered document blocks to be quickly and accurately integrated into the original template, ensuring both the structural integrity and format consistency of the target document, while eliminating the tedious work of manual formatting and improving the efficiency and standardization of document generation.
[0045] This application also provides another possible implementation of a task-driven document generation method, in which multiple executable tasks include: a writing task, an approval task, and a release confirmation task. Figure 3 This is the third flowchart illustrating a task-driven document generation method provided in this application embodiment; as shown below. Figure 3 As shown, if the last executable task of multiple document blocks has been completed, before generating the target written file based on the written content of the multiple document blocks, the method further includes: S301. If the writing task of the document block is completed, the status of the document block will be updated from draft to pending review, and the approval task of the document block will be triggered.
[0046] In this embodiment, for the first document block, after procurement specialist A completes the writing of the first document block, he clicks the submit review button to verify whether the writing task meets the completion conditions, such as confirming whether the content is complete, whether the format meets the template requirements, and whether the cross-references are valid.
[0047] If the writing task meets the completion conditions, the writing task of the first document block is determined to be completed, the status of the first document block is updated from draft to pending review, and according to the task allocation rules, an approval notification is automatically pushed to the task panel of the responsible role corresponding to the approval task, with a preview link of the written content of the first document block and review points, etc.
[0048] S302. If the approval task of the document block is completed, the status of the document block will be updated from pending review to approved, and the release confirmation task of the document block will be triggered.
[0049] Specifically, if the responsible role for the approval task confirms that the content of the first document block is correct, and clicks the "Approval" button, the approval task for the first document block is completed, and the status of the first document block is updated from "Pending Review" to "Approved". According to the task allocation rules, a release confirmation notification is automatically pushed to the task panel of the responsible role for the release confirmation task.
[0050] It should be noted that if the responsible role for the approval task determines that the content of the first document block is incorrect, and clicks the "Return Review" button with the reason for the return, it is determined that the approval task for the first document block has not been completed. The status of the first document block is then updated from "Pending Review" to "Draft". According to the task allocation rules, a writing notification is automatically pushed to the task panel of the purchasing specialist A who is responsible for the writing task, so that purchasing specialist A can continue to modify the content of the first document block according to the reason for the return and continue to execute step S301.
[0051] S303. If the document block release confirmation task is completed, the document block status will be updated from the approved status to the frozen status.
[0052] Specifically, if the responsible role for the release confirmation task confirms that the content of the first document block is correct, and the approval record is complete and the release timing is appropriate, clicking the confirm release button will confirm that the release confirmation task for the first document block has been completed, and the status of the first document block will be updated from the approved status to the frozen status, and the freeze operation will be automatically executed: the content of the document block will be prohibited from being edited or deleted, and only viewing and exporting will be allowed.
[0053] S304. If multiple document blocks are in a frozen state, then it is determined that the last executable task of the multiple document blocks has been completed.
[0054] Specifically, if the first document block is in a frozen state, the content of the first document block is merged into the document template to be written in a block-level patching manner until the states of multiple document blocks are all frozen. Once the last executable task of multiple document blocks has been completed, the content of multiple document blocks is merged into the document template to be written, generating the target document.
[0055] The method provided in this application constructs a visualized and controllable workflow mechanism by orderly updating the document block status according to the task progress and triggering subsequent task execution through status switching. This not only clarifies the advancement stage of each document block, allowing each responsible role to monitor the collaboration progress in real time, but also avoids process chaos and unauthorized operations by binding status to tasks, ensuring that key links such as writing, reviewing, and publishing are interconnected and compliant. Furthermore, the target written file is generated only when all document blocks reach the frozen state, guaranteeing the integrity and accuracy of the published content and solving the pain point of traditional processes where incomplete parts hinder the overall publication.
[0056] This application also provides another possible implementation of the task-driven document generation method. Figure 4 This is the fourth flowchart illustrating a task-driven document generation method provided in this application embodiment; as shown below. Figure 4As shown, the method also includes: S401. Obtain the operation records of multiple executable tasks corresponding to each document block.
[0057] S402. Generate an operation ledger for the target writing file based on the operation records of multiple executable tasks corresponding to each document block.
[0058] In this embodiment, for each document block, the operation trajectory of all executable tasks is automatically collected, and the operation records are synchronized to the system database in real time, including additional information such as operator account, IP address, and operating device to ensure traceability.
[0059] Then, after summarizing the operation records of all document blocks, an operation ledger for the target document is generated. The operation ledger adopts a structured format. For example, the operation ledger includes the following core modules: document block list, task trajectory details, status transition summary, etc. Among them, the document block list includes the identifier, name, path identifier and content type of multiple document blocks; the task trajectory details include all operation records of each document block arranged in chronological order, and the format can be: time-operator-role-task type-operation content-status change, etc.; the status transition summary includes the status change time of each document block.
[0060] The method provided in this application achieves traceability and auditability of the entire collaborative writing process by collecting operation records of executable tasks for each document block and generating a unified operation ledger. The operation ledger fully records the core information of who performed the operation, when, on which document block, and how the status changed, forming a clear chain of evidence. This not only meets the needs of compliance review and problem tracing, but also provides data support for collaborative review and quality optimization (such as statistical review time and first-time pass rate), effectively solving the problems of scattered record keeping and difficulty in defining responsibility in traditional collaboration.
[0061] This application also provides another possible implementation of a task-driven document generation method. The method further includes: A key-value structure is used to store the path identifier, content type, corresponding multiple executable tasks, and the responsibility role of each executable task for document blocks.
[0062] In this embodiment, each document block corresponds to a key-value record, where the key is the document block ID and the value is structured data in JSON format. The structured data includes: the path identifier of the document block, the content type, the corresponding multiple executable tasks, and the responsibility role of each executable task.
[0063] The method provided in this application uses a key-value structure to store core information such as the path identifier, content type, executable task, and responsible role of document blocks, achieving efficient management and cross-system adaptation of key data in document blocks. Key-value structures offer fast query speeds, allowing for millisecond-level retrieval of required information via document block identifiers, thus improving system response efficiency. The standardized data format facilitates rapid interaction with external tools such as editors, knowledge bases, and work order systems, eliminating the need for complex data conversion. Furthermore, it supports flexible field expansion, allowing for the addition of information such as priority and deadlines based on business needs, enhancing the system's adaptability and scalability.
[0064] This application also provides another possible implementation of the task-driven document generation method. Figure 5 This is the fifth flowchart illustrating a task-driven document generation method provided in this application embodiment; as shown below. Figure 5 As shown, the method also includes: S501. Create a state machine associated with the document block and its corresponding multiple executable tasks.
[0065] S502. A state machine is used to control the document block to switch between draft, pending review, approved and frozen states in sequence.
[0066] In this embodiment, an independent state machine is created for each document block. The state nodes of the state machine are associated with executable tasks one-to-one. Taking the third document block (Contract Terms - Confidentiality Clause) as an example, the state machine is defined as follows: State nodes: Draft, Pending Review, Approved, Frozen. Task association rules: Draft state: Associated only with writing tasks, allowing only submission for review; Pending Review state: Associated with approval tasks, allowing approval and rejection operations; Approved state: Associated with release confirmation tasks, allowing confirmation release and rejection for resubmission operations; Frozen state: No associated tasks, allowing only "view" and "export" operations. After the state machine is created, it is bound to the document block ID and can be stored in the system state management module as the core control logic for state transitions.
[0067] Taking the third document block as an example, the state machine automatically sets it to draft state when the third document block is created, granting only the writing task operation permission. The person responsible for the writing task can edit the content, while others can only view it. From draft state to pending review state: After the person responsible for the writing task completes the writing and submits it for review, the state machine automatically switches to the pending review state after verifying that the writing task completion conditions are met, closing the editing permission and granting the review permission to the person responsible for the approval task. From pending review state to approved state: After the person responsible for the approval task completes the approval operation, the state machine detects that all review tasks are completed, switches to the approved state, closes the review permission, and grants the release confirmation permission to the person responsible for the release confirmation task. From approved state to frozen state: After the person responsible for the release confirmation task completes the release confirmation operation, the state machine switches to the frozen state, closing all editing, review, and release permissions, and retaining only the viewing permission.
[0068] The method provided in this application creates a state machine associated with executable tasks for each document block, and controls the orderly switching of document blocks between states through the state machine, thereby achieving automated and intelligent management of permissions and processes. The state machine strongly binds the state of a document block with executable operations and responsibilities, automatically switching permissions and triggering tasks without manual intervention, reducing operational errors and communication costs; at the same time, it clarifies the unique path and conditions for state transitions, avoiding problems such as process backflow and unauthorized operations, ensuring that the progress of each document block conforms to preset rules, making the collaborative writing process as controllable and predictable as a work order.
[0069] The following will continue to explain the task-driven document writing and generation apparatus and computer equipment provided in any of the above embodiments of this application. The specific implementation process and the resulting technical effects are the same as those in the corresponding method embodiments. For the sake of brevity, the parts not mentioned in this embodiment can be referred to the corresponding content in the method embodiment.
[0070] Figure 6 This is a schematic diagram of the functional modules of a task-driven document writing and generation device provided in an embodiment of this application. Figure 6 As shown, the task-driven document writing generation device 100 includes: The segmentation module 110 is used to segment the imported document template to be written into multiple document blocks. Create module 120 to create multiple consecutive executable tasks for each document block and assign each executable task to a corresponding responsibility role, so that the corresponding responsibility role executes the executable task for the document block; The generation module 130 is used to generate a target writing file based on the writing content of multiple document blocks if the last executable task of multiple document blocks has been completed.
[0071] Optionally, the segmentation module 110 is also used to segment the content of the document template to be written according to multiple preset position tags in the document template to be written, and obtain multiple document blocks. The multiple preset position tags include at least one type of position tag among chapter position tags, paragraph position tags, and form position tags.
[0072] Optionally, the device further includes: The generation module 130 is also used to generate the path identifier of the document block based on the title information of the corresponding position tag of each document block; The determination module is used to determine the content type of a document block based on the category of the tag at the corresponding position of each document block; The generation module 130 is also used to merge the writing content of each document block into the document template to be written based on the path identifier and content type of multiple document blocks, and generate the target writing file.
[0073] Optionally, the multiple executable tasks include: a writing task, an approval task, and a release confirmation task; the device also includes: The trigger module is used to update the status of a document block from draft to pending review and trigger the approval task if the writing task of the document block is completed; if the approval task of the document block is completed, the status of the document block is updated from pending review to approved and trigger the release confirmation task; if the release confirmation task of the document block is completed, the status of the document block is updated from approved to frozen. The determination module is also used to determine that if multiple document blocks are in a frozen state, the last executable task of the multiple document blocks has been completed.
[0074] Optionally, the device further includes: The acquisition module is used to acquire the operation records of multiple executable tasks corresponding to each document block; The generation module 130 is also used to generate an operation ledger for the target writing file based on the operation records of multiple executable tasks corresponding to each document block.
[0075] Optionally, the device further includes: The storage module is used to store the path identifier, content type, corresponding multiple executable tasks, and the responsibility role of each executable task in a key-value structure.
[0076] Optionally, the device further includes: Module 120 is also used to create state machines associated with document blocks and their corresponding multiple executable tasks; The control module is used to control the document block to switch between draft, pending review, approved and frozen states sequentially using a state machine.
[0077] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0078] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0079] Figure 7 This is a schematic diagram of a computer device provided in an embodiment of this application, which can be used for task-driven document writing and generation. Figure 7 As shown, the computer device includes: a processor 210, a storage medium 220, and a bus 230.
[0080] Storage medium 220 stores machine-readable instructions executable by processor 210. When the computer device is running, processor 210 communicates with storage medium 220 via bus 230, and processor 210 executes the machine-readable instructions to perform the steps of the above method embodiment. The specific implementation and technical effects are similar, and will not be described again here.
[0081] Optionally, this application also provides a storage medium 220, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the above-described method embodiments. The specific implementation and technical effects are similar, and will not be repeated here.
[0082] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0083] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0084] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0085] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0086] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A task-driven document authoring method, characterized by, include: The imported document template to be written is split into multiple document blocks; For each document block, create a series of consecutive executable tasks and assign each executable task to a corresponding responsibility role, so that the corresponding responsibility role executes the executable task for the document block; If the last executable task of each of the multiple document blocks is completed, a target written file is generated based on the writing content of the multiple document blocks; The plurality of executable tasks include: a writing task, an approval task, and a release confirmation task; before generating the target writing file based on the writing content of the plurality of document blocks, if the last executable task of the plurality of document blocks has been completed, the method further includes: If the writing task of the document block is completed, the status of the document block is updated from draft to pending review, and the approval task of the document block is triggered. If the approval task of the document block is completed, the status of the document block will be updated from pending review to approved, and the release confirmation task of the document block will be triggered. If the release confirmation task of the document block is completed, the status of the document block will be updated from the approved status to the frozen status. If multiple document blocks are in a frozen state, then it is determined that the last executable task of the multiple document blocks has been completed.
2. The method of claim 1, wherein, The imported document template to be written is segmented into multiple document blocks, including: Based on multiple preset position tags in the document template to be written, the document template to be written is divided into multiple document blocks. The multiple preset position tags include at least one type of position tag among chapter position tags, paragraph position tags, and form position tags.
3. The method of claim 2, wherein, The method further includes: Based on the title information of the corresponding position tags of each document block, generate the path identifier of the document block; The content type of each document block is determined based on the category of the position tag corresponding to each document block; The step of generating a target written file based on the written content of multiple document blocks includes: Based on the path identifiers and content types of the multiple document blocks, the written content of each document block is merged into the document template to be written, thereby generating the target writing file.
4. The method of claim 1, wherein, The method further includes: Obtain the operation records of multiple executable tasks corresponding to each document block; An operation ledger for the target writing file is generated based on the operation records of the multiple executable tasks corresponding to each document block.
5. The method of claim 3, wherein, The method further includes: A key-value structure is used to store the path identifier, content type, corresponding multiple executable tasks, and the responsibility role of each executable task for the document block.
6. The method of claim 1, wherein, The method further includes: Create a state machine associated with the document block and the corresponding multiple executable tasks; The state machine is used to control the document block to switch between draft, pending review, approved and frozen states in sequence.
7. A task-driven document authoring apparatus, characterized by comprising: include: The segmentation module is used to segment the imported document template into multiple document blocks. A creation module is used to create multiple consecutive executable tasks for each document block and assign each executable task to a corresponding responsibility role, so that the corresponding responsibility role executes the executable task for the document block; A generation module is used to generate a target writing file based on the writing content of the multiple document blocks if the last executable task of the multiple document blocks has been completed. The executable tasks include: a writing task, an approval task, and a release confirmation task; the device further includes: a triggering module and a determining module; The triggering module is configured to, if the writing task of the document block is completed, update the status of the document block from draft to pending review and trigger the execution of the approval task of the document block; if the approval task of the document block is completed, update the status of the document block from pending review to approved and trigger the execution of the release confirmation task of the document block; if the release confirmation task of the document block is completed, update the status of the document block from approved to frozen. The determining module is configured to determine that the last executable task of the multiple document blocks has been completed if the states of the multiple document blocks are all frozen.
8. A computer device, comprising: include: The computer device includes a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the computer device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the task-driven document writing generation method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, performs the steps of the task-driven document writing generation method as described in any one of claims 1 to 6.