Report generation method and apparatus

CN123031679APending Publication Date: 2026-11-03DAWNING CLOUD COMPUTING TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611327478.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-28
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

现有的报表生成方案难以兼顾数据查询需求与可视化样式要求,导致查询准确率低,资源消耗大,且难以生成结构复杂、可交互的定制化报表页面,无法满足企业级交付标准。

Method used

By pre-setting decomposition templates, query templates, layout templates, and code templates, user input is separated into data query requirements and style descriptions. A large model is used to generate report pages, avoiding redundant resource consumption and unexpected data changes.

Benefits of technology

It improved the accuracy of query statements, reduced system resource consumption, ensured consistency of report data before and after style modifications, and achieved end-to-end automatic generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123031679A_ABST
    Figure CN123031679A_ABST
Patent Text Reader

Abstract

The present disclosure provides a report generation method and device, which is applied to the field of artificial intelligence technology. The method comprises the following steps: in the case that a report prompt word indicates a report generation mode, filling the report prompt word into a preset disassembly template to obtain a disassembly instruction and inputting the disassembly instruction into a preset large model to obtain a plurality of table names, a data range to be queried and style information; determining table structure information according to field information associated with the plurality of table names, filling the data range to be queried and the table structure information into a preset query template to obtain a query instruction and inputting the query instruction into the preset large model to obtain a query statement; filling the style information and a plurality of sample data in report data obtained by using the query statement into a preset layout template to obtain a layout instruction and inputting the layout instruction into the preset large model to obtain layout information; filling the layout information and description information into a preset code template to obtain a code instruction and inputting the code instruction into the preset large model to obtain template source code; and generating a report page based on the template source code into which report data is injected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a method and device for generating reports. Background Technology

[0002] As enterprises deepen their digital transformation, reporting tools have become a core component of data analysis. Many intelligent reporting solutions use a single model to process users' natural language. User commands often simultaneously include data query needs and visualization style requirements, making it difficult for the model to balance logically rigorous query generation with flexible interface design, resulting in low query accuracy.

[0003] Meanwhile, the proposed solutions treat each user request as an independent task. When a user modifies a report style, the entire process of querying, data retrieval, and rendering must be re-executed, consuming significant resources and easily leading to unexpected data changes. Furthermore, these solutions struggle to generate complex, interactive, and customized report pages, failing to meet enterprise-level delivery standards. Summary of the Invention

[0004] In view of this, this disclosure provides a method and apparatus for generating reports.

[0005] According to a first aspect of this disclosure, a method for generating a report is provided. The method includes: when a report prompt indicates a report generation mode, filling the report prompt into a preset decomposition template to obtain a decomposition instruction; inputting the decomposition instruction into a preset large model to obtain multiple table names, a range of data to be queried, and style information of the report; determining the table structure information of the report based on the field information associated with the multiple table names, and filling the range of data to be queried and the table structure information into a preset query template to obtain a query instruction; inputting the query instruction into the preset large model to obtain a query statement; filling the style information and multiple sample data from the report data obtained using the query statement into a preset layout template to obtain a layout instruction; inputting the layout instruction into the preset large model to obtain the layout information of the report; filling the layout information and the description information of the report data into a preset code template to obtain a code instruction; inputting the code instruction into the preset large model to obtain template source code; and generating a report page based on the template source code of the injected report data.

[0006] According to embodiments of this disclosure, when a report prompt indicates a report adjustment mode, the target template source code, target report data, and adjustment prompt are obtained; multiple sample data from the target template source code and target report data, along with the adjustment prompt, are filled into a preset adjustment template to obtain an adjustment instruction; the adjustment instruction is input into a preset large model to obtain an adjusted template source code; and an adjusted report page is generated based on the adjusted template source code injected with the target report data.

[0007] According to embodiments of this disclosure, by reusing existing report data, there is no need to re-execute data queries when adjusting the style, ensuring that the report data remains consistent before and after the style modification, avoiding data changes caused by regenerating query statements, and skipping the query statement generation and execution stage, thereby reducing the consumption of system computing resources.

[0008] According to embodiments of this disclosure, the historical content of the session to which the report prompt belongs is obtained; if the historical content does not contain the report object containing the template source code and report data, the report prompt indicates the report generation mode; if the historical content contains the report object, the intent of the report prompt is identified; if the intent of the report prompt is identified as data change, the report prompt indicates the report generation mode.

[0009] According to embodiments of this disclosure, by distinguishing between two trigger conditions—no report object and data change—the automatic matching generation mode ensures that the generation mode is automatically used when the user makes their first request or needs to query data again, without the need for manual specification. This simplifies the operation process and avoids inaccurate report data due to incorrect mode selection.

[0010] According to embodiments of this disclosure, a preset disassembly template includes input placeholders, metadata placeholders, disassembly instructions, and format constraints. Filling the preset disassembly template with report prompts to obtain disassembly instructions includes: replacing the input placeholders with the report prompts and replacing the metadata placeholders with the acquired metadata dictionary. The metadata dictionary is used by the preset large model to identify table names related to the report from the report prompts. The disassembly instructions instruct the preset large model to disassemble the report prompts into a range of data to be queried and style information. The format constraints limit the preset large model to output the range of data to be queried, style information, and table names related to the report in a specified format.

[0011] According to embodiments of this disclosure, by inputting user input and metadata dictionary into the same template as a preset large model, the large model can understand user needs while identifying relevant tables based on the complete data dictionary, avoiding table name recognition errors due to missing metadata, and ensuring the accuracy of data sources for subsequent query statements.

[0012] According to embodiments of this disclosure, field information includes field name and field type; determining the table structure information of the report based on the field information associated with multiple table names includes: querying the field name and field type corresponding to each table name from the metadata dictionary based on multiple table names; and concatenating the queried field names and field types corresponding to each table name into the table structure information of the report according to a preset format.

[0013] According to embodiments of this disclosure, by concatenating the field names and field types corresponding to each table name obtained from the query into structured table structure information text, the preset large model can accurately identify the data table and field type to which each field belongs when generating query statements, thus avoiding query statement syntax errors caused by unclear field information.

[0014] According to embodiments of this disclosure, a preset query template includes a data range placeholder, a table structure placeholder, and query constraints. Filling the preset query template with the data range to be queried and the table structure information to obtain query instructions includes: replacing the data range placeholder with the data range to be queried, and replacing the table structure placeholder with the table structure information. The query constraints are used to instruct the preset large model to only generate data query statements, prohibit the generation of data modification statements, and generate inter-table relationships during multi-table queries.

[0015] According to embodiments of this disclosure, by restricting the generation of data modification statements in query constraints, it is ensured that the large model only generates query statements, avoiding the generation of statements with the risk of writing or deleting; by restricting multi-table associations, it is ensured that the correct inter-table associations are generated when querying multiple tables, avoiding data duplication or query errors due to the lack of association conditions.

