Interactive controllable HSE report auxiliary generation method based on large model
By constructing an interactive HSE report generation method based on a large model, utilizing LLM to extract multi-level task information and writing framework, and combining user editing and semantic similarity matching, the problem of controlling the writing scope, structure, and style in HSE report generation is solved, achieving efficient and standardized report generation and improving the quality and efficiency of management work.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- POWERCHINA HUADONG ENG CORP LTD
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-24
AI Technical Summary
Existing HSE report generation methods are difficult to control precisely in terms of writing scope, structure and style, resulting in unstable report quality and a high barrier to entry for security managers without technical backgrounds.
By acquiring user-uploaded HSE notification files, report template files, and high-quality past reports, LLM is used to extract multi-level task information and writing frameworks, construct hierarchical report outlines, and generate report content by combining user editing and semantic similarity matching, thus achieving interactive and controllable report generation.
It enables intelligent, controllable, efficient, and standardized generation of HSE reports, ensuring that reports strictly comply with the company's writing scope, structure, and style requirements, thereby improving the efficiency and quality of management work.
Smart Images

Figure CN121920342A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to an interactive and controllable HSE report generation method based on a large model. It is applicable to the field of artificial intelligence. Background Technology
[0002] In corporate health, safety, and environment (HSE) management practices, it is essential to promptly generate activity summary reports after regularly conducting safety-related activities and meetings. This is a crucial step in implementing safety management responsibilities, tracking problem rectification, and ensuring compliant operations. However, the traditional HSE report writing process suffers from inefficiency and inconsistent quality. Manually writing a complete HSE report typically requires a significant investment of time and effort from professionals, and the quality can easily vary due to differences in the experience of the writers. With the rapid development of artificial intelligence technology, the outstanding performance of large-scale models in natural language generation offers the technological possibility of assisting safety managers in drafting initial HSE summary reports, allowing them to focus their efforts on core tasks such as risk identification and control.
[0003] Unlike general text generation tasks, HSE report generation has standardized domain characteristics, mainly reflected in the following three aspects: (1) Writing scope constraints: The content of HSE reports must be strictly based on the superior notification documents to ensure that the main matters in the notification are implemented in the report; (2) Writing structure requirements: HSE reports usually have a hierarchical structure, and the chapter structure of some activity reports is fixed and the content requirements of each chapter are clear. For example, HSE reports on flood control and drought relief need to summarize and explain matters such as pre-flood, mid-flood and post-flood matters; (3) Standardized writing style: The writing style of HSE reports should reflect the characteristics of the professional field, and the content should be specific and pragmatic, avoiding vague expressions and ensuring the accuracy of the content in the report. The above characteristics determine that the HSE report generation method must have a highly controllable text generation capability, rather than an open free text creation.
[0004] Currently, report generation methods on the market mainly rely on two technical paths: one is end-to-end generation, which uses a pre-trained language model to guide the model to output a complete topic report in a single operation by constructing prompts and coordinating with user commands; the other is through a rule engine, which extracts structured information from writing materials and fills it into fixed positions in a preset template to generate a report. However, both of these technologies have inherent flaws:
[0005] The first type of end-to-end generative model technology, such as Doubao, KIMI, Tongyi Qianwen, GPT, and Gemini, mainly controls the scope, structure, and style of writing when generating reports through three methods: a) uploading reference materials (such as HSE notification documents, report templates, and previous high-quality reports) as writing materials for the model to retrieve and refer to during subsequent generation, avoiding complete freedom of expression; b) providing fine-grained instructions to guide the model in generating content that meets the requirements; c) generating a report outline for the user to adjust, and then generating a complete report based on the revised outline.
[0006] However, due to the end-to-end nature of the large language model generation process, users cannot fully intervene in and control the outline and report generation processes. They can only provide additional guidance based on prompts, resulting in the final generated content failing to meet the precise constraints of the business. Correspondingly, the guidance process places high demands on the quality of the prompts, thus presenting a high barrier to entry, which poses a substantial obstacle for security managers without a technical background.
[0007] The second rule-based template filling technique can extract information from references through predefined rules, but it lacks dynamic adaptability and is difficult to meet the content framework of diverse HSE notification documents and report templates, which may result in the loss of important information in the report. Summary of the Invention
[0008] The technical problem to be solved by the present invention is to provide an interactive and controllable HSE report generation method based on a large model to address the above-mentioned problems.
[0009] The technical solution adopted in this invention is: an interactive and controllable HSE report generation method based on a large model, comprising: Obtain user-uploaded materials related to the report to be generated, including HSE notification documents, report template files, and high-quality past reports; The LLM is invoked to extract multi-level event information (including titles and summary descriptions / abstracts) from the HSE notification file, extract the report writing framework from the report template file, and construct a hierarchical report outline based on the multi-level event information and the report writing framework. Show the report outline to the user, obtain the user's editing operations on the report outline, and generate the final draft of the outline in response to the user's finalization instructions; The previous high-quality reports were divided into chapter blocks according to their chapters. Each chapter block was matched with the title of each item in the final draft of the outline according to semantic similarity, which served as a reference for the writing style when writing the items. The LLM is invoked to generate the content of each chapter of the report based on the information of each item in the final draft of the outline and the chapter blocks in the previous high-quality reports, and to synthesize the HSE report.
[0010] The process of obtaining user-uploaded materials related to the report to be generated includes: The file format of the user-uploaded file is determined by detecting the file name extension, and non-editable text is converted into editable text data using OCR optical recognition technology.
[0011] Extract multi-level event information from the HSE notification document, including: Call LLM to extract the main chapter titles and their summary descriptions from each chapter and paragraph of the HSE notification document as secondary item information for the report outline; The HSE notification file is segmented according to the extracted second-level item titles, and LLM is called to perform sub-item detection and extraction on each second-level item paragraph to obtain the third-level item information under the specified second-level items in the report outline.
[0012] Extract the report writing framework from the report template file, including: The LLM is invoked to identify and extract the overall title, main chapter titles, and a summary of chapter writing requirements from the report template file, which serve as the writing framework for the report, namely the overall title and first-level information of the report outline.
[0013] The construction of a hierarchical report outline based on multi-level information and report writing framework includes: Call LLM to categorize the second-level items and their corresponding third-level items in the multi-level item information into the first-level item headings of the report writing framework; Determine whether the current level 2 or 3 items meet the chapter writing requirements in the report template file. If not, automatically generate new level 2 or 3 item information (title and summary) until the requirements are met.
[0014] The process of matching each chapter block with the titles of each item in the final draft of the outline based on semantic similarity includes: The algorithm uses a semantic similarity algorithm based on string matching to calculate the semantic similarity index between the title of the item and the reference chapter block. When the semantic similarity index is greater than the preset value, the chapter block is used as a writing style reference when generating the corresponding item report.
[0015] The process of generating the content of each chapter of the report based on the information of each item in the final draft of the outline and its matching chapter blocks in previous high-quality reports includes: Using the title, summary description, and word count requirements of each item as key generation goals and constraints, and combining the writing style of the corresponding chapter blocks of each item, report generation prompts are constructed step by step, and a sequence of chapters to be generated is formed. The LLM function is invoked, and a parallel generation strategy is used based on the prompts of the chapter sequence to be generated to generate multiple chapter contents simultaneously.
[0016] An interactive and controllable HSE report generation device based on a large model, comprising: The material acquisition module is used to acquire materials related to the report to be generated uploaded by users, including HSE notification files, report template files, and high-quality reports from previous periods; The outline construction module is used to call LLM, extract multi-level matter information from the HSE notification file, extract the report writing framework from the report template file, and construct a hierarchical report outline based on the multi-level matter information and the report writing framework. The user editing module is used to display the report outline to the user, obtain the user's editing operations on the report outline, including: text content editing, hierarchical order changes, addition and deletion of items, and generation of word count requirements, and generate the final draft outline in response to the user's finalization instructions; The style matching module is used to split the previous high-quality reports into chapter blocks according to their chapters, and match each chapter block with the title of each item in the final draft of the outline according to semantic similarity, as a reference for the writing style when writing the items; The report generation module is used to call the LLM (Local Management Library) and, based on the information of each item in the final draft of the outline, the generation requirements, and the matching chapter blocks in previous high-quality reports, generate the content of each chapter of the report and synthesize the HSE report.
[0017] A storage medium storing a computer program executable by a processor, wherein the computer program, when executed, implements the steps of the large-model-based interactive and controllable HSE report generation method.
[0018] An interactive and controllable HSE report generation device has a memory and a processor. The memory stores a computer program that can be executed by the processor. When the computer program is executed, it implements the steps of the interactive and controllable HSE report generation method based on a large model.
[0019] The beneficial effects of this invention are: by constraining the scope of report writing through HSE notification documents, constraining the writing structure through report template documents, and constraining the writing style through past high-quality reports, and by combining LLM, a multi-level outline and dynamic report construction mechanism are constructed, thus realizing an intelligent, controllable, efficient and standardized HSE report generation method.
[0020] The interactive user intervention mechanism in this invention allows users to fine-tune the report structure and content summary during the outline stage, effectively enhancing the report's relevance and controllability. The extraction of notification documents, the guidance of report template frameworks, and the matching of past report fragments ensure that the generated report strictly conforms to the company's writing scope, structure, and style requirements, thereby helping the company improve the efficiency and quality of its HSE (Health, Safety, and Environment) management work as a whole. Attached Figure Description
[0021] Figure 1 This is a flowchart of the interactive and controllable HSE report generation method in the embodiment.
[0022] Figure 2 This is a system diagram showing the step S100 in the embodiment where the user-uploaded HSE report is received and related files are generated.
[0023] Figure 3 This is a system diagram showing the process in which step S300 of the embodiment receives and responds to the user's editing operation on the report outline.
[0024] Figure 4 This is a system diagram showing the process of outputting the full text of the HSE report to the online editing interface in step S500 of the embodiment. Detailed Implementation
[0025] The embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention. The step numbers in the following embodiments are set only for ease of explanation, and there is no limitation on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
[0026] In the description of this invention, "multiple" means two or more. The use of "first" and "second" is for distinguishing technical features only and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or the order of the indicated technical features. Furthermore, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art.
[0027] Example 1: As Figure 1 As shown, this embodiment is an interactive and controllable HSE report generation method based on a large model, which specifically includes the following steps: S100. Obtain the materials related to the report to be generated uploaded by the user, including HSE notification documents, report template files, and high-quality reports from the past.
[0028] In this embodiment, the HSE notification file typically includes the HSE activity name, activity deployment, activity introduction, activity plan, and activity requirements. It serves as a key source of information for generating the HSE report and constrains the scope of the report writing. The report template file includes the HSE report title, first-level chapter titles, and the writing requirements for each chapter. It is used to construct the overall writing framework of the HSE report and constrain the writing structure. High-quality past reports can be summary reports of past HSE activities. The writing style and preference focus contained therein serve as a style reference for generating the HSE report and constrains the writing style.
[0029] This example performs format detection on user-uploaded HSE notification files, report template files, and past reports. The file format is determined by the filename extension: ".pdf" corresponds to PDF format, and ".doc" or ".docx" corresponds to Word format. If the user-uploaded file is a non-editable text format such as PDF, OCR (Optical Character Recognition) technology is used to recognize the text page by page and convert it into editable text data. The OCR technology used in this embodiment comes from an existing document parsing service, such as TextIn (https: / / www.textin.com / ).
[0030] Figure 2 This shows the interface for uploading files related to HSE report generation. Clicking area 1 allows you to upload HSE notification files; note that only a single file can be uploaded. Clicking area 2 allows you to upload past high-quality reports as reference material for writing; note that a maximum of 3 files can be uploaded. Clicking area 3 allows you to upload report template files; note that only a single file can be uploaded.
[0031] S200. Call LLM to extract multi-level event information from the HSE notification file, extract the report writing framework from the report template file, and construct a hierarchical report outline based on the multi-level event information and the report writing framework.
[0032] S210. Call LLM to extract the main chapter titles and their summary descriptions from each chapter and paragraph of the HSE notification document as secondary item information in the report outline.
[0033] In this embodiment, the prompt words for extracting secondary items of the report outline from the HSE notification file are as follows: Task: Extract the overall requirements and main items precisely from the notification. Please strictly follow the steps below to ensure that only the main items are extracted, excluding sub-items.
[0034] ### Steps:
[0035] 1. **General Requirements:** Read through the original notice, summarize and output the general requirements.
[0036] 2. **Main Item Identification and Extraction**: Identify the main items required in the original notification, ensuring that the number and order of the titles are consistent with the original text, and construct an item set A that only contains the outer main items and does not contain sub-items.
[0037] - **Primary Item Extraction Criteria**:
[0038] - Main item titles are usually concise and summarizing, and not particularly specific.
[0039] - When there are multiple levels of master-sub-items, the master item uses the outer level number, such as (I), (II), (III), etc.
[0040] - If a multi-level structure exists under the same item, only the outermost title is retained. For example, if "(I) Strictly Investigate Dangerous Goods" includes "1. Investigate Civil Explosives", then only "(I) Strictly Investigate Dangerous Goods" is extracted as the main item.
[0041] 3. **Identify and exclude sub-items:**
[0042] - Criteria for determining whether something is a sub-item:
[0043] - When viewing the original notification, sub-item numbers are usually presented in a different format than the main item number, such as numbers (1, 2, 3...), letters (a, b, c...), or Roman numerals (I, II, III...).
[0044] - For example: If "(I) Strictly investigate dangerous materials" and "1. Investigate civil explosive materials" appear, "Investigate civil explosive materials" is a sub-item.
[0045] - When the main item title and sub-item content appear in pairs, the sub-item content is usually more specific.
[0046] - The number of items in item set A is usually less than 15.
[0047] 4. **Exclude irrelevant items:** Remove headings from item set A that do not belong to the actual tasks, including "Schedule", "Work Arrangement", "Rectification Arrangement", "Organization and Leadership", "Publicity and Deployment", "Work Objectives", etc.
[0048] - The titles of the extracted items should be relatively specific, and items that are not items, such as "key investigation content" or "main tasks", should be removed.
[0049] 5. **Summarize the main items:** Read through the content of each main item and provide a summary of the content.
[0050] ### Require:
[0051] - Maintain consistency with the original text: The description of the main item title must be completely consistent with the original text.
[0052] - Output only the title, do not include the content, and do not include numbers in the title.
[0053] - The number of main items extracted is consistent with the original notification text and listed in the original order.
[0054] **Notice**:
[0055] - **Item Title Limitation**: Extracted item titles will not exceed 20 characters.
[0056] - **Item Content Limitation**: The generated item content summary will not exceed {content_len} characters.
[0057] **Notification Text:**
[0058] ```
[0059] {doc_text}
[0060] ```
[0061] Please output according to the following format:
[0062] ```
[0063] General Requirements: [Extract and summarize the general requirements from the notice here]
[0064] Output format:
[0065] 1. [Item 1 title in the original text]
[0066] - Content: [Summary of Item 1 in the original text]
[0067] 2. [Item 2 title in the original text]
[0068] - Content: [Summary of Item 2 in the original text]
[0069] ```
[0070] The doc_text variable represents the text information in the HSE notification file uploaded by the user, while the main item title and main item summary correspond to the sub-item titles and their summary descriptions in the report outline.
[0071] S220. The HSE notification file uploaded by the user is segmented according to the secondary item titles extracted in step S210, and LLM is called to check whether there are sub-items in the segmented chapter blocks segment by segment. When the detection result is that there are sub-items, LLM is called to extract the sub-item titles and their summary descriptions from the chapter block in parallel as the tertiary item information under the corresponding secondary item in the report outline.
[0072] In this embodiment, the prompt words used to determine whether there are sub-items in the segmented HSE notification document sections are as follows: Task: Check if a text segment can be broken down into multiple content blocks using headings or labels.
[0073] **Judgment Basis**:
[0074] 1. Does the text segment contain explicit headings or labels to distinguish different content blocks?
[0075] 2. Examples of labeling include, but are not limited to, the following formats:
[0076] - Numbers: 1, 2, 3...
[0077] - Numbers in parentheses: (1), (2), (3)...
[0078] - Chinese serial numbers: (I), (II), (III)...
[0079] - Letters: a, b, c...
[0080] **Notice**:
[0081] - If page numbers exist in the text segment (such as "Page 1", "Page 2", "- 1 —", etc.), their effect should be ignored, and page numbers are not considered as labels.
[0082] - Output `yes` only if the text contains the above valid labels or explicit heading separators; otherwise, output `no`.
[0083] Input text:
[0084] ```
[0085] {doc_text}
[0086] ```
[0087] Output:
[0088] yes or no
[0089] The variable doc_text represents the text of a specific chapter block, and yes and no represent the presence and absence of sub-items in that chapter block, respectively.
[0090] In this embodiment, the prompt words for extracting the report outline level 3 item information from the chapter block containing sub-items are as follows:
[0091] Task: Extract the item titles and their corresponding content that are clearly labeled from "Text 2". Before extraction, compare "Text 1" (summary) and "Text 2" and delete any content in "Text 2" that is not included in the summary. Then extract the item titles and their content. The labeling format may include, but is not limited to, the following:
[0092] - Numbers: 1, 2, 3...
[0093] - Numbers in parentheses: (1), (2), (3)...
[0094] - Chinese serial numbers: (I), (II), (III)...
[0095] **Notice**:
[0096] 1. **Item Title Limitation**: The extracted item title shall not exceed 20 characters. If the original title exceeds this limit, it shall be appropriately simplified, but the core information shall be kept intact.
[0097] 2. **Item Content Limitation:** The generated item content summary will not exceed {content_len} characters.
[0098] 3. “Text 1” is only used to determine whether there is irrelevant content in “Text 2”, and is not used as the basis for item extraction. The extraction process is entirely based on “Text 2”.
[0099] 4. After deleting irrelevant content, the number of extracted items must be consistent with the number of main item titles in "Text 2", and the order must remain strictly unchanged.
[0100] 5. Unlabeled content will not be included in the extraction scope.
[0101] 6. Irrelevant content in “Text 2” is usually paragraphs with headings such as “Activity Requirements”, “Work Requirements”, “Work Arrangements”, etc. These paragraphs are irrelevant to the extraction of items and should be deleted.
[0102] ### Steps:
[0103] 1. **Comparison and Cleanup**:
[0104] - Read through "Text 1" and "Text 2" to check if there are any paragraphs or content in "Text 2" that are not related to the summary.
[0105] - Delete all content not mentioned in "Text 1" and keep the rest for extraction.
[0106] 2. **Identify and extract primary and secondary items:**
[0107] - Check if the cleaned "Text 2" contains a multi-level item structure, and extract it according to the following rules:
[0108] - **Outer Layer Item Extraction**: Only the title and corresponding content of the outer layer main item are extracted, ensuring that the title order is consistent with that in "Text 2", and the titles of sub-items are not included.
[0109] - **Primary Item Identification Criteria**: Primary items and sub-items usually have different numbering formats. For example, primary items may use numbers (1, 2, 3...), while sub-items may use letters (a, b, c...) or ((1), (2), (3)...).
[0110] 3. **Output format requirements:**
[0111] - Each item needs to be summarized to ensure the accuracy of the information and to leave out any key points.
[0112] - Keep the headings and order consistent with "Text 2" without making any changes.
[0113] Input text:
[0114] Text 1 (Summary): {summary_text}
[0115] Text 2 (Original Item): {doc_text}
[0116] Output format: ......
[0118] The `content_len` variable is a pre-defined word limit for the summary of third-level items (i.e., a brief description), which is preset to 80 characters in this embodiment. To ensure that the extracted third-level item content is included within the scope of the corresponding second-level items extracted in step S210, the prompt explicitly requires: first, filter the `doc_text` (the segmented text of specific chapter blocks) based on `summary_text` (the summary of second-level items), deleting information in the chapter blocks that is irrelevant to the corresponding second-level items, and then extract the third-level items from it. It should be noted that the "output format" part of the prompt for extracting third-level items in the report outline in this step is consistent with the extraction of second-level items in step S210, and will be omitted here with "..." without being repeated.
[0119] S230. Call LLM to identify and extract the report's main title, first-level chapter titles, and a summary of chapter writing requirements from the report template file, as the report's writing framework, i.e., the main title and first-level item information of the report outline.
[0120] In this embodiment, the prompts for extracting the overall title and first-level item information of the report outline from the report template file are as follows:
[0121] Task: Extract the main title, chapter titles, and chapter content from the template text. Please follow the steps below carefully.
[0122] ### Steps:
[0123] 1. **Main Title**: The main title is usually in the first few lines. Please organize it into one line while maintaining consistency with the original text. If it contains words such as "template", please remove them.
[0124] 2. **Chapter Title Recognition and Extraction**: Identify the main chapters following the numbers I, II, III, etc., ensuring that their text, number, and order are consistent with the original text. No chapter content extraction is required here.
[0125] 3. **Chapter Content Identification and Summary**: Each chapter may contain a few sentences or paragraphs explaining how to write the content of this section.
[0126] - If the output is short (one or two sentences), please maintain consistency with the original text. If it begins or ends with parentheses or quotation marks, please remove them.
[0127] - If the text is long (with several paragraphs), please summarize it and output the summary. If it contains subheadings such as (I), (II), (III), (1), (2), (3), please extract the content of the subheadings and summarize it.
[0128] - If the content of a chapter is repetitive, please summarize and retain only one aspect.
[0129] 4. **Irrelevant content filtering and image tooltip exclusion:**
[0130] - There may be content in each chapter that is not related to the actual writing guidance, such as image prompts like "screenshot", "photo", "picture".
[0131] - In the final output, please completely remove all such prompts that are irrelevant to the text writing, and ensure that the output does not contain any descriptions of image pasting, insertion, display, or other operations.
[0132] - If the entire passage only contains image prompts without any effective writing guidance, please simply output "".
[0133] **Notice**:
[0134] **Chapter Title Restrictions:** The text, number, and order of chapter titles must remain consistent with the original text.
[0135] **Chapter Content Limitation:** If a chapter is too long, please condense and summarize it. Ensure the chapter content does not exceed {content_len} words.
[0136] **Template Text:**
[0137] ```
[0138] {template_text}
[0139] ```
[0140] Please output according to the following format:
[0141] ```
[0142] Title: [The main title in the text]
[0143] chapter: ......
[0145] ```
[0146] The `template_text` variable represents the text information in the report template file uploaded by the user. It should be noted that the output format of the report outline's main title and the "chapter" format extracted from the first-level items in this step is consistent with the output format of the second- and third-level items extracted from the report outline in steps S210 and S220. This will be omitted here and will not be repeated.
[0147] S240. Call LLM to classify the secondary items and their corresponding tertiary items of the report outline extracted in step S210 under the first-level chapter titles in the report template file (i.e., the first-level item titles of the report outline). Evaluate the comprehensiveness of the existing secondary and tertiary items according to the chapter writing requirements in the template file, and determine whether the current secondary and tertiary items meet the chapter writing requirements. If not, refine and generate new secondary and tertiary items, thereby completing the multi-level item matching and overall structure construction of the report outline.
[0148] In this embodiment, the prompts for matching and expanding multi-level items in the report outline are as follows:
[0149] Task: Given a template labeled "Text 1" and a set of second-level headings labeled "Text 2", please categorize the second-level headings in Text 2 according to the chapter headings in Text 1 and fill them into the corresponding positions in Text 1. Please strictly follow the steps below.
[0150] ### Steps:
[0151] 1. **Content Comprehension:** Read through Text 1 and Text 2 to understand their correspondence. Text 1 contains multiple chapter titles, and the "Content" section under each chapter explains how to write that chapter.
[0152] 2. **Text 2 Classification and Filling:** Referring to the chapter titles and content of Text 1, classify the second-level headings in Text 2 under the different chapter titles of Text 1.
[0153] 3. **Expanding Second-Level Headings**: The chapter content may contain some items not covered by text 2. Please organize these items into second-level headings and output them under the corresponding chapters.
[0154] **Notice**:
[0155] - **Title Restrictions:** Existing chapter titles and second-level headings in Text 1 and Text 2 must remain consistent with the original text; no text modifications are permitted.
[0156] - **Standards for expanding second-level headings:** These are typically concise, providing a strong overview, and not particularly detailed.
[0157] - No interpretation of the classification results is required.
[0158] Input text:
[0159] Text 1 (template): {template_text}
[0160] Text 2 (Second-level heading): {second_level_titles}
[0161] Please output according to the following format:
[0162] ```
[0163] 1. [Chapter 1 title in Text 1]
[0164] - [Heading 1 in text 2]
[0165] - [Heading 2 in text 2]
[0166] 2. [Chapter 2 title in Text 1]
[0167] - [Expanded Heading 1] ......
[0169] ```
[0170] The `template_text` variable represents the text information in the report template file uploaded by the user, and the `second_level_titles` variable represents the second-level item titles in the report outline.
[0171] S250. Based on the multi-level item matching results of step S240, integrate the first, second, and third level item information extracted and expanded in steps S210 to S240 to construct a complete report outline, and transmit it to the front end in JSON format so that the output results can be displayed in the interactive report outline editing interface.
[0172] In this embodiment, the complete report outline data structure, dynamically constructed by extracting multi-level items from the report template and HSE notification document, is shown below:
[0173] {
[0174] "overall_title": "HSE Activities Work Summary",
[0175] "first_level_items": [
[0176] {
[0177] "title": "Event Deployment",
[0178] "content": "A special action leading group has been established to be responsible for the formulation of the action's work list, organization and implementation, guidance and coordination, publicity and mobilization, process supervision, summary and evaluation, etc."
[0179] "second_level_items": []
[0180] },
[0181] {
[0182] "title": "Main Task Completion Status",
[0183] "content": "Briefly describe the completion status of the main tasks of this activity,",
[0184] "second_level_items": [
[0185] {
[0186] "title": "Task One",
[0187] "content": "Task 1 Completion Status",
[0188] "third_level_items": [
[0189] {
[0190] "title": "Education and Training",
[0191] "content": "Conduct safety education and training"
[0192] }, ...]
[0194] }, ...]
[0196] }, ...]
[0198] }
[0199] The `overall_title` variable represents the overall title of the report, while the `first_level_items`, `second_level_items`, and `third_level_items` variables represent the sets of first-, second-, and third-level items in the report outline, respectively. Each item's information includes a title, content (summary description), and a set of its subordinate sub-items. The generated report outline unfolds and arranges the first-, second-, and third-level items extracted from the report template and HSE notification documents in this tree structure.
[0200] S300: Displays the report outline to the user, obtains the user's editing operations on the report outline, and generates the final draft of the outline in response to the user's finalization instructions.
[0201] In this embodiment, the system receives and responds to user modifications to the titles and summary descriptions of items at each level in the report outline, including text editing, changes to the order of item hierarchy, and addition and deletion of items; it also receives user settings for the length of paragraphs at each level of the report, i.e., the word count requirements for paragraph generation.
[0202] Figure 3 The image shows the interactive outline editing interface. The left side of the interface displays all the original files uploaded by users. You can switch between different files by clicking the tabs at the top of the left side of the interface. The right side of the interface displays the generated multi-level report outline. The report outline in the initial editing interface is consistent with the data structure of the JSON format output in step S200.
[0203] Figure 3 The boxes within represent the interactive report outline editing interface, allowing users to edit the generated report outline. All operations are received and updated in real time to the outline structure. Each level of content in the report outline exists as an independent editable block.
[0204] Clicking the text of item number 1 (including item title and summary description) allows direct editing of the text content. Long-pressing button number 2 allows dragging the corresponding item up or down to adjust its hierarchical position in the report outline. Clicking button number 3 deletes the corresponding item and all its sub-items. Clicking button number 4 adds sub-items under the corresponding chapter item; note that this operation only supports first and second-level items, with third-level items being the highest level and unable to have sub-items added. Clicking button number 5 configures the paragraph length (word count) for the corresponding chapter item in the generated report; selectable levels include Large (500 words), Medium (200 words, default), and Small (100 words). This setting will be stored as a parameter and passed as prompts during subsequent report generation to control the chapter output length. Note that only leaf nodes (chapters without sub-items) in the report outline support paragraph length settings.
[0205] S400. Divide the previous high-quality reports into chapter blocks according to their chapters, and match each chapter block with the title of each item in the final draft of the outline according to semantic similarity, as a reference for the writing style when writing the items.
[0206] S410. Call LLM to extract chapter titles in parallel from the high-quality reports uploaded by users in the past, and split the original text into independent writing style reference chapter blocks according to the chapter titles.
[0207] In this embodiment, the prompt words for extracting chapter titles from previous high-quality reports are as follows:
[0208] Task: Identify and extract chapter titles from text. Chapter titles typically follow numbered 1, 2, 3, etc. Ensure that their text, number, and order match the original text. Note that no chapter content needs to be extracted.
[0209] **Template Text:**
[0210] ```
[0211] {input_text}
[0212] ```
[0213] Please output according to the following format:
[0214] ```
[0215] chapter:
[0216] 1. [Chapter 1 title in the original text]
[0217] 2. [Chapter 2 title in the original text]
[0218] ```
[0219] The input_text variable represents the text information in past reports uploaded by the user.
[0220] S420. Calculate the semantic similarity between the leaf nodes in the final outline generated in S300 and the split, independent writing style reference chapter blocks. In this embodiment, a semantic similarity algorithm based on string matching is used to calculate the semantic similarity index between the leaf node item titles and the reference chapter blocks. This algorithm calculates the ratio by querying the longest common subsequence in two character sequences and combining it with the total sequence length, generating a similarity value between 0 and 1, where 1 represents a complete match and 0 represents a complete mismatch.
[0221] In this embodiment, the preset similarity threshold is 0.3. When the calculated similarity value exceeds this threshold, the corresponding reference chapter block is added to the writing style reference part of the event report generation prompt words, so that LLM can generate chapter content that conforms to the writing style of the corresponding reference chapter block.
[0222] S500 calls LLM to generate the content of each chapter of the report based on the information of each item in the final draft of the outline and the chapter blocks of the matching previous high-quality reports, and synthesizes the HSE report.
[0223] S510. Starting from the third-level items in the final draft of the outline generated by S300, traverse each leaf node, using the title, summary description (or writing requirements) and word count requirements of each item as key generation goals and constraints. Combine the writing style and preferences of the corresponding reference chapter blocks for each node item, construct report generation prompts level by level, and organize them into a sequence of chapters to be generated.
[0224] This embodiment is applied to HSE report generation in the field of power engineering. The prompts for each item in the report content are designed specifically for this field, as follows:
[0225] Task: Based on specific matters and considering the characteristics of the power engineering project, write an activity report reflecting the specific actions taken and their implementation by "this project department" in response to the requirements of the matter. Referring to the given sample text, the report should demonstrate the details and results of the actual execution, highlighting the authenticity and specificity of the work, specifying the people involved, the location, and the implementation measures.
[0226] ### **Writing Requirements**
[0227] 1. **Word Count Requirement**
[0228] - The word count must be kept within **{word_count} words**, absolutely not exceeding this limit!!
[0229] 2. **Specification and Contextualization**:
[0230] - Describe in detail the execution details and results of the task based on the actual implementation of "this project department", avoiding generalities.
[0231] - Describe the time, location, and personnel involved in the execution to enhance the report's authenticity and persuasiveness. Use "So-and-so," "XX," etc., instead of specific names, and use "Month X, Day X" for the time, not a specific date.
[0232] 3. **Clear logic and prominent key points:**
[0233] - Each paragraph describes only one specific response and outcome for a matter, highlighting the actions, methods, and improvements implemented.
[0234] 4. **Original Content**:
[0235] - Process and expand upon the matters, write content with actual implementation details, ensure originality, and strictly prohibit direct quoting or rewriting of the original text of the matters.
[0236] 5. **Writing Standards**:
[0237] - The main body is consistently referred to as "this project department" and written from a third-person perspective. The writing is formal, rigorous, and conforms to the normative requirements of government documents and reports.
[0238] - The narrative should flow smoothly. Avoid list formats and adopt a natural narrative style to ensure that the event report is coherent and logically clear.
[0239] ### **Example Text**
[0240] {examples}
[0241] ### **Notice**:
[0242] 1. The output should consist of the detailed implementation section of the report, excluding titles, signatures, etc. Strictly adhere to the word count requirement and ensure the content is concise and complete.
[0243] 2. The provided sample texts are generally broad and cover a wide range of topics. Please extract relevant content based on the specific topic of your current issue before referring to them!
[0244] Now, I will provide the specifics:
[0245] {doc_text}
[0246] Based on the above requirements, please write an activity report, highlighting specific actions and implementation results. Ensure the content is detailed, the logic is clear, and the language is formal. Do not simply relay the events or summarize the response.
[0247] Among them, the word_count variable represents the paragraph length (i.e. word count requirement) set by the user in step S300; the example variable represents the writing style reference chapter block corresponding to the item to be generated; and the doc_text variable is the specific item information constructed by combining the chapter title and its summary description (or writing requirements) corresponding to the item in the report outline.
[0248] In this embodiment, the specific item information (doc_text) of leaf nodes, such as third-level items, is as follows:
[0249] Regarding the {second_level_item_title} item in the {first_level_item_title} section, write content around the specific sub-item {third_level_item_title}, with the content outline as: {third_level_item_content}
[0250] Here, first_level_item_title and second_level_item_title represent the titles of the first and second level items to which the third level item belongs, respectively, while third_level_item_title and third_level_item_content represent the title of the third level item and its summary description, respectively.
[0251] S520: Invoke LLM and use a parallel generation strategy based on the prompts of the chapter sequence to be generated, generating multiple chapter contents simultaneously to improve generation speed, and integrate them to form the report body. The report body will be transmitted to the front end in JSON format so that the output results can be displayed in the interactive report editing interface. It should be noted that the report body adopts a data structure that is basically the same as the report outline in step S250, but a new field "content_full_text" has been added to the leaf node items to store the specific content of the generated items.
[0252] Figure 4 The image shows the HSE report editing interface. The left side of the interface is the report navigation directory area, and the right side is the report text editing area. The left navigation directory area consists of the chapter titles of the generated report, displaying the hierarchical structure of the generated report, consistent with the outline revised by the user in step S300. The right-hand report content editing window provides complete text editing functions, allowing users to directly edit the report content, including but not limited to text modification and format adjustment. It also supports saving and downloading the edited HSE report.
[0253] Example 2: This example is an interactive and controllable HSE report generation device based on a large model, including: The material acquisition module is used to acquire materials related to the report to be generated uploaded by users, including HSE notification files, report template files, and high-quality reports from previous periods; The outline construction module is used to call LLM, extract multi-level matter information from the HSE notification file, extract the report writing framework from the report template file, and construct a hierarchical report outline based on the multi-level matter information and the report writing framework. The user editing module is used to display the report outline to the user, obtain the user's editing operations on the report outline, and generate the final draft of the outline in response to the user's finalization instructions. The style matching module is used to split the previous high-quality reports into chapter blocks according to their chapters, and match each chapter block with the title of each item in the final draft of the outline according to semantic similarity, as a reference for the writing style when writing the items; The report generation module calls the LLM (Local Management Library) to generate the content of each chapter of the report based on the information of each item in the final draft of the outline and the chapter blocks of the matching high-quality reports from previous periods, and synthesizes the HSE (Health, Safety, and Environment) report.
[0254] Example 3: This example is a storage medium that stores a computer program that can be executed by a processor. When the computer program is executed, it implements the steps of the interactive and controllable HSE report generation method based on a large model described in Example 1.
[0255] Example 4: This example is an interactive and controllable HSE report generation device, which has a memory and a processor. The memory stores a computer program that can be executed by the processor. When the computer program is executed, it implements the steps of the interactive and controllable HSE report generation method based on a large model described in Example 1.
[0256] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this 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.
[0257] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0258] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the aforementioned program can be printed, because the aforementioned program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0259] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0260] In the foregoing description of this specification, references to terms such as "one embodiment," "another embodiment," or "some embodiments" indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of the present invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0261] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0262] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. A method for generating interactive and controllable HSE reports based on a large model, characterized in that, include: Obtain user-uploaded materials related to the report to be generated, including HSE notification documents, report template files, and high-quality past reports; The LLM is invoked to extract multi-level event information from the HSE notification file, extract the report writing framework from the report template file, and construct a hierarchical report outline based on the multi-level event information and the report writing framework. Show the report outline to the user, obtain the user's editing operations on the report outline, and generate the final draft of the outline in response to the user's finalization instructions; The previous high-quality reports were divided into chapter blocks according to their chapters. Each chapter block was matched with the title of each item in the final draft of the outline according to semantic similarity, which served as a reference for the writing style when writing the items. The LLM is invoked to generate the content of each chapter of the report based on the information of each item in the final draft of the outline and the chapter blocks in the previous high-quality reports, and to synthesize the HSE report.
2. The interactive and controllable HSE report generation method based on a large model according to claim 1, characterized in that, The process of obtaining user-uploaded materials related to the report to be generated includes: The file format of the user-uploaded file is determined by detecting the file name extension, and non-editable text is converted into editable text data using OCR optical recognition technology.
3. The interactive and controllable HSE report generation method based on a large model according to claim 1, characterized in that, Extract multi-level event information from the HSE notification document, including: Call LLM to extract the main chapter titles and their summary descriptions from each chapter and paragraph of the HSE notification document as secondary item information for the report outline; The HSE notification file is segmented according to the extracted second-level item titles, and LLM is called to perform sub-item detection and extraction on each second-level item paragraph to obtain the third-level item information under the specified second-level items in the report outline.
4. The interactive and controllable HSE report generation method based on a large model according to claim 1, characterized in that, Extract the report writing framework from the report template file, including: The LLM is invoked to identify and extract the overall title, main chapter titles, and a summary of chapter writing requirements from the report template file, which serve as the writing framework for the report, namely the overall title and first-level information of the report outline.
5. The interactive and controllable HSE report generation method based on a large model according to claim 1, characterized in that, The construction of a hierarchical report outline based on multi-level information and report writing framework includes: Call LLM to categorize the second-level items and their corresponding third-level items in the multi-level item information into the first-level item headings of the report writing framework; Determine whether the current level 2 and 3 items meet the chapter writing requirements in the report template file. If not, expand the level 2 and 3 items until they meet the requirements.
6. The interactive and controllable HSE report generation method based on a large model according to claim 1, characterized in that, The process of matching each chapter block with the titles of each item in the final draft of the outline based on semantic similarity includes: The algorithm uses a semantic similarity algorithm based on string matching to calculate the semantic similarity index between the title of the item and the reference chapter block. When the semantic similarity index is greater than the preset value, the chapter block is used as a writing style reference when generating the corresponding item report.
7. The interactive and controllable HSE report generation method based on a large model according to claim 1, characterized in that, The process of generating the content of each chapter of the report based on the information of each item in the final draft of the outline and its matching chapter blocks in previous high-quality reports includes: Using the title, summary description, and word count requirements of each item as key generation goals and constraints, and combining the writing style of the corresponding chapter blocks of each item, report generation prompts are constructed step by step, and a sequence of chapters to be generated is formed. The LLM function is invoked, and a parallel generation strategy is used based on the prompts of the chapter sequence to be generated to generate multiple chapter contents simultaneously.
8. An interactive and controllable HSE report generation device based on a large model, characterized in that, include: The material acquisition module is used to acquire materials related to the report to be generated uploaded by users, including HSE notification files, report template files, and high-quality reports from previous periods; The outline construction module is used to call LLM, extract multi-level matter information from the HSE notification file, extract the report writing framework from the report template file, and construct a hierarchical report outline based on the multi-level matter information and the report writing framework; The user editing module is used to display the report outline to the user, obtain the user's editing operations on the report outline, and generate the final draft of the outline in response to the user's finalization instructions. The style matching module is used to split the previous high-quality reports into chapter blocks according to their chapters, and match each chapter block with the title of each item in the final draft of the outline according to semantic similarity, as a reference for the writing style when writing the items; The report generation module calls the LLM (Local Management Library) to generate the content of each chapter of the report based on the information of each item in the final draft of the outline and the chapter blocks of the matching high-quality reports from previous periods, and synthesizes the HSE (Health, Safety, and Environment) report.
9. A storage medium having a computer program stored thereon that can be executed by a processor, characterized in that, When the computer program is executed, it implements the steps of the interactive and controllable HSE report generation method based on any one of claims 1 to 7.
10. An interactive and controllable HSE report generation device, comprising a memory and a processor, wherein the memory stores a computer program executable by the processor, characterized in that, When the computer program is executed, it implements the steps of the interactive and controllable HSE report generation method based on any one of claims 1 to 7.