A document generation method and apparatus
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING COCONUT TREE INFORMATION TECH CO LTD
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-12
AI Technical Summary
In existing office software, general-purpose AI assistants cannot meet the professional needs of different types of documents, resulting in low accuracy of document processing results. Furthermore, they lack a unified management mechanism for templates and AI assistants, making the operation process cumbersome.
In LibreOffice, an AI assistant ID and a name are automatically assigned to the target template, and a corresponding AI agent is assigned to it to generate and process documents in response to user operations, ensuring that the AI agent has the ability to match the template type.
It improves the accuracy of document generation, simplifies the operation process, and enhances the convenience of intelligent office work and the targeted nature of document processing.
Smart Images

Figure CN122197847A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a document generation method and apparatus. Background Technology
[0002] With the rapid development of artificial intelligence technology, intelligent office solutions have become an important direction for improving office efficiency and optimizing user experience. Open-source office software, with its advantages of being free, open-source, and highly customizable, has been widely used by both individual and enterprise users. LibreOffice, as a mainstream open-source office suite, covers multiple office scenarios such as word processing, spreadsheet creation, and presentation design, meeting users' diverse document creation and editing needs.
[0003] Currently, some office software has begun to incorporate AI features, but most adopt a general-purpose AI assistant model, where all types of documents are processed by the same AI assistant. This model has significant drawbacks: different types of templates correspond to documents with different professional attributes. For example, contract templates require AI support with legal clause analysis capabilities, while financial statement templates require AI support with data accounting and analysis capabilities. General-purpose AI assistants cannot meet the professional needs of various fields, often resulting in low accuracy of document processing results.
[0004] In conclusion, improving the accuracy of document generation is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of this, this application provides a document generation method and apparatus, which aims to improve the accuracy of document generation.
[0006] Firstly, this application provides a document generation method, including: In response to selecting a target template of a target type in the open-source office software LibreOffice, the AI assistant ID and the name of the target template are automatically assigned to the target template; Assign a corresponding target AI agent to the AI assistant ID or the target template; In response to a user's document creation operation based on the target template, the target document is generated; In response to the user's selection, the target document is processed by the target AI agent to obtain an AI-generated document.
[0007] Optionally, before automatically assigning an AI assistant ID and a name to the target template in response to selecting a target template of a target type in the open-source office software LibreOffice, the method further includes: Build a backend document knowledge base; The historical case documents in the background document knowledge base are classified according to template type.
[0008] Optionally, in response to the user's selection operation, the target document is processed by the target AI agent to obtain an AI-generated document, including: Using the target AI agent, extended resources are obtained from the background document knowledge base according to the template type, and the target document is extended to obtain the AI-generated document.
[0009] Optionally, in response to the user's selection operation, the target document is processed by the target AI agent to obtain an AI-generated document, including: The target document is edited or polished using the target AI agent to obtain the AI-generated document.
[0010] Optionally, in response to the user's selection operation, the target document is processed by the target AI agent to obtain an AI-generated document, including: Using the target AI agent, the matching historical case documents are extracted from the background document knowledge base; The matched historical case documents are copied into the target document to obtain the AI-generated document.
[0011] Optionally, after responding to the user's selection operation and processing the target document through the target AI agent to obtain the AI-generated document, the method further includes: The target AI agent is used to display the documents generated by the AI.
[0012] Optionally, after responding to the user's selection operation and processing the target document through the target AI agent to obtain the AI-generated document, the method further includes: The AI-generated documents are added to the background document knowledge base according to the template type.
[0013] Secondly, this application provides a document generation apparatus, comprising: The first allocation module is used to automatically assign an AI assistant ID and a target template name to the target template in response to selecting a target template of a target type in the open-source office software LibreOffice. The second allocation module is used to allocate a corresponding target intelligent agent to the AI assistant ID or the target template; The first generation module is used to generate the target document in response to a user's document creation operation based on the target template; The second generation module is used to respond to the user's selection operation by processing the target document through the target AI agent to obtain an AI-generated document.
[0014] Optionally, the device further includes: The building module is used to build the backend document knowledge base; The classification module is used to classify historical case documents in the background document knowledge base according to template type.
[0015] Optionally, the second generation module is specifically used for: Using the target AI agent, extended resources are obtained from the background document knowledge base according to the template type, and the target document is extended to obtain the AI-generated document.
[0016] Optionally, the second generation module is specifically used for: The target document is edited or polished using the target AI agent to obtain the AI-generated document.
[0017] Optionally, the second generation module is specifically used for: Using the target AI agent, the matching historical case documents are extracted from the background document knowledge base; The matched historical case documents are copied into the target document to obtain the AI-generated document.
[0018] Optionally, the device further includes: The target AI agent is used to display the documents generated by the AI.
[0019] Optionally, the device further includes: The AI-generated documents are added to the background document knowledge base according to the template type.
[0020] Thirdly, embodiments of this application provide a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a document generation method as described in any of the embodiments of the first aspect of this application.
[0021] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform a document generation method as described in any of the embodiments of the first aspect of this application.
[0022] This application provides a document generation method. When executing the method, in response to selecting a target template of a target type in the open-source office software LibreOffice, an AI assistant ID and a name are automatically assigned to the target template. Then, a corresponding target AI agent is assigned to either the AI assistant ID or the target template. Next, in response to a user's document creation operation based on the target template, a target document is generated. Finally, in response to the user's selection operation, the target document is processed by the target AI agent to obtain the AI-generated document. In this way, when the user selects a LibreOffice target template, a corresponding AI assistant ID and AI agent are automatically assigned, avoiding the limitations of general-purpose AI in processing different document types. This ensures that the AI agent processing documents generated based on the target template has the ability to match the template type, thereby significantly improving the accuracy of the generated document. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings used in the description of the embodiment or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A flowchart illustrating a document generation method provided in this application embodiment; Figure 2 This is a schematic diagram of the structure of a document generation device provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0025] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. This application provides a document generation method and apparatus, which relates to the field of data processing technology. The above are merely examples and do not limit the application field of the method and apparatus provided in this application.
[0026] With the rapid development of artificial intelligence technology, intelligent office solutions have become an important direction for improving office efficiency and optimizing user experience. Open-source office software, with its advantages of being free, open-source, and highly customizable, has been widely used by both individual and enterprise users. LibreOffice, as a mainstream open-source office suite, covers multiple office scenarios such as word processing, spreadsheet creation, and presentation design, meeting users' diverse document creation and editing needs.
[0027] In actual office work, templates are a core tool for users to quickly generate standardized documents. LibreOffice offers a wealth of built-in templates and also supports user-defined templates to adapt to document format requirements in different industries and scenarios. However, the existing LibreOffice template application model still has obvious limitations: on the one hand, templates only serve as fixed-format document blueprints and lack deep integration with artificial intelligence technology. After creating a document based on a template, users still need to manually complete a series of tasks such as content filling, format optimization, and logic verification. Especially for complex documents, manual operation is not only time-consuming and labor-intensive, but also prone to problems such as non-standard content and illogical reasoning. On the other hand, the existing technology has not established a connection mechanism between templates and artificial intelligence assistants. Different types of templates cannot be matched with AI tools with corresponding professional capabilities, resulting in insufficient targeting and effectiveness of AI technology in document processing, making it difficult to fully leverage the advantages of intelligent office work.
[0028] Currently, some office software has begun to incorporate AI features, but most adopt a general-purpose AI assistant model, where all types of documents are processed by the same AI assistant. This model has significant drawbacks: different types of templates correspond to documents with different professional attributes. For example, contract templates require AI support with legal clause analysis capabilities, while financial statement templates require AI support with data accounting and analysis capabilities. General-purpose AI assistants cannot meet the professional needs of various fields, often resulting in low accuracy of document processing results. Furthermore, existing technologies lack a unified management mechanism for templates and AI assistants. When using AI functions, users need to manually select AI tools and configure relevant parameters, making the process cumbersome and reducing the convenience of intelligent office work.
[0029] Meanwhile, the rise of AI Agent technology has provided new solutions for intelligent office work. AI Agents can autonomously complete complex tasks such as information retrieval, content generation, and logical reasoning based on preset task objectives and professional capabilities. However, how to effectively integrate AI Agents with the template system of open-source office software, achieve accurate matching between templates and AI Agents, and intelligent processing of template documents has become a pressing technical problem to be solved.
[0030] The inventors, through research, proposed the technical solution of this application. In response to selecting a target template of a target type within the open-source office software LibreOffice, the system automatically assigns an AI assistant ID and a name to the target template. Then, it assigns a corresponding AI agent to either the AI assistant ID or the target template. Next, in response to the user's document creation operation based on the target template, it generates the target document. Finally, in response to the user's selection operation, the target document is processed by the target AI agent to obtain the AI-generated document. In this way, when the user selects a LibreOffice target template, a corresponding AI assistant ID and AI agent are automatically assigned. This avoids the limitations of general-purpose AI in processing different document types and ensures that the AI agent processing the document generated based on the target template has the ability to match the template type, thereby significantly improving the accuracy of the generated document.
[0031] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present application. It should be noted that, for ease of description, only the parts related to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.
[0032] See Figure 1 , Figure 1 A flowchart of a document generation method provided in this application embodiment includes: S101: In response to selecting a target template of a target type in the open-source office software LibreOffice, automatically assign an AI assistant ID and a target template name to the target template.
[0033] Before implementing the method in step S101, it is necessary to first build a background document knowledge base and categorize the historical case documents in the background document knowledge base according to template type. Next, an artificial intelligence plugin is provided for the open-source office software LibreOffice.
[0034] When performing the implementation method in step S101, the user initiates a new document creation operation in LibreOffice. The plugin automatically triggers a pop-up window, displaying multiple categorized templates from the knowledge base. After the user selects a target template, such as a union policy template, a unique AI assistant ID and the target template name are assigned to that template.
[0035] S102: Assign the corresponding target AI agent for the AI assistant ID or target template.
[0036] Next, assign a corresponding target AI agent to the AI assistant ID or target template, and configure the basic actions of this AI agent, such as standby actions when idle and busy actions when working. The plugin binds the corresponding knowledge base permissions to this AI agent based on preset rules.
[0037] S103: In response to the user's document creation operation based on the target template, generate the target document.
[0038] Users create a new Word document, or target document, in LibreOffice based on the selected target template.
[0039] S104: In response to the user's selection operation, the target document is processed by the target AI agent to obtain the AI-generated document.
[0040] The user selects the text paragraph that needs optimization, opens the plugin dropdown menu, selects the desired accessibility function, and the plugin triggers the workflow of the corresponding AI Agent: Expanding on this section: The AI agent retrieves extended elements of similar policies from the knowledge base and generates logically consistent supplementary content; Editing or polishing this section: The AI agent optimizes the language style and logical structure of the text based on standardized expressions, and corrects grammatical or formatting issues. Copy historical cases / text: The AI agent extracts matching historical cases and reference texts from the knowledge base and pastes them below the current paragraph for the user to refer to and revise.
[0041] After obtaining the AI-generated document, it needs to be displayed. The specific display methods are as follows: display it directly as text below the original text for easy editing by the user; or display it in the AI Agent's interactive interface to enhance the intuitiveness and fun of user operation.
[0042] Finally, the completed document is returned to the backend document knowledge base. That is, after the user confirms the final draft of the document, the "add to knowledge base" operation is triggered by the plugin, uploading the completed document to the backend document knowledge base. The knowledge base automatically categorizes and tags newly added documents and updates the corresponding template case library. The newly added document data can be used to optimize the training model of the AI Agent, improving the accuracy of subsequent assisted content generation.
[0043] In the embodiments provided in this application, in response to selecting a target template of a target type in the open-source office software LibreOffice, an AI assistant ID and a name are automatically assigned to the target template. Then, a corresponding target AI agent is assigned to either the AI assistant ID or the target template. Next, in response to the user's document creation operation based on the target template, a target document is generated. Finally, in response to the user's selection operation, the target document is processed by the target AI agent to obtain the AI-generated document. In this way, when the user selects a LibreOffice target template, a corresponding AI assistant ID and AI agent are automatically assigned, avoiding the limitations of general-purpose AI in processing different types of documents. This ensures that the AI agent processing the document generated based on the target template has the ability to match the template type, thereby significantly improving the accuracy of the generated document.
[0044] The above describes some specific implementations of the document generation method provided in this application. Based on this, this application also provides a corresponding apparatus. The apparatus provided in this application will be described below from the perspective of functional modularity.
[0045] See Figure 2 , Figure 2 This is a schematic diagram of a document generation device 200 provided in an embodiment of this application. The document generation device 200 includes: The first allocation module 210 is used to automatically assign an AI assistant ID and a target template name to the target template in response to selecting a target template of a target type in the open-source office software LibreOffice. The second allocation module 220 is used to allocate a corresponding target intelligent agent to the artificial intelligence assistant ID or the target template; The first generation module 230 is used to generate a target document in response to a user's document creation operation based on the target template; The second generation module 240 is used to process the target document through the target AI agent in response to the user's selection operation to obtain an AI-generated document.
[0046] Optionally, the device 200 further includes: The building module is used to build the backend document knowledge base; The classification module is used to classify historical case documents in the background document knowledge base according to template type.
[0047] Optionally, the second generation module 240 is specifically used for: Using the target AI agent, extended resources are obtained from the background document knowledge base according to the template type, and the target document is extended to obtain the AI-generated document.
[0048] Optionally, the second generation module 240 is specifically used for: The target document is edited or polished using the target AI agent to obtain the AI-generated document.
[0049] Optionally, the second generation module 240 is specifically used for: Using the target AI agent, the matching historical case documents are extracted from the background document knowledge base; The matched historical case documents are copied into the target document to obtain the AI-generated document.
[0050] Optionally, the device 200 further includes: The target AI agent is used to display the documents generated by the AI.
[0051] Optionally, the device 200 further includes: The AI-generated documents are added to the background document knowledge base according to the template type.
[0052] This application also provides corresponding devices and computer storage media for implementing the solutions provided in this application.
[0053] like Figure 3 As shown, computer device 01 is represented in the form of a general-purpose computing device. The components of computer device 01 may include, but are not limited to: one or more processors or processor units 03, system memory 08, and bus 04 connecting different system components (including system memory 08 and processor unit 03).
[0054] Bus 04 represents one or more of several bus architectures, including memory buses or memory controllers, peripheral buses, graphics acceleration ports, processors, or local buses using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0055] Computer device 01 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 01, including volatile and non-volatile media, removable and non-removable media.
[0056] System memory 08 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 09 and / or cache memory 10. Computer device 01 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 11 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 3 Not shown; usually referred to as a "hard drive"). Although Figure 3 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 04 via one or more data media interfaces. System memory 08 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0057] A program / utility 12 having a set (at least one) of program modules 13 may be stored, for example, in system memory 08. Such program modules 13 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 13 typically perform the functions and / or methods described in the embodiments of the present invention.
[0058] Computer device 01 can also communicate with one or more external devices 02 (e.g., keyboard, pointing device, display 07, etc.), and with one or more devices that enable a user to interact with the computer device 01, and / or with any device that enables the computer device 01 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through input / output (I / O) interface 06. Furthermore, computer device 01 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) through network adapter 05. Figure 3 As shown, network adapter 05 communicates with other modules of computer device 01 via bus 04. It should be understood that, although... Figure 3 As not shown in the diagram, it can be used in conjunction with computer device 01 with other hardware and / or software modules, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0059] The processor unit 03 executes various functional applications and data processing by running programs stored in the system memory 08, such as implementing a document generation method provided in the embodiments of this application.
[0060] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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. Without further limitations, 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 said element.
[0061] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus a general-purpose hardware platform. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as a read-only memory (ROM) / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a router) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0062] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0063] The above description is merely an exemplary implementation of this application and is not intended to limit the scope of protection of this application.
Claims
1. A document generation method, characterized in that, include: In response to selecting a target template of a target type in the open-source office software LibreOffice, the AI assistant ID and the name of the target template are automatically assigned to the target template; Assign a corresponding target AI agent to the AI assistant ID or the target template; In response to a user's document creation operation based on the target template, the target document is generated; In response to the user's selection, the target document is processed by the target AI agent to obtain an AI-generated document.
2. The method according to claim 1, characterized in that, Before automatically assigning an AI assistant ID and a name to the target template in response to selecting a target template of a target type in the open-source office software LibreOffice, the method further includes: Build a backend document knowledge base; The historical case documents in the background document knowledge base are classified according to template type.
3. The method according to claim 2, characterized in that, In response to the user's selection operation, the target document is processed by the target AI agent to obtain an AI-generated document, including: Using the target AI agent, extended resources are obtained from the background document knowledge base according to the template type, and the target document is extended to obtain the AI-generated document.
4. The method according to claim 1, characterized in that, In response to the user's selection operation, the target document is processed by the target AI agent to obtain an AI-generated document, including: The target document is edited or polished using the target AI agent to obtain the AI-generated document.
5. The method according to claim 2, characterized in that, In response to the user's selection operation, the target document is processed by the target AI agent to obtain an AI-generated document, including: Using the target AI agent, matching historical case documents are extracted from the background document knowledge base; The matched historical case documents are copied into the target document to obtain the AI-generated document.
6. The method according to claim 1, characterized in that, In response to a user's selection action, after processing the target document through the target AI agent to obtain an AI-generated document, the method further includes: The target AI agent is used to display the documents generated by the AI.
7. The method according to claim 2, characterized in that, In response to a user's selection action, after processing the target document through the target AI agent to obtain an AI-generated document, the method further includes: The AI-generated documents are added to the background document knowledge base according to the template type.
8. A document generation device, characterized in that, include: The first allocation module is used to automatically assign an AI assistant ID and a target template name to the target template in response to selecting a target template of a target type in the open-source office software LibreOffice. The second allocation module is used to allocate a corresponding target intelligent agent to the AI assistant ID or the target template; The first generation module is used to generate the target document in response to a user's document creation operation based on the target template; The second generation module is used to respond to the user's selection operation by processing the target document through the target AI agent to obtain an AI-generated document.
9. A computer device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the document generation method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the document generation method as described in any one of claims 1-7.