[0016] According to embodiments of this disclosure, the preset layout template includes style placeholders, sample placeholders, layout instructions, and layout format constraints; the layout instructions are obtained by filling the preset layout template with style information and multiple sample data from report data obtained using a query statement, including:

[0017] Replace style placeholders with style information, and replace sample placeholders with multiple sample data;

[0018] Among them, the layout instruction is used to instruct the preset large model to determine the layout information of the report based on the style information and multiple sample data; the layout format constraint is used to limit the component types and component arrangement methods in the layout information output by the preset large model.

[0019] According to embodiments of this disclosure, layout decisions are driven by sample data, which makes the layout suggestions match the field types and value characteristics of the actual data, avoids incorrect chart type selection caused by semantic guessing, and ensures that the visualization of the report page is adapted to the data characteristics.

[0020] According to embodiments of this disclosure, the preset code template includes layout placeholders, data description placeholders, code generation instructions, and code format constraints. Filling the preset code template with layout information and report data description information to obtain code instructions includes: replacing the layout placeholders with layout information and replacing the data description placeholders with report data description information; wherein, the description information includes the dataset name and field names in the report; the code generation instructions are used to instruct the preset large model to generate template source code based on the layout information and description information; the code format constraints are used to limit the template source code output by the preset large model to a page structure and to use only the dataset name and field names contained in the report data description information.

[0021] According to embodiments of this disclosure, by limiting the template source code to use only the dataset name and field name contained in the description information, it is ensured that the generated template source code matches the actual usable data structure, avoiding errors in template rendering due to referencing non-existent data fields; by using server-side rendering, code generation and data acquisition are decoupled, ensuring that the generated template source code can still adapt to different data query results.

[0022] According to embodiments of this disclosure, generating a report page based on the template source code containing the injected report data includes: obtaining report data placeholders in the template source code; injecting report data into the position corresponding to the name of the report data placeholder in the template source code; and rendering the page based on the template source code containing the injected report data to generate the report page.

[0023] According to the embodiments of this disclosure, the report data is injected into the corresponding position of the template source code by the server-side template engine according to the placeholder name, and then the complete page is rendered. This allows the browser to complete the page display without performing additional data processing, reducing the front-end calculation load and reducing the risk of data being tampered with during transmission.

[0024] A second aspect of this disclosure provides a report generation apparatus, comprising: a mode routing module for filling a report prompt word into a preset disassembly template to obtain a disassembly instruction when the report generation mode is indicated by the report prompt word; inputting the disassembly instruction into a preset large model to obtain multiple table names, the range of data to be queried, and style information of the report; a table structure determination module for determining the table structure information of the report based on the field information associated with multiple table names, and filling the range of data to be queried and the table structure information into a preset query template to obtain a query instruction; a layout instruction determination module for inputting the query instruction into a preset large model to obtain a query statement; filling the style information and multiple sample data from the report data obtained using the query statement into a preset layout template to obtain a layout instruction; a template generation module for inputting the layout instruction into a preset large model to obtain the layout information of the report; filling the layout information and the description information of the report data into a preset code template to obtain a code instruction; and inputting the code instruction into a preset large model to obtain the template source code; and a report rendering module for generating a report page based on the template source code of the injected report data.

[0025] A third aspect of this disclosure provides an electronic device, including one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to perform the following operations: when a report prompt indicates a report generation mode, fill the report prompt into a preset disassembly template to obtain a disassembly instruction; input the disassembly instruction into a preset large model to obtain multiple table names, a range of data to be queried, and style information of the report; determine the table structure information of the report based on the field information associated with the multiple table names, and fill the range of data to be queried and the table structure information into a preset query template to obtain a query instruction; input the query instruction into the preset large model to obtain a query statement; fill the style information and multiple sample data from the report data obtained using the query statement into a preset layout template to obtain a layout instruction; input the layout instruction into the preset large model to obtain the layout information of the report; fill the layout information and the description information of the report data into a preset code template to obtain a code instruction; input the code instruction into the preset large model to obtain template source code; and generate a report page based on the template source code of the injected report data.

[0026] A fourth aspect of this disclosure provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to implement the methods described above.

[0027] In this embodiment, a preset decomposition template separates the user's data query requirements from the style description, avoiding interference between the two types of information and improving the accuracy of query statement generation. The preset query template's query constraints restrict the generation of only data query statements and prohibit data modification operations, ensuring database security. Sample data drives layout design, ensuring that chart type selection matches data characteristics. A preset code template generates template source code containing placeholders, and the server injects report data into the template source code to render and generate the report page. This achieves end-to-end automatic generation from user natural language input to the final report page, eliminating the need for manual query statement writing or page layout design.

[0028] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0029] The above and other objects, features and advantages of this disclosure will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0030] Figure 1 A flowchart illustrating a method for generating reports according to an embodiment of this disclosure is shown schematically;

[0031] Figure 2 A schematic block diagram illustrating the intended decoupling process according to embodiments of the present disclosure is shown.

[0032] Figure 3 This diagram schematically illustrates a complete flowchart of a report generation method according to embodiments of the present disclosure.

[0033] Figure 4 This is a structural block diagram of a report generation apparatus according to an embodiment of the present disclosure. Detailed Implementation

[0034] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely examples and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0035] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0036] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0037] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0038] Before introducing the technical solutions provided in the embodiments of this disclosure, the relevant technologies involved in this disclosure will be explained first.

[0039] As enterprises deepen their digital transformation, reporting tools have become a core component of data analysis. Taking high-performance servers as an example, existing report generation solutions may involve directly processing user natural language to generate reports based on a single model. For simplicity, this will be referred to as a single-step generation solution. Existing intelligent report generation mechanisms may generate structured query statements and chart configurations from a general large model in one go when a user enters a query command. However, this solution can only handle preset simple query scenarios and cannot adapt to complex situations where data intent and visualization needs are mixed. When users describe both data range and style preferences simultaneously, the model's attention is diverted, often resulting in neglecting one aspect for another. When users request modifications to the report style, the entire process of querying, data acquisition, and rendering must be re-executed, leading to unexpected changes to already confirmed data and consuming significant computing resources.

[0040] It is evident that the existing report generation mechanism is passive and lagging in both intent recognition and resource utilization. By the time users report style issues, the system has already completed the entire report generation process, making modifications costly and potentially impacting business decision-making efficiency or wasting resources.

[0041] In view of this, embodiments of the present disclosure provide a report generation method applied to a server system. The method includes: matching report prompt words according to preset matching rules; when the report prompt words indicate a report generation mode, filling the report prompt words into a preset disassembly template to obtain disassembly instructions; inputting the disassembly instructions into a preset large model to obtain multiple table names, the range of data to be queried, and style information of the report; determining the table structure information of the report based on the field information associated with the multiple table names, and filling the range of data to be queried and the table structure information into a preset query template to obtain query instructions; inputting the query instructions into the preset large model to obtain a query statement; filling the style information and multiple sample data from the report data obtained using the query statement into a preset layout template to obtain layout instructions; inputting the layout instructions into the preset large model to obtain the layout information of the report; filling the layout information and the description information of the report data into a preset code template to obtain code instructions; inputting the code instructions into the preset large model to obtain template source code; and generating a report page based on the template source code of the injected report data.

[0042] The embodiments disclosed herein can separate the data query requirements from the visualization style descriptions in the user input, allowing each model to focus on its respective task and improving the accuracy of the query statements. Simultaneously, by reusing existing report data to avoid full regeneration, it ensures that the data does not change unexpectedly when the style is modified, reducing resource consumption while maintaining report quality. This forward-looking decoupling strategy enables the report generation system to adjust synchronously with changes in user needs, ensuring that business analysis requirements are met while maximizing system resource utilization efficiency.

[0043] The electronic devices disclosed in this embodiment may include, but are not limited to, enterprise-level computing devices such as server systems, data center computing nodes, artificial intelligence training platforms, and high-performance computing clusters. It is particularly suitable for intelligent report servers equipped with large language model inference engines, multi-tenant analysis platforms, and enterprise-level data platforms requiring high-concurrency report generation. In specific implementation scenarios, this method can also be applied to new computing infrastructures such as embedded reporting systems and local reporting services on edge computing nodes.

[0044] The report generation method of this disclosure embodiment will be described in detail below.

[0045] Figure 1 A flowchart illustrating a method for generating reports according to an embodiment of this disclosure is shown schematically.

[0046] like Figure 1 As shown, the report generation method of this embodiment is applied to an electronic device, and the report generation method includes operations S110 to S150.

[0047] In operation S110, when the report prompt indicates the report generation mode, the report prompt is filled into the preset disassembly template to obtain the disassembly instruction; the disassembly instruction is input into the preset large model to obtain multiple table names, the range of data to be queried, and style information of the report.

[0048] In this embodiment, the report prompt is the natural language text currently entered by the user to describe the report requirements. The generation mode indicates that the system recreates a complete report based on the user's initial requirements, rather than modifying an existing report. The preset decomposition template is a prompt framework containing decomposition instructions, input placeholders, metadata placeholders, and format constraints. It instructs the preset large model to decompose the report prompt into data intent and style description, and to filter relevant table names from the metadata dictionary.

[0049] The default large model is an artificial intelligence model with natural language understanding and generation capabilities. Multiple table names are data table names identified from the metadata dictionary that are relevant to the reporting requirements. The range of data to be queried includes the time range, dimension fields, measure fields, and filter conditions, used for generating subsequent query statements. Style information includes colors, fonts, chart types, and layout preferences, used for the visual design of subsequent reports.

[0050] In operation S120, the table structure information of the report is determined based on the field information associated with multiple table names, and the range of data to be queried and the table structure information are filled into the preset query template to obtain the query instruction.

[0051] In this embodiment of the disclosure, the field information associated with the table name includes the field name and field type of each data table, which are obtained by querying the metadata dictionary. The table structure information is a structured text formed by concatenating the field names and field types corresponding to each table name according to a preset format, which is used to inform the queried data columns in each data table of the preset large model.

[0052] The default query template is a framework of prompts containing data range placeholders, table structure placeholders, and query constraints. It instructs the default large model to generate a query statement that satisfies the query constraints. The query instruction is a complete prompt formed after filling in the data range and table structure information to be queried.

[0053] In operation S130, the query instruction is input into the preset large model to obtain the query statement; the style information and multiple sample data from the report data obtained using the query statement are filled into the preset layout template to obtain the layout instruction.

[0054] In this embodiment, the query statement is a structured query language text generated by a pre-defined large model based on the query instruction, used to retrieve the data required for the report from the database. The report data is the result set returned from the database after executing the query statement. The sample data consists of the first few records extracted from the report data, used by the pre-defined large model to understand the data structure.

[0055] The preset layout template is a prompt frame containing style placeholders, sample placeholders, layout instructions, and layout format constraints. It instructs the preset large model to determine the report layout scheme based on the style information and sample data. The layout instructions are complete prompts formed after the style information and sample data are filled in.

[0056] In operation S140, the layout instructions are input into the preset large model to obtain the layout information of the report; the layout information and the description information of the report data are filled into the preset code template to obtain the code instructions; the code instructions are input into the preset large model to obtain the template source code.

[0057] In this embodiment, the layout information is structured data output by the preset large model according to the layout instructions, including the component types, component titles, and data mapping relationships of the report page. The descriptive information of the report data includes a list of field names extracted from the report data and the data type of each field, used to inform the preset large model template of the data fields that can be used.

[0058] The default code template is a framework of prompts containing layout placeholders, data description placeholders, code generation instructions, and code formatting constraints. It instructs the default large model to generate template source code based on the layout information and field descriptions. The code instructions are the complete prompts formed after filling in the layout and description information. The template source code is Hypertext Markup Language code containing template engine syntax, generated by the default large model based on the code instructions, and is used for subsequent rendering and generating of report pages.

[0059] In operation S150, a report page is generated based on the template source code of the injected report data.

[0060] In this embodiment, the template source code includes report data placeholders. These placeholders are variable names in the template engine's variable expressions, used to identify the injection location of report data within the template. The system injects report data into the corresponding location in the template source code according to the placeholder names, replacing the variable expressions in the template source code with actual data values. The template engine then renders the injected template source code, generating a complete Hypertext Markup Language page as the report page, which is then returned to the browser for display.

[0061] In this embodiment, a preset decomposition template separates the user's data query requirements from the style description, avoiding interference between the two types of information and improving the accuracy of query statement generation. The preset query template's query constraints restrict the generation of only data query statements and prohibit data modification operations, ensuring database security. Sample data drives layout design, ensuring that chart type selection matches data characteristics. A preset code template generates template source code containing placeholders, and the server injects report data into the template source code to render and generate the report page. This achieves end-to-end automatic generation from user natural language input to the final report page, eliminating the need for manual query statement writing or page layout design.

[0062] In this embodiment of the disclosure, when the report prompt indicates the report adjustment mode, the target template source code, target report data, and adjustment prompt are obtained; multiple sample data from the target template source code and target report data, along with the adjustment prompt, are filled into a preset adjustment template to obtain an adjustment instruction; the adjustment instruction is input into a preset large model to obtain the adjusted template source code; and the adjusted report page is generated based on the adjusted template source code injected with the target report data.

[0063] In this embodiment, the preset adjustment template includes adjustment instructions, template placeholders, sample placeholders, and adjustment constraints. The system replaces the template placeholders with the target template source code, replaces the sample placeholders with multiple sample data, and replaces the user requirement placeholders in the adjustment instructions with adjustment prompts. The adjustment constraints are used to limit the large model to complete the modifications related to the adjustment requirements based on the existing template, and return the complete modified template source code instead of just returning partial code snippets, while keeping the dataset placeholder names and their data binding relationships unchanged.

[0064] It should be noted that the target report can originate from at least the following two scenarios: First, the target report is generated by the aforementioned generation process, and its template source code and report data are cached in the current session during generation. Second, the target report is an existing report directly imported from an external source, containing its template source code and report data; after user upload, the system uses it as the target report for the current session. Regardless of the source of the target report, the adjustment mode uses the report's template source code and report data as the operating objects, processing them according to the same population and fine-tuning process.

[0065] For example, if a user inputs "change the title to red and increase the table font size", the system retrieves the source code of the target template, multiple sample data from the target report data, and adjustment prompts from the current report object. These prompts are then filled into the template placeholders, sample placeholders, and user requirement placeholders in the preset adjustment template, respectively, to obtain the complete fine-tuning prompts. The fine-tuning prompts are:

[0066] "You are a full-stack development expert, proficient in template engines. Task: Modify an existing report template according to the user's fine-tuning requirements, and return the complete modified template source code. Enter the target template source code in 'Existing Template Content'. 'User Fine-tuning Requirements': Change the title to red and increase the table font size. 'Available Dataset Context': Enter the dataset context. 'Fine-tuning Constraints': 1. The output must retain the complete page structure. 2. The root tag must contain the template engine namespace. 3. Modifications related to the fine-tuning requirements should be made based on the existing template, and the complete modified template source code should be returned, not just partial code snippets. 4. Data display must use template engine syntax, and only dataset names and field names provided in the available dataset context can be used. 5. Page styles should be written in style tags. 6. Dataset placeholder names and their data binding relationships should remain unchanged; unprovided datasets or fields should not be introduced. 7. Only output the complete modified template source code; do not output tags, explanatory text, modification instructions, or other non-code content."

[0067] The template fine-tuner, based on the fine-tuning prompts and using the current complete template source code as input, generates a modified complete template source code in conjunction with the user's fine-tuning instructions. This includes changing the title color from blue to red and adjusting the table font size from 12 pixels to 14 pixels, then outputting the modified complete template source code. The server executes the corresponding query according to the original dataset definition, injects the query results into the modified template, generates a new page, and returns it to the front-end for display.

[0068] In this embodiment of the disclosure, by reusing existing report data, there is no need to re-execute the data query when adjusting the style, so that the report data remains consistent before and after the style modification, avoiding data changes caused by regenerating the query statement, and skipping the query statement generation and execution stage, thereby reducing the consumption of system computing resources.

[0069] In this embodiment of the disclosure, the historical content of the session to which the report prompt word belongs is obtained; if the historical content does not contain the report object of the template source code and report data, the report prompt word is determined to indicate the report generation mode; if the historical content contains the report object, the intent of the report prompt word is identified; if the intent of the report prompt word is identified as data change, the report prompt word is determined to indicate the report generation mode.

[0070] In this embodiment, the system reads all historical message records of the current session from the session storage based on the current session identifier, and traverses backward from the most recent message according to the timestamp. During the traversal, the content of each message is parsed to check whether the message contains both template source code fields and report data fields. When a message containing both fields is found, the traversal stops, and the message is used as the report object in the historical content. If no message containing both fields is found after traversing all messages, it is determined that the historical content does not contain a report object, and the report prompt word is directly determined to indicate the report generation mode.

[0071] Once a report object is identified, the user's current input report prompt is segmented and matched for keywords to extract words indicating data manipulation intent. If the extracted words contain intents related to data manipulation such as changing the query scope, adding or removing fields, adjusting sorting, or adjusting grouping, the intent of the report prompt is determined to be data modification, thus indicating the report generation mode. If the extracted words only contain intents related to visual adjustments such as color, font, or layout, the report prompt indicates the report adjustment mode.

[0072] For example, when a user first enters "Check last month's orders," the system retrieves the session's history, which is empty. No report object containing template source code and report data is identified. Therefore, the system determines that the report prompt indicates a report generation mode and executes the generation mode process. After the generation mode is completed and the report is returned, if the user enters "Change the data from North China to East China," the system searches the historical messages for a report object containing template source code and report data. After segmenting the current input, it extracts words indicating data change actions and words indicating changes in query conditions. Recognizing the intent as data change, the system again determines that the report prompt indicates a report generation mode and re-executes the generation mode process.

[0073] In this embodiment of the disclosure, by distinguishing between two trigger conditions—no report object and data change—the automatic matching generation mode ensures that the generation mode is automatically used when the user makes their first request or needs to query data again, without the need for manual specification. This simplifies the operation process and avoids inaccurate report data due to incorrect mode selection.

[0074] In this embodiment of the disclosure, the preset disassembly template in the above-mentioned operation S110 includes input placeholders, metadata placeholders, disassembly instructions, and format constraints. Filling the preset disassembly template with report prompts to obtain disassembly instructions may further include: replacing the input placeholders with report prompts and replacing the metadata placeholders with the obtained metadata dictionary; wherein, the metadata dictionary is used for the preset large model to identify table names related to the report from the report prompts; the disassembly instructions are used to instruct the preset large model to disassemble the report prompts into the range of data to be queried and style information; and the format constraints are used to limit the preset large model to output the range of data to be queried, style information, and table names related to the report in a specified format.

[0075] In this embodiment, the metadata dictionary is read from the database system tables and contains table names, field names, field types, and field comment information for all data tables in the database. During population, the entire text string of the report prompt is written to the input placeholder location, and the entire data structure of the metadata dictionary is serialized into a text string and then written to the metadata placeholder location. After the replacement is complete, all placeholders in the template are replaced with actual data, forming a complete prompt, i.e., a disassembly instruction, containing three parts: the disassembly instruction, the user's original input, and the metadata dictionary. The disassembly instruction limits the data intent to only include time range, dimension fields, metric fields, and filter conditions; the style description to only include color, font, chart type, and layout preferences; and the format constraints require the output to conform to a specified format, with the data intent, style description, and identified relevant table names respectively filled into the corresponding key-value positions.

[0076] For example, the preset disassembly template includes disassembly instructions, input placeholders, metadata placeholders, and formatting constraints. If the user input is "Check last month's orders, summarized by region, using a red bar chart with a large title," the disassembly instructions would be:

[0077] "You are a professional data analysis intent parser. Your task is to output the following formatted results strictly according to the user's natural language.

Constraints

Full Metadata Dictionary

User Input

Output Format

[0078] Figure 2 A schematic block diagram illustrating the intended decoupling process according to embodiments of the present disclosure is shown. Figure 2 The user inputs "Check last month's orders, summarized by region, with a red bar chart and a large title," which is then sent to the Structured Query Language (SCL) analyst. Based on the decomposition instructions and format constraints in the preset decomposition template, the SCL analyst breaks down the user input into three outputs: the first output is the data intent, i.e., "Query last month's order table, fields include region and order quantity, grouped by region," used for generating subsequent query statements; the second output is the style intent, i.e., "red bar chart, large title," used for subsequent layout design; and the third output is the related tables, i.e., "order table, region table," used to determine subsequent table structure information. This process decouples data query requirements from style descriptions, avoiding interference from style-related vocabulary during subsequent query statement generation.

[0079] In this embodiment of the disclosure, by inputting user input and metadata dictionary into the same template as the preset large model, the large model can understand user needs and identify relevant tables based on the complete data dictionary, avoiding table name recognition errors due to missing metadata and ensuring the accuracy of data sources for subsequent query statements.

[0080] In this embodiment of the disclosure, the field information in the above operation S120 includes field name and field type; determining the table structure information of the report based on the field information associated with multiple table names may further include: querying the field name and field type corresponding to each table name from the metadata dictionary based on multiple table names; and concatenating the queried field names and field types corresponding to each table name into the table structure information of the report according to a preset format.

[0081] In this embodiment, the metadata dictionary uses table names as the first-level index. Each table name contains all field records for that table, and each field record includes a field name, field type, field comment, and primary key identifier. After obtaining multiple table names, the system iterates through each table name, using the table name as the query key to locate the corresponding table record in the metadata dictionary. A field list is extracted from this table record, with each entry containing a field name string and a field type string. After extraction, the field names and field types corresponding to each table name are concatenated into structured text according to a preset format. The preset format places each table name on a separate line, with all fields of the table listed below the table name, each field occupying one line. The field name and field type are separated by a delimiter, and field lists from different tables are separated by blank lines.

[0082] For example, the table names include an order table and a region table. Querying the order table from the metadata dictionary yields an order number as an integer, a region as a variable string, an amount as a decimal, and an order date as a date. Querying the region table yields a region number as an integer and a region name as a variable string. These are then concatenated according to a preset format to obtain the table structure information text: the order table contains four fields, and the region table contains two fields.

[0083] In this embodiment of the disclosure, by concatenating the field names and field types corresponding to each table name obtained from the query into a structured table structure information text, the preset large model can accurately identify the data table and field type to which each field belongs when generating query statements, thus avoiding query statement syntax errors caused by unclear field information.

[0084] In this embodiment of the disclosure, the preset query template in the above-mentioned operation S120 includes a data range placeholder, a table structure placeholder, and query constraints; filling the preset query template with the data range to be queried and the table structure information to obtain the query instruction may further include: replacing the data range placeholder with the data range to be queried, and replacing the table structure placeholder with the table structure information; wherein, the query constraints are used to instruct the preset large model to only generate data query statements, prohibit the generation of data modification statements, and generate inter-table relationships when querying multiple tables.

[0085] In this embodiment, after replacing the data range placeholder with the data range to be queried, the preset large model determines the time boundary, dimension field, metric field, and filtering conditions that should be included in the query conditions based on this range. After replacing the table structure placeholder with the table structure information, the preset large model determines the data table to which each field belongs and the field names used in the query statement based on this information. The restriction on generating data modification statements in the query constraints is implemented by semantically validating the query statement output by the preset large model. The validation process includes parsing the syntax tree of the query statement and checking whether the root node type of the syntax tree is a query type. Constraints on generating inter-table relationships during multi-table queries are implemented by checking whether the query statement contains join keywords.

[0086] For example, the data to be queried is "total order amount for each region last month". The table structure information includes a variable string field for the region field of the order table, a decimal field for the amount field, and a date field for the order date field. The query instruction is:

[0087] "You are a rigorous Structured Query Language (SCL) programming expert. Based on the provided database table structure and data intent, generate a standard SCL query statement. [Core Constraints - Safety Fence] 1. The generated SCL query statement must not contain data deletion, data update, data write, or data definition operations. 2. It must be a complete query statement. 3. If the query involves multiple tables, an inner join or left join must be used, and the relationship between the tables must be explicitly stated in the join clause. 4. Standard SCL syntax must be used. 5. Only output the query statement; do not output any explanations, comments, or tags. [Database Table Structure] Order Table: Region is a variable string type, Amount is a decimal type, and Order Date is a date type. [Data Query Intent] Query the total order amount for each region last month."

[0088] In this embodiment of the disclosure, the restriction on generating data modification statements in the query constraints ensures that the large model only generates query statements, avoiding the generation of statements with the risk of writing or deleting; the restriction on multi-table associations ensures that the correct inter-table relationships are generated when querying multiple tables, avoiding data duplication or query errors due to the lack of association conditions.

[0089] In this embodiment of the disclosure, the preset layout template in the above-mentioned operation S130 includes style placeholders, sample placeholders, layout instructions, and layout format constraints; filling the preset layout template with style information and multiple sample data from the report data obtained using the query statement to obtain layout instructions may further include: replacing the style placeholders with style information and replacing the sample placeholders with multiple sample data; wherein, the layout instructions are used to instruct the preset large model to determine the layout information of the report based on the style information and multiple sample data; the layout format constraints are used to limit the component types and component arrangement methods included in the layout information output by the preset large model.

[0090] In this embodiment, the style information is natural language text extracted from the disassembly instruction describing the visual style of the report, including user-specified colors, font sizes, chart types, and layout preference keywords. The sample data consists of the first five records extracted from the result set obtained after executing the query statement; each record contains complete field name and value pairs. Upon receiving the layout instruction containing the style information and sample data, the preset large model identifies the data type of each field in the sample data, distinguishing between numeric fields, time fields, and text fields. When the data contains a time field and the field values ​​are arranged in chronological order, the layout instruction recommends a line chart; when the data contains one text field and one numeric field and the number of values ​​in the text field is within a preset range, a bar chart is recommended; when the data contains one text field and one numeric field and the proportion of each value to the total is significant, a pie chart is recommended; and when the data contains multiple numeric fields, a data table is recommended.

[0091] For example, the style information is "red bar chart, larger title". The sample data contains three records, corresponding to the region field and the sales amount field. The region field is text type with three unique categories, and the sales amount field is numeric. The fill rules in the layout instructions are: fill in the field type and sample data with the prompt words, requiring the large model to determine whether a line chart is recommended if the sample data contains time-series fields, a bar chart if it is categorical comparison data, a pie chart if it is percentage relationship data, and a data table if it contains multiple numeric fields.

[0092] The pre-defined large model identifies the data as a category comparison type based on the layout instructions. It recommends using a bar chart to display the sales comparison of each region, while retaining a data table below to display detailed values. The output layout information is as follows: the page title is "Report Theme," the layout method is vertical arrangement, and the component list includes a chart component and a table component. The chart component is a bar chart with the title "Sales Comparison of Each Region." In the data mapping, the category field is the "Region Field," and the value field is the "Total Sales Field." The table component is a data table with the title "Sales Details Data." The column definitions include the "Region Field" and "Total Sales Field," along with their corresponding display labels.

[0093] In this embodiment of the disclosure, layout decisions are driven by sample data, so that the layout suggestions match the field types and value characteristics of the actual data, avoiding incorrect chart type selection caused by semantic guessing, and ensuring that the visualization of the report page is adapted to the data characteristics.

[0094] In this embodiment of the disclosure, the preset code template in the above-mentioned operation S140 includes a layout placeholder, a data description placeholder, a code generation instruction, and a code format constraint; filling the preset code template with layout information and report data description information to obtain code instructions may further include: replacing the layout placeholder with layout information and replacing the data description placeholder with report data description information; wherein, the description information includes the dataset name and field name in the report; the code generation instruction is used to instruct the preset large model to generate template source code based on the layout information and description information; the code format constraint is used to limit the template source code output by the preset large model to a page structure and to use only the dataset name and field name contained in the report data description information.

[0095] In this embodiment of the disclosure, the descriptive information of the report data is generated by analyzing the result set obtained after executing the query statement. The analysis process includes extracting a list of column names and the data type of each column from the result set, using the list of column names as field names, and using the data type of each column as field types.

[0096] The dataset name in the description information is assigned by the system when generating the template. Each dataset corresponds to a unique placeholder name, which serves as an identifier for data binding in the template source code. After the layout and description information are filled into the preset code template, the code generation instructions instruct the preset large model to generate source code containing the Hypertext Markup Language structure and template engine syntax.

[0097] When generating template source code, the pre-defined large model determines the position and number of charts and tables on the page based on the layout information, and determines the variable names used in the data binding statements in the template source code based on the dataset names and field names in the description information. Code format constraints require that the generated template source code be a complete page structure, including document type declarations and root tags, and that all dataset names and field names referenced in data binding statements must exist in the description information.

[0098] For example, the front-end page generator converts layout design suggestions and dataset context into a complete report page template that can be rendered by the server-side template engine, specifically including the following steps:

[0099] (1) Generate input construction

[0100] The system constructs report requirement descriptions and dataset contexts. The report requirement description is formed by sequentially piecing together the user's original report requirements, the query intent in Structured Query Language (SCL), and layout design suggestions output by the template analyst. It describes the report's presentation theme, fields, presentation method, style preferences, and layout requirements. The dataset context consists of one or more datasets; each dataset includes at least a dataset placeholder name, source SCL, a list of fields, and a data sample in a data structured markup format.

[0101] (2) Construction of preset prompt words

[0102] The system replaces the report requirement placeholder in the preset prompt with the report requirement description, and replaces the dataset context placeholder in the preset prompt with the dataset context, thus obtaining the prompt sent to the front-end page generator. The preset prompt is:

[0103] "You are a full-stack development expert, proficient in template engines and modern front-end technologies. Task: Based on the [Report Requirements Description] and [Available Dataset Context], generate a complete template engine-based Hypertext Markup Language (HTML) report template. Enter the report requirements description in the [Report Requirements Description] section. Enter the dataset context in the [Available Dataset Context] section. [Generation Constraints] 1. The output must be a complete page containing HTML structure tags. 2. The root tag must contain the template engine namespace. 3. You must use template engine attributes to access dataset variables; use text output commands to output field values; use traversal commands to traverse the dataset; and use conditional statements." 4. Only dataset names and field names provided in the available dataset context can be used in the template. 5. Page styles are written in style tags; if scripts are used, script tags use inline script directives. 6. When the user does not explicitly request a chart and the data is not suitable for chart display, only a data table is generated; when the user explicitly requests a chart or the data is suitable for chart display, the core chart is generated, and the data table can be retained simultaneously. 7. Dataset names, field names, Structured Query Language query semantics, or data binding relationships must not be changed. 8. Only the complete template source code is output; markup, explanatory text, or other non-code content is not output.

[0104] (3) Template source code generation

[0105] The front-end page generator uses the provided prompts to create a complete template engine Hypertext Markup Language template source code. This template source code includes page structure, style rules, data table and / or chart display code, and template engine data binding syntax for iterating through datasets and outputting field values.

[0106] (4) Server-side rendering and result output

[0107] The system encapsulates the template source code, dataset definition, and user requirements output by the front-end page generator into a report object. The server executes the corresponding structured query language query based on the dataset definition, injects the query results into the template engine template according to the dataset placeholder names, and outputs the rendered hypertext markup language page to the front-end browser for display.

[0108] In this embodiment of the disclosure, by limiting the template source code to use only the dataset name and field name contained in the description information, it is ensured that the generated template source code matches the actual usable data structure, avoiding errors caused by referencing non-existent data fields during template rendering; by using server-side rendering, code generation and data acquisition are decoupled, ensuring that the generated template source code can still adapt to different data query results.

[0109] In this embodiment of the disclosure, the above operation S150 may further include: obtaining report data placeholders in the template source code; injecting report data into the position corresponding to the name of the report data placeholder in the template source code; rendering the page according to the template source code containing the injected report data to generate a report page.

[0110] In this embodiment, the template source code is parsed, all element nodes in the template source code are traversed, and nodes containing template engine variable expressions are identified. The format of the variable expression is a preset prefix symbol plus a variable name plus a suffix symbol, and the variable name is extracted as the name of the report data placeholder. The report data is stored in the server memory in a key-value pair data structure, where the key is the placeholder name and the value is the corresponding query result dataset.

[0111] Based on the placeholder name, the engine searches for a key matching the placeholder name in the key-value pair set of the report data. If a match is found, the dataset corresponding to that key is injected into the template source code at the location of the placeholder. After injecting data for all placeholders, the template engine performs a rendering operation on the injected template source code. During rendering, the template engine replaces variable expressions with actual data values ​​and executes loop and conditional statements in the template syntax to generate a complete Hypertext Markup Language string. This string is returned as a response to the browser client for page display.

[0112] For example, the template source code contains a variable expression named "dataset1". The server searches for an entry with the key name "dataset1" from the key-value pair set of the report data, obtains the corresponding result set containing specific data rows, and injects the result set into the position of the "dataset1" placeholder in the template source code. After the template engine performs rendering, it traverses each row of data in the result set and generates a Hypertext Markup Language page containing a complete data table, which is then returned to the browser.

[0113] In this embodiment of the disclosure, the report data is injected into the corresponding position of the template source code by the server-side template engine according to the placeholder name and then rendered to generate a complete page. This allows the browser to complete the page display without performing additional data processing, reducing the amount of front-end calculations and reducing the risk of data being tampered with during transmission.

[0114] Figure 3 The diagram illustrates a complete flowchart of a report generation method according to an embodiment of the present disclosure.

[0115] like Figure 3As shown, upon receiving natural language input from the user, the system first performs pattern routing determination. Pattern routing determination is based on a comprehensive assessment of whether a report object exists in the current session and the characteristics of the user's instruction. If no report object exists in the current session, the system directly determines the matching generation pattern; if a report object exists in the current session, the system performs intent recognition on the user's input instruction. When the instruction involves changes in data range, addition or deletion of fields, or adjustment of sorting or grouping, the system determines the matching generation pattern; when the instruction only involves style or layout adjustments, the system determines the matching fine-tuning pattern.

[0116] Once the matching generation pattern is determined, the system enters the generation pattern process and loads the context content. In this process, the system first invokes the Structured Query Language (SCL) analyzer to decouple the user prompts from their intent based on a preset decomposition template. This template includes decomposition instructions, input placeholders, metadata placeholders, and format constraints. The system replaces the input placeholders with the user prompts and the metadata placeholders with the metadata dictionary, forming the decomposition instructions. After inputting these instructions into the preset large model, the model decomposes the user input into three parts: data intent, style description, and related table names. The data intent includes the time range, dimension fields, metric fields, and filtering conditions, used for generating subsequent query statements; the style description includes colors, fonts, chart types, and layout preferences, used for the visual design of subsequent reports; and the related table names are used to determine the subsequent table structure information. This intent decoupling process separates data query requirements from style descriptions, preventing interference from style-related terms during subsequent query generation.

[0117] Subsequently, the system retrieves the corresponding field information from the metadata dictionary based on the relevant table names. This field information includes the field name and field type. The system then concatenates the retrieved field names and types into table structure information according to a preset format. This preset format places each table name on a separate line, listing all fields of that table below the table name, with each field occupying a separate line, separated by a delimiter. The system then populates the data intent and table structure information into a preset query template to obtain the query instruction. The preset query template includes data range placeholders, table structure placeholders, and query constraints. Replacing the data range placeholders with the data intent and the table structure placeholders with the table structure information creates the complete query instruction. The query instruction is then input into a preset large model, where the structured query language generator generates a query statement based on the query constraints. The query constraints require that only data query statements be generated, prohibit the generation of data modification statements, and generate inter-table relationships when querying multiple tables.

[0118] The generated query statement is executed after passing a security fence check. The security fence check includes both regular expression matching and syntax tree parsing to ensure that the query statement does not contain high-risk operations such as data deletion, updating, writing, or data definition. After successful check, the system executes the query statement to retrieve the result data from the database and performs feature extraction and sampling on the result data to obtain data information and style intent. The data information includes a list of fields and their types in the result data, and the style intent is the style description obtained from the aforementioned decomposition.

[0119] Subsequently, the data and style intent are transmitted to the template analyst. The template analyst designs a layout scheme based on a preset layout template. The preset layout template contains style placeholders, sample placeholders, layout instructions, and layout format constraints. The system replaces the style placeholders with style information and replaces the sample placeholders with the first five records from the result data as sample data, forming a layout instruction. The layout instruction is input into a preset large model, which determines the report's layout scheme based on the layout instructions. The layout scheme includes component types and component arrangement.

[0120] The layout scheme is delivered to the front-end page generator via prompts. The front-end page generator then generates front-end page template code based on a preset code template. The preset code template contains layout placeholders, data description placeholders, code generation instructions, and code format constraints. The system replaces the layout placeholders with the layout scheme and the data description placeholders with the report data description information, forming code instructions. After the code instructions are input into a preset large model, the preset large model generates template source code based on the code generation instructions and code format constraints.

[0121] If the user instruction only involves style or layout adjustments and a valid report context exists in the session, the fine-tuning mode is matched, and the fine-tuning mode process begins. In the fine-tuning mode process, the system obtains the template source code, dataset context, and user adjustment instructions from the current report object. The system fills the template placeholder in the preset adjustment template with the current complete template source code, fills the sample placeholder with multiple sample data from the dataset context, and fills the user requirement placeholder in the adjustment instructions, obtaining complete fine-tuning prompts. The template fine-tuner generates the modified complete template source code based on the fine-tuning prompts, rather than just returning a partial code snippet, while maintaining the dataset placeholder names and their data binding relationships unchanged.

[0122] Finally, the system injects the report data into the template source code, which is then rendered by the server-side rendering engine. The server-side rendering engine injects the report data into the corresponding positions in the template source code according to the placeholder names, executes the loops and conditional logic in the template syntax, generates a complete Hypertext Markup Language page, and outputs the final report page to the browser for display.

[0123] Finally, the system injects the report data into the template source code, which is then rendered by the server-side rendering engine to output the final report page.

[0124] Figure 4 This is a structural block diagram of a report generation apparatus according to an embodiment of the present disclosure.

[0125] like Figure 4 As shown, the report generation device 400 of this embodiment includes a pattern routing module 410, a table structure determination module 420, a layout indication determination module 430, a template generation module 440, and a report rendering module 450.

[0126] The mode routing module 410 is used to fill the report prompt word into a preset disassembly template to obtain a disassembly instruction when the report prompt word indicates the report generation mode; and to input the disassembly instruction into a preset large model to obtain multiple table names, the range of data to be queried, and style information of the report. In one embodiment, the mode routing module 410 can be used to perform the operation S110 described above, which will not be repeated here.

[0127] The table structure determination module 420 is used to determine the table structure information of the report based on the field information associated with multiple table names, and to fill the range of data to be queried and the table structure information into a preset query template to obtain a query instruction. In one embodiment, the table structure determination module 420 can be used to perform the operation S120 described above, which will not be repeated here.

[0128] The layout instruction determination module 430 is used to input the query instruction into the preset large model to obtain the query statement; fill the style information and multiple sample data in the report data obtained by using the query statement into the preset layout template to obtain the layout instruction. The layout instruction determination module 430 can be used to perform the operation S130 described above, which will not be repeated here.

[0129] The template generation module 440 is used to input layout instructions into a preset large model to obtain the layout information of the report; to fill the layout information and the description information of the report data into a preset code template to obtain code instructions; and to input the code instructions into the preset large model to obtain the template source code. In one embodiment, the disk management module 440 can be used to perform the operation S140 described above, which will not be repeated here.

[0130] The report rendering module 450 is used to generate a report page based on the template source code of the injected report data. In one embodiment, the report rendering module 450 can be used to perform the operation S150 described above, which will not be repeated here.

[0131] It should be noted that the description of the features in the embodiment corresponding to the report generation device can be found in the relevant description of the embodiment corresponding to the report generation method, and will not be repeated here.

[0132] Embodiments of this disclosure also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described report generation method embodiments.

[0133] Embodiments of this disclosure also provide a computer-readable storage medium storing a computer program configured to execute the steps in any of the above-described report generation method embodiments at runtime.

[0134] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0135] Embodiments of this disclosure also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described report generation method embodiments.

[0136] Embodiments of this disclosure also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above-described report generation method embodiments.

[0137] Any of the components, modules, units, parts, methods, and operations described in this disclosure can be implemented using software, firmware, hardware (e.g., fixed logic circuitry), manual processing, or any combination thereof. Alternatively or additionally, any functionality described herein can be performed at least in part by one or more hardware logic components, such as, but not limited to, a central processing unit (CPU), a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), an application-specific standard product (ASSP), a system-on-a-chip (SoC), a complex programmable logic device (CPLD), a microprocessor (MCU), etc. The terms "system," "computing device," or "apparatus" described herein encompass various means, devices, and machines for processing data, including, for example, one or more programmable processors, computers, SoCs, or combinations thereof. The apparatus may also include code that creates an execution environment for the computer program in question, such as code constituting processor firmware, a protocol stack, a database management system, an operating system, a cross-platform runtime environment, a virtual machine, or one or more combinations thereof. The aforementioned computer program (also known as a program, software, software application, app, script, or code) can be written in any form of programming language, including compiled or interpreted languages, declarative or procedural languages, and can be deployed in any form, including as a standalone program or as a module, component, subroutine, object, or other unit suitable for a computing environment.

[0138] The units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this disclosure.

[0139] The above provides a detailed description of a report generation method and electronic device provided by this disclosure. Specific examples have been used to illustrate the principles and implementation methods of this disclosure. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this disclosure. It should be noted that those skilled in the art can make various improvements and modifications to this disclosure without departing from its principles, and these improvements and modifications also fall within the protection scope of this disclosure.

[0140] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code configured to perform the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a processor, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented using computer program modules.

[0141] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the server noise control method according to the embodiments of this disclosure.

[0142] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0143] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code configured to execute the server noise control method provided in the embodiments of this disclosure. When the computer program product is run on an electronic device, the program code is configured to enable the electronic device to implement the server noise active denoising method based on noise signal power spectrum analysis provided in the embodiments of this disclosure.

[0144] When the computer program is executed by a processor, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0145] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices or magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed as signals over a network medium, and downloaded and installed via a communication component, and / or installed from a removable medium. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0146] According to embodiments of this disclosure, program code configured to execute the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions configured to perform a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0148] Those skilled in the art will understand that the features described in the various embodiments of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments of this disclosure can be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0149] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A method for generating reports, characterized in that, The method includes: When the report prompt indicates the report generation mode, the report prompt is filled into the preset disassembly template to obtain the disassembly instruction; the disassembly instruction is input into the preset large model to obtain multiple table names, the range of data to be queried, and style information of the report; Based on the field information associated with the multiple table names, the table structure information of the report is determined, and the range of data to be queried and the table structure information are filled into the preset query template to obtain the query instruction; Input the query instruction into the preset large model to obtain the query statement; fill the preset layout template with the style information and multiple sample data from the report data obtained using the query statement to obtain the layout instruction; The layout instructions are input into the preset large model to obtain the layout information of the report; the layout information and the description information of the report data are filled into the preset code template to obtain the code instructions; the code instructions are input into the preset large model to obtain the template source code. The report page is generated based on the template source code containing the injected report data.

2. The method according to claim 1, characterized in that, The method further includes: When the report prompt indicates the report adjustment mode, obtain the target template source code, target report data, and adjustment prompt of the target report; Fill the target template source code, multiple sample data from the target report data, and the adjustment prompt words into the preset adjustment template to obtain the adjustment instructions; Input the adjustment instructions into the preset large model to obtain the adjusted template source code; Based on the modified template source code containing the injected target report data, the modified report page is generated.

3. The method according to claim 1, characterized in that, The method further includes: Retrieve the historical content of the session to which the report prompt word belongs; In the case where the historical content does not contain the template source code and report data of the report object, the report prompt word is determined to indicate the report generation mode; If the historical content contains the report object, intent recognition is performed on the report prompt words; If the intent of the report prompt is identified as a data change, the report prompt indicates the report generation mode.

4. The method according to claim 1, characterized in that, The preset disassembly template includes input placeholders, metadata placeholders, disassembly instructions, and format constraints; The step of filling the report prompt text into the preset disassembly template to obtain the disassembly instruction includes: Replace the input placeholder with the report prompt word, and replace the metadata placeholder with the obtained metadata dictionary; The metadata dictionary is used by the preset large model to identify table names related to the report from the report prompt words; the decomposition instruction is used to instruct the preset large model to decompose the report prompt words into the range of data to be queried and style information; the format constraint is used to limit the preset large model to output the range of data to be queried, style information and table names related to the report in a specified format.

5. The method according to claim 1, characterized in that, The field information includes the field name and field type; The step of determining the table structure information of the report based on the field information associated with the multiple table names includes: Based on the multiple table names, query the metadata dictionary for the field names and field types corresponding to each table name; The field names and field types corresponding to each table name retrieved are concatenated into the table structure information of the report according to a preset format.

6. The method according to claim 1, characterized in that, The preset query template includes data range placeholders, table structure placeholders, and query constraints; The step of filling the range of data to be queried and the table structure information into a preset query template to obtain a query instruction includes: Replace the data range placeholder with the data range to be queried, and replace the table structure placeholder with the table structure information; The query constraints are used to instruct the preset large model to generate only data query statements, prohibit the generation of data modification statements, and generate inter-table relationships when performing multi-table queries.

7. The method according to claim 1, characterized in that, The preset layout template includes style placeholders, sample placeholders, layout instructions, and layout format constraints; The step of filling the preset layout template with the style information and multiple sample data from the report data obtained by querying the statement to obtain the layout instructions includes: Replace the style placeholder with the style information, and replace the sample placeholder with the multiple sample data; The layout instruction is used to instruct the preset large model to determine the layout information of the report based on the style information and the multiple sample data; the layout format constraint is used to limit the component type and component arrangement in the layout information output by the preset large model.

8. The method according to claim 1, characterized in that, The preset code template includes layout placeholders, data description placeholders, code generation instructions, and code format constraints; filling the preset code template with the layout information and the description information of the report data to obtain code instructions includes: Replace the layout placeholder with the layout information, and replace the data description placeholder with the description information of the report data; The description information includes the dataset name and field name in the report; the code generation instruction is used to instruct the preset large model to generate template source code based on the layout information and the description information; the code format constraint is used to limit the template source code output by the preset large model to a page structure and to use only the dataset name and field name contained in the description information of the report data.

9. The method according to claim 1, characterized in that, The process of generating a report page based on the template source code containing the injected report data includes: Obtain the report data placeholders from the template source code; According to the name of the report data placeholder, inject the report data into the template source code at the position corresponding to the name; The page is rendered based on the template source code into which the report data is injected, and the report page is generated.

10. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the report generation method as described in any one of claims 1 to 9.