Chart generation method and device, storage medium and computer program product

By using RAG to retrieve target templates and data from the indicator library during the chart generation process, and combining it with an agent for intent parsing and data processing, the problem of intent recognition bias and multi-turn dialogue relevance in existing methods is solved, and high-precision chart generation under multi-turn interaction is achieved.

CN121902779APending Publication Date: 2026-04-21IFLYTEK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511994230.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-26
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing methods for generating charts based on user intent cannot effectively parse complex semantic instructions, lack dynamic retrieval and semantic alignment mechanisms, resulting in intent recognition bias and low accuracy of chart generation results. Furthermore, they fail to consider the contextual relevance of multi-turn dialogues, affecting interaction efficiency and accuracy.

Method used

The Retrieval Enhancement Generation (RAG) method retrieves target chart templates and indicator data from the indicator library, uses an intent parsing agent for intent recognition, and combines an SQL generation agent and a chart generation agent to gradually generate charts, forming a closed-loop decision-making chain that supports multiple rounds of interaction and data updates until a target chart that meets preset conditions is generated.

Benefits of technology

It improves the accuracy of user intent recognition and chart generation results, enhances the ability to capture users' true intentions, ensures high-precision conversion from the first question instruction to the final visualization, and improves the efficiency and accuracy of chart generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121902779A_ABST
    Figure CN121902779A_ABST
Patent Text Reader

Abstract

The invention discloses a chart generation method and device, a storage medium and a computer program product, and the method comprises the steps: firstly retrieving a target chart template and index data matched with a first problem instruction proposed by a user from an index library, and then obtaining a first intention recognition result based on the data recognition through an intention analysis Agent; and gradually generating a first chart based on the first intention recognition result by using an end-to-end chart generation process of collaborative operation of the SQL generation Agent, the chart generation Agent and the intention analysis Agent. Then, after a type corresponding to a second intention recognition result of the user is determined, accurately calling the at least one Agent again to perform corresponding data processing steps based on the type and the state of the first chart to generate a second chart, and by parity of reasoning, performing N rounds of context dynamic modification to obtain a second intention recognition result of the user; therefore, the target chart which meets the preset condition and is higher in accuracy can be finally generated, so that the recognition accuracy of the user intention and the accuracy of the corresponding chart generation result are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a chart generation method, device, storage medium, and computer program product. Background Technology

[0002] With the continuous development of artificial intelligence and information technology, the application scenarios of human-computer interaction are becoming more and more widespread. Various large language models (LLMs) are appearing in people's lives and work, providing intelligent interactive functions for many application scenarios such as data analysis, chart generation and display, to assist users in completing various behavioral intentions.

[0003] Currently, existing methods for generating charts based on user intent typically fall into three categories: The first is based on predefined template matching, generating charts (e.g., "trend" corresponds to a line chart) through keyword mapping rules. However, this method cannot parse complex semantic commands from users and cannot integrate indicator metadata and user historical preferences, resulting in low accuracy. The second method directly calls preset indicator data to generate charts, but this method also lacks dynamic retrieval and semantic alignment mechanisms, leading to low accuracy. The third method uses isolated intent recognition models (such as traditional NLP classifiers) to identify the intent of a single-turn command from the user before generating the chart. However, this method only processes single-turn commands, treating each user input as an independent request and ignoring the contextual relevance of multi-turn dialogues, which not only causes bias in intent recognition but also affects the accuracy of the final chart generation. It is clear that these three existing methods for generating charts based on user intent all have significant problems and struggle to achieve ideal chart generation results. Summary of the Invention

[0004] The main objective of this application is to provide a chart generation method, device, storage medium, and computer program product that can improve the accuracy of recognizing user intent and further improve the accuracy of the corresponding chart generation results, thereby achieving the desired chart generation effect.

[0005] This application provides a chart generation method, including:

[0006] Obtain the first question instruction from the user; and retrieve the target chart template and indicator data that match the first question instruction from the pre-constructed indicator library through Retrieval-Augmented Generation (RAG) method.

[0007] The intent parsing agent performs intent recognition processing based on the first question instruction, target chart template, and indicator data to obtain the user's first intent recognition result.

[0008] An intelligent agent is generated using SQL. Based on the first intent recognition result, a data query SQL statement is generated; and the data query SQL statement is executed to perform a data query and obtain the SQL query result.

[0009] The intelligent agent generates a chart by converting the SQL query results into chart configuration parameters that conform to a preset format specification; and uses the chart configuration parameters to generate a first chart.

[0010] Based on the user's second question instruction for the first chart, the intent parsing agent determines the type corresponding to the user's second intent recognition result; and based on the type, at least one of the intent parsing agent, SQL generation agent, and chart generation agent is invoked again to perform corresponding data processing steps to generate a second chart, and so on, until the generated Nth chart meets the preset conditions, then the Nth chart is taken as the final target chart; where N is a positive integer greater than 0.

[0011] In one possible implementation, the indicator library is constructed as follows:

[0012] Obtain basic document data; the basic document data includes indicator metadata documents, predefined chart template documents, and business terminology document data;

[0013] The basic document data is semantically segmented to obtain M semantic text blocks; where M is a positive integer greater than 0.

[0014] Generate semantic vectors corresponding to each of the M semantic text blocks; and store the M semantic text blocks and their corresponding semantic vectors into a vector database as an index library.

[0015] In one possible implementation, the step of retrieving target chart templates and indicator data matching the first question instruction from a pre-selected indicator library through enhanced retrieval includes:

[0016] Generate a query vector corresponding to the first question instruction; and retrieve K text block semantic vectors similar to the query vector and their corresponding chart templates and indicator data from a pre-constructed indicator library, as target chart templates and indicator data matching the first question instruction; where K is a positive integer greater than 0.

[0017] In one possible implementation, the step of using an intent-parsing agent to perform intent recognition processing based on the first question instruction, the target chart template, and indicator data to obtain the user's first intent recognition result includes:

[0018] The intent parsing agent concatenates the first question instruction, the target chart template, and the indicator data to obtain a concatenation result; and uses the concatenation result to generate a first prompt instruction, which is then input into a large language model for intent recognition processing to obtain the user's first intent recognition result.

[0019] In one possible implementation, the step of generating an intelligent agent via SQL, based on the first intent recognition result, to generate a data query SQL statement includes:

[0020] The system generates an intelligent agent using SQL, retrieves data table information from the database, and uses the data table information and the first intent recognition result to generate a second prompt instruction, which is then input into the large language model to obtain the data query SQL statement output by the model.

[0021] In one possible implementation, the step of generating an intelligent agent through a chart to convert the SQL query results into chart configuration parameters conforming to a preset format specification includes:

[0022] The system generates an intelligent agent based on the chart, determines the target chart type, and uses the target chart type and SQL query results to generate a third prompt instruction, which is then input into the large language model to obtain chart configuration parameters that conform to the preset format specifications.

[0023] In one possible implementation, the type corresponding to the user's second intent recognition result includes at least one of modifying chart configuration parameters, adding data query conditions, and changing intent; the step of calling at least one of the intent parsing agent, SQL generation agent, and chart generation agent again to perform corresponding data processing steps to generate the second chart, based on the type, includes:

[0024] When the user's second intent recognition result corresponds to the type of modifying chart configuration parameters, the chart generation agent is called again, and the first chart is modified using the modified chart configuration parameters to obtain the second chart;

[0025] Alternatively, when the type corresponding to the user's second intent recognition result is a new data query condition, the SQL generation agent is called again to generate a modified data query SQL statement. After executing the modified data query SQL statement to obtain the updated SQL query result, the chart generation agent is called again to generate updated chart configuration parameters, so as to generate a second chart using the updated chart configuration parameters.

[0026] Alternatively, when the user's second intent recognition result corresponds to the type of change intent, the intent parsing agent, SQL generation agent, and chart generation agent are invoked again to perform their respective data processing steps in order to generate the second chart.

[0027] In one possible implementation, after generating the SQL query result into chart configuration parameters conforming to a preset format specification using a chart-generated agent, the method further includes:

[0028] The intelligent agent analyzes the configuration parameters of the chart using a chart interpretation system, and generates chart annotations based on the analysis results.

[0029] This application also provides a chart generation device, including: a processor, a memory, and a system bus;

[0030] The processor and the memory are connected via the system bus;

[0031] The memory is used to store one or more programs, the one or more programs including instructions, which, when executed by the processor, cause the processor to perform any of the above-described methods for generating graphs.

[0032] This application also provides a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform any of the above-described chart generation methods.

[0033] This application also provides a computer program product, which, when run on a terminal device, causes the terminal device to execute any of the above-described chart generation methods.

[0034] This application provides a chart generation method, device, and computer program product. First, it obtains a first question instruction from a user. Then, through enhanced retrieval generation, it retrieves a target chart template and indicator data matching the first question instruction from a pre-constructed indicator library. Next, an intent-resolving agent performs intent recognition processing based on the first question instruction, the target chart template, and the indicator data to obtain the user's first intent recognition result. Then, an SQL generation agent generates a data query SQL statement based on the first intent recognition result and executes the SQL query to obtain the SQL query result. Next, a chart generation agent converts the SQL query result into chart configuration parameters conforming to a preset format specification. Using these chart configuration parameters, a first chart is generated. Furthermore, based on a second question instruction from the user regarding the first chart, the intent-resolving agent determines the type corresponding to the user's second intent recognition result. Based on this type, at least one of the intent-resolving agent, SQL generation agent, and chart generation agent is invoked again to perform corresponding data processing steps to generate a second chart. This process continues until the generated Nth chart meets preset conditions, at which point the Nth chart is taken as the final target chart.

[0035] As can be seen, when generating charts, this application first retrieves target chart templates and indicator data that match the user's first question instruction (such as having high semantic similarity) from the indicator library, and then uses the intent parsing agent to perform intent recognition based on the retrieved data to obtain the first intent recognition result, thereby enhancing the ability to capture the user's true intent and improving the accuracy of the intent recognition result.

[0036] Building upon this foundation, this application further utilizes an end-to-end chart generation process that integrates SQL generation agents, chart generation agents, and intent parsing agents. Based on the first intent recognition result, the first chart is generated step by step, thereby decomposing the chart generation task into multiple specialized stages executed sequentially. Each agent focuses on a specific subtask and can transmit intermediate results through structured messages (such as JSON format), forming a closed-loop decision-making chain to ensure high-precision conversion from the first question instruction to the final visualized first chart.

[0037] Next, after determining the type of the user's second intent recognition result based on the second question instruction posed by the user to the first chart, this application further, based on this type and the current chart's (initially the first chart) state, precisely invokes at least one of the following agents: the intent parsing agent, the SQL generation agent, and the chart generation agent. This executes specific steps in the corresponding workflow to incrementally update or reconstruct the data, thereby generating a corrected chart (such as the second chart). This process is repeated N times (e.g., 5 times) of dynamic context modification to ultimately generate a target chart that meets preset conditions and has higher accuracy. Therefore, compared to existing methods for chart generation based on user intent, this approach effectively improves the accuracy of user intent recognition and further enhances the accuracy of the corresponding chart generation results, ultimately achieving the desired chart generation effect. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 A flowchart illustrating a chart generation method provided in an embodiment of this application;

[0040] Figure 2 This is a schematic diagram illustrating the overall implementation process of chart generation provided in the embodiments of this application;

[0041] Figure 3 Example diagram of the first diagram provided for embodiments of this application;

[0042] Figure 4 Example diagram of the second diagram provided in the embodiments of this application;

[0043] Figure 5 This is a schematic diagram of the structure of a chart generation device provided in an embodiment of this application. Detailed Implementation

[0044] Currently, enterprise data analysis relies on manually constructing charts. However, traditional chart recommendation systems are limited by fixed template matching mechanisms, making it difficult to interpret fuzzy query intents in users' natural language. Furthermore, they lack the ability to dynamically adapt to multi-turn interaction contexts and user behavioral preferences. This often leads to chart outputs that are disconnected from user needs due to intent recognition biases when processing complex semantic commands, thus reducing the accuracy of the generated charts.

[0045] Specifically, existing methods for generating charts based on user intent typically include the following three types:

[0046] (1) A method that generates charts (such as line charts corresponding to "trend") based on predefined template matching and keyword mapping rules. However, this method cannot parse complex semantic instructions proposed by users and cannot integrate indicator metadata and user historical preferences, resulting in low accuracy of the generated results.

[0047] (2) The method of directly calling preset indicator data to generate charts. However, due to the lack of dynamic retrieval and semantic alignment mechanisms, the accuracy of the generated results is also low.

[0048] (3) A method of generating a chart after identifying the intent of a single-turn instruction by an isolated intent recognition model (such as a traditional NLP classifier). However, since this method only processes single-turn instructions, treating each user input as an independent request and ignoring the contextual relevance of the user's multi-turn dialogue, it will not only cause deviations in intent recognition but also affect the accuracy of the final chart generation result.

[0049] As can be seen, the three existing methods for generating charts based on user intent have at least three major drawbacks:

[0050] (1) Insufficient intent recognition accuracy. This is because traditional chart generation methods mainly rely on keyword matching and rule templates, which cannot effectively parse the fuzzy expressions and compound instructions that are common in natural language. In addition, the semantic differences between domain professional terms and everyday expressions (such as users saying "revenue" while the database field is "revenue") will also lead to a high field mapping error rate.

[0051] (2) The chart generation deviates significantly from user needs. This is because the existing chart generation methods do not conform to the data analysis logic in terms of chart type selection. For example, time series data is incorrectly presented as a pie chart, or scatter plots are used for too many categorical variables, resulting in the visualization results failing to effectively convey data insights. Secondly, errors in the data preprocessing stage, such as failure to correctly execute user-specified filtering conditions (e.g., "only online channels are counted") or aggregation methods (e.g., "by weekly granularity"), result in the final chart being generated based on an incorrect dataset.

[0052] (3) The lack of consideration for the contextual relevance of multiple rounds of dialogue with the user affects the accuracy of the final chart generation result. This is because most existing chart generation methods adopt an isolated intent recognition mode, treating each user input as an independent request, and lack an effective dialogue state tracking and inheritance mechanism. When the user tries to add conditional instructions (such as first requesting "show sales" and then adding "by weekly granularity") or make referential expressions (such as "show it with a line chart"), the existing chart generation methods cannot associate with the historical context. They either require the user to repeat information, which reduces the user experience, or perform operations based on incomplete context, which reduces the accuracy of chart generation. In addition, once the user's intent changes (such as switching from "trend analysis" to "distribution analysis"), the existing chart generation methods often need to restart the entire dialogue process, resulting in a significant decrease in interaction efficiency.

[0053] To address the aforementioned shortcomings, this application provides a chart generation method. First, it obtains a first question instruction from the user. Then, using a RAG (Reference Aspect Group) method, it retrieves a target chart template and indicator data matching the first question instruction from a pre-constructed indicator library. Next, an intent parsing agent performs intent recognition processing based on the first question instruction, the target chart template, and the indicator data to obtain the user's first intent recognition result. Then, an SQL generation agent generates a data query SQL statement based on the first intent recognition result and executes the SQL query to obtain the SQL query result. Next, a chart generation agent converts the SQL query result into chart configuration parameters conforming to a preset format specification. Using these chart configuration parameters, a first chart is generated. Furthermore, based on a second question instruction from the user regarding the first chart, the intent parsing agent determines the type corresponding to the user's second intent recognition result. Based on this type, at least one of the intent parsing agent, SQL generation agent, and chart generation agent is invoked again to perform corresponding data processing steps to generate a second chart. This process continues until the generated Nth chart meets preset conditions, at which point the Nth chart is taken as the final target chart.

[0054] As can be seen, when generating charts, this application first retrieves target chart templates and indicator data from the indicator library that match the user's first question instruction (such as the highest semantic similarity), and then uses the intent parsing agent to perform intent recognition based on the retrieved data to obtain the first intent recognition result, thereby enhancing the ability to capture the user's true intent and improving the accuracy of intent recognition results.

[0055] Building upon this foundation, this application further utilizes an end-to-end chart generation process that coordinates the SQL generation agent, the chart generation agent, and the intent parsing agent. Based on the first intent recognition result, the first chart is generated step by step, thereby decomposing the chart generation task into multiple specialized stages executed sequentially. Each agent focuses on a specific subtask and can transmit intermediate results through structured messages (such as JSON format), forming a closed-loop decision-making chain to ensure high-precision conversion from the first question instruction to the final visualized first chart.

[0056] Next, after determining the type of the user's second intent recognition result based on the second question instruction posed by the user to the first chart, this application further, based on this type and the current chart's (initially the first chart) state, precisely invokes at least one of the following agents: the intent parsing agent, the SQL generation agent, and the chart generation agent. This executes specific steps in the corresponding workflow to incrementally update or reconstruct the data, thereby generating a corrected chart (such as the second chart). This process is repeated N times (e.g., 5 times) of dynamic context modification to ultimately generate a target chart with higher accuracy that meets preset conditions. Therefore, compared to existing methods for chart generation based on user intent, this approach effectively improves the accuracy of user intent recognition and further enhances the accuracy of the corresponding chart generation results, ultimately achieving the desired chart generation effect.

[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0058] See Figure 1 This is a flowchart illustrating a chart generation method provided in this embodiment. The method includes the following steps:

[0059] S101: Obtain the first question instruction from the user; and retrieve the target chart template and indicator data that match the first question instruction from the pre-constructed indicator library through enhanced retrieval.

[0060] It should be noted that, in order to improve the accuracy of user intent recognition and further improve the accuracy of the corresponding chart generation results, thereby achieving the ideal chart generation effect, this application pre-constructs an indicator library containing various basic chart template descriptions and indicator data information (such as indicator names, definitions, etc.) by integrating natural language, user historical behavior preferences, and various indicator metadata, as the core knowledge source.

[0061] Based on this, such as Figure 2 As shown, after obtaining the user's question instruction (e.g., the user asks it via text or voice, which is defined here as the first question instruction), the first question instruction is efficiently and accurately semantically matched with the chart template descriptions and indicator information in the pre-constructed indicator library through Retrieval Enhanced Generation (RAG) to retrieve the target chart template and indicator data that match the first question instruction (e.g., the one with the highest semantic similarity). This ensures that the retrieved results can accurately support the workflow of each agent in subsequent steps. For example, when executing the subsequent step S102, the ability of the agent to capture the user's true intent through intent parsing can be enhanced, thereby improving the accuracy of the intent recognition results (e.g., the first intent recognition result).

[0062] It should be noted that this embodiment does not limit the language type of the first question instruction (and the second question instruction mentioned later). For example, the first question instruction (and the second question instruction mentioned later) can be a Chinese instruction or an English instruction. This embodiment also does not limit the length of the first question instruction (and the second question instruction mentioned later), that is, the first question instruction (and the second question instruction mentioned later) can be a sentence instruction text (i.e., a collection of words) or a passage instruction text (i.e., a collection of sentences).

[0063] For example, the first question command could be something like, "Compare the online sales growth rate in East China for the first three quarters of 2024 and display it by quarter."

[0064] It should also be noted that this embodiment does not limit the construction method of the indicator library or the specific data content it contains. It is understood that, as the core knowledge source for chart generation, the indicator library can include not only basic chart template descriptions and indicator data definition text, but also structured information such as indicator name, indicator explanation, standard value, historical value, data source, calculation formula, related dimensions (such as time, region), and applicable chart types. Furthermore, to improve the construction effect of the indicator library, the construction process can follow a "framework building - indicator collection - refinement and improvement" process. That is, firstly, a categorized and industry-specific indicator framework can be built through a comprehensive survey of various business scenarios (such as finance, sales, etc.); then, the original indicator data and chart templates for each scenario are collected; next, all the obtained data is refined, and the aforementioned complete attribute information is defined for each indicator; finally, the scientific validity and operability of the indicator library can be further ensured through expert review and dynamic update mechanisms (such as adding new indicators and cleaning up inapplicable indicators).

[0065] Specifically, one possible implementation is that the construction process of the indicator library may include: First, acquiring basic document data; wherein, the basic document data includes indicator metadata documents, predefined chart template documents, and business terminology documents. Then, semantic segmentation processing is performed on the basic document data to obtain M (the specific value is not limited and can be any positive integer greater than 0) semantic text blocks.

[0066] The reason for semantic segmentation of the basic document data is that this indicator information (such as indicator names and definitions) and chart template descriptions are usually short texts. Semantic segmentation ensures that each text block contains a complete semantic unit (e.g., the complete definition of an indicator or a complete description of a chart template). This avoids the semantic fragmentation that can occur with fixed-length segments, thereby improving the accuracy of subsequent knowledge retrieval.

[0067] Next, existing or future text vectorization methods can be used to generate semantic vectors corresponding to M semantic text blocks. For example, a domain-fine-tuned embedding model (such as the BGE-M3 model) can be used to convert each text block into a high-dimensional semantic vector (which can be represented as V_doc, and the specific dimension is not limited, such as a 768-dimensional vector). These vectors capture the deep semantic information of the corresponding text blocks. Then, these M semantic text blocks and their corresponding semantic vectors can be stored in a vector database as an indicator library. Each vector can correspond to a chart template or indicator information (such as indicator definition) text block with complete semantics. Furthermore, an efficient index structure can be established to prepare for similarity search.

[0068] For example, we can first obtain a company's metric metadata document (containing definitions of fields such as "sales_growth_rate" and "online_sales") and a predefined chart template library (such as comparison bar charts and trend line chart templates). Then, we perform semantic segmentation on these data documents to obtain complete semantic text blocks. For instance, "Quarterly sales growth calculation rule: (Current period sales - Previous period sales) / Previous period sales * 100%" is identified as a complete semantic block and does not require further segmentation. Next, we can use models such as BGE-M3 to convert each text block into vectors and store all similar text block vectors in a vector database. This allows us to construct a vector database containing all the company's metric data, chart templates, and their semantic vectors (a vector index can also be optionally created; the specific creation method is not limited).

[0069] Based on this, an optional implementation is to, after obtaining the user's first question instruction, further selectively clean it (such as removing stop words and other preprocessing operations), and then use the same text vectorization method (such as the BGE-MB model) used when building the indicator library to generate the (cleaned) query vector corresponding to the first question instruction text (which can be represented as V_query, and the specific dimension is not limited, such as a 768-dimensional vector, etc.). Then, a similarity search can be performed in the pre-built indicator library (such as the vector database mentioned above) (such as using a similarity retrieval method based on cosine similarity calculation) to retrieve the K (the specific value is not limited, and can be any positive integer greater than 0) text block semantic vectors most similar to the query vector and their corresponding chart templates and indicator data, which are used as target chart templates and indicator data to match the first question instruction.

[0070] For example, taking the first question instruction as "Compare the online sales growth rate of East China in the first three quarters of 2024, and display by quarter." as an example, we can first use the same text vectorization method, such as the BGE-MB model used when building the indicator library, to generate the query vector V_query corresponding to the first question instruction. Then, we calculate the cosine similarity between this query vector V_query and all vectors V_doc in the indicator library, and select the top 3 text block semantic vectors with the highest similarity, along with their corresponding chart templates and indicator data, as the target chart templates and indicator data to match the first question instruction "Compare the online sales growth rate of East China in the first three quarters of 2024, and display by quarter." The specific content of the target chart templates and indicator data, as well as the similarity scores, can be shown in the following example:

[0071] 1. Result 1 (similarity 0.92): "Quarterly online sales growth calculation rule: (Current period sales - Previous period sales) / Previous period sales * 100%".

[0072] 2. Result 2 (similarity 0.87): "Multi-series bar chart template, suitable for comparing sales figures across multiple quarters and regions."

[0073] 3. Result 3 (similarity 0.85): "Sales data filtering criteria for East China: region='east_china'".

[0074] Furthermore, to improve the accuracy of user intent recognition results in subsequent steps and avoid overly fragmented information retrieved from the indicator library, one possible approach is to further retrieve the text blocks corresponding to the K text block semantic vectors most similar to the first question instruction from the indicator library, and then retrieve the text blocks adjacent to each of these text blocks, using them as context in the search results. This provides richer background information for the collaborative workflow of each agent in subsequent steps. Moreover, to ensure that each agent can directly transmit intermediate results via structured messages (such as JSON format) to improve the final generation effect, all retrieved text blocks (and their contexts) can be converted into a standardized information format (such as JSON format). The content may include, but is not limited to, the original text, the corresponding indicator or chart template ID, data source table / field information, and similarity scores. This generates a structured search result document containing chart template suggestions highly relevant to the user intent and precise indicator definitions, which is then used to execute subsequent step S102 for user intent recognition processing by the intent parsing agent.

[0075] For example: Based on the above example, after retrieving three search results matching the first question command "Compare the online sales growth rate of East China in the first three quarters of 2024 and display by quarter.", it can be seen that "Result 1" is a calculation rule. To provide more context, another adjacent text block describing "data source is the sales_regional_quarterly table" can be retrieved and appended to Result 1. Finally, all search results are assembled into a standardized JSON document, as shown in the following example:

[0076] {

[0077] "query": "Compare the online sales growth rate in East China for the first three quarters of 2024, and display by quarter",

[0078] "retrieved_context": [

[0079] {

[0080] "content": "Online sales quarter-on-quarter calculation rule: (Current period sales - Previous period sales) / Previous period sales * 100%. Data source: sales_regional_quarterly table."

[0081] "metadata": {

[0082] "type": "metric_definition",

[0083] "id": "KPI_003",

[0084] "source_table": "sales_regional_quarterly",

[0085] "relevant_fields": ["online_sales", "quarter", "region"]

[0086] },

[0087] "score": 0.92

[0088] },

[0089] {

[0090] "content": "Multi-series bar chart templates, suitable for comparing sales figures across multiple quarters and regions."

[0091] "metadata": {

[0092] "type": "chart_template",

[0093] "id": "CHART_012",

[0094] "chart_type": "Comparison Bar Chart"

[0095] },

[0096] "score": 0.87

[0097] },

[0098] {

[0099] "content": "Sales data filtering criteria for East China region: region='east_china',

[0100] "metadata": {

[0101] "type": "filter_condition",

[0102] "dimension": "region",

[0103] value: "east_china

[0104] },

[0105] "score": 0.85

[0106] } ]

[0108] }".

[0109] S102: The intent parsing agent performs intent recognition processing based on the first question instruction, target chart template and indicator data to obtain the user's first intent recognition result.

[0110] In this embodiment, after retrieving the target chart template and indicator data matching the first question instruction in step S101, the intent parsing agent can further perform intent recognition processing based on the retrieval results of the first question instruction, the target chart template, and the indicator data to obtain the user's intent recognition result (here defined as the first intent recognition result, which may include, but is not limited to, core intent, entities, and a list of constraints). Figure 2 As shown, this is used to execute the subsequent step S103.

[0111] Specifically, after obtaining the retrieval results such as the target chart template and indicator data that match the first question instruction, the intent parsing agent can further concatenate the first question instruction, the target chart template, and the indicator data to obtain a concatenated result. This concatenated result is then integrated into a prompt template to generate the first prompt instruction. This first prompt instruction is then input into a Large Language Model (LLM) for intent recognition processing. For example, a Chain of Thought (CoT) approach can be used to perform step-by-step reasoning until the model outputs the first intent recognition result for the user. The content format of the first intent recognition result is not limited. For example, to improve data usability, the LLM can be limited to output the first intent recognition result as a structured JSON object in a predetermined format, which may include, but is not limited to, fields such as intent, entity list, and constraint list.

[0112] For example: Based on the above example, after retrieving the target chart template and indicator data that match the first question instruction "Compare the online sales growth rate of East China in the first three quarters of 2024 and display it by quarter.", the first prompt instruction generated by the concatenation of the first question instruction and the search results is further input into the Large Language Model (LLM). The LLM can analyze the first prompt instruction and obtain the first intent recognition result, which includes the core intent "comparison", the entities "East China region" and "online sales growth rate", and the time constraint "2024Q1-Q3". The corresponding model output content can be shown in the following example:

[0113] {

[0114] "intent": "comparison",

[0115] "entities": ["east_china_region", "online_sales_growth_rate"],

[0116] "constraints": ["time_range": "2024Q1-Q3"]

[0117] }".

[0118] S103: Generate an intelligent agent through SQL, generate a data query SQL statement based on the first intent recognition result, and execute the data query SQL statement to perform data query and obtain the SQL query result.

[0119] In this embodiment, after obtaining the user's first intent recognition result (including core intent, entity, condition constraints, etc.) through step S102, an intelligent agent can be further generated through SQL. First, based on the first intent recognition result and existing database metadata (such as database schema (specifically table names, field names, etc.), a more accurate and executable data query SQL statement is generated. Then, by executing this data query SQL statement, a data query is performed to obtain the SQL query result, such as... Figure 2 As shown, this is used to execute the subsequent step S104.

[0120] Specifically, after obtaining the user's first intent recognition result (including core intent, entity, condition constraints, etc.), the system can further generate an intelligent agent through SQL to obtain data table information in the database (such as field names, data types, primary and foreign key relationships, etc.). This information and the first intent recognition result are then integrated into a prompt template to generate a second prompt instruction. This second prompt instruction is then input into a Large Language Model (LLM) for SQL generation, resulting in a data query SQL statement output by the model. The model performs preliminary syntax checks and logical rationality verifications (such as checking the existence of core tables and fields) to obtain a standardized SQL query statement, which is used to obtain more accurate SQL query results.

[0121] It should be noted that, in order to improve the accuracy of LLM output data, this application designed a prompt template containing the following key parts when generating the second prompt instruction:

[0122] 1. System role definition: Clearly define the Agent as "SQL Expert".

[0123] 2. Database Schema Description: Describe the relevant table structure in detail.

[0124] 3. User Intent Translation: Transform the parsed intent, entities, and constraints into specific query logic (e.g., "Comparison" requires SELECT multiple dimensions, and "Growth Rate" requires applying a calculation formula).

[0125] 4. Few Sample Examples: Provides positive and negative examples to guide the model in generating SQL that conforms to the specifications.

[0126] 5. Output format constraints: Only SQL statements should be output, without any explanation.

[0127] For example: Based on the above example, after obtaining the first intent recognition result, which includes the core intent being "comparison," the entity being "east_china_region" and "online_sales_growth_rate," and the time constraint being "2024Q1-Q3," the second prompt instruction generated from this first intent recognition result and the database schema (table sales_regional_quarterly and its fields) is further input into the Large Language Model (LLM). The LLM can then generate SQL containing the growth rate calculation logic based on the intent (comparison, growth rate) and constraints (region, time) contained in the first intent recognition result, combined with the calculation rules obtained through RAG retrieval. The corresponding LLM output can be shown in the following example:

[0128] "SELECT quarter, (SUM(current_sales) - SUM(previous_sales)) / SUM(previous_sales) AS growth_rate

[0129] FROM sales_regional_quarterly

[0130] WHERE region = 'east_china' AND channel = 'online' AND quarterBETWEEN '2024Q1' AND '2024Q3'

[0131] GROUP BY quarter

[0132] ORDER BY quarter;

[0133] S104: Generate an intelligent agent through a chart, convert the SQL query results into chart configuration parameters that conform to a preset format specification, and generate the first chart using the chart configuration parameters.

[0134] In this embodiment, after obtaining the SQL query result in step S103, a chart-generating agent can be further used to convert the SQL query result into chart configuration parameters that conform to a preset format specification (the specific content is not limited and can be set according to actual conditions and experience, such as conforming to ECharts specifications). Then, using these chart configuration parameters, a chart (here defined as the first image) is generated, such as... Figure 2 As shown, this is used to execute the subsequent step S105.

[0135] Specifically, after obtaining the SQL query results (such as a structured dataset (in JSON array form)), the system can first generate an agent using charts. Then, by combining this agent with a target chart template retrieved from the indicator library using RAG enhancement that matches the first question instruction, the optimal chart type is determined and designated as the target chart type. This target chart type and the SQL query results are then integrated into a prompt template to generate a third prompt instruction. This third prompt instruction is then input into a Large Language Model (LLM) to generate chart configuration parameters (such as ECharts parameter configuration) conforming to a preset format. The result is a chart configuration parameter output by the model that conforms to a preset format, such as a complete ECharts configuration (JSON object).

[0136] It should be noted that when using LLM to generate chart configuration parameters that conform to preset format specifications (such as ECharts parameter configuration), the following detailed configuration items can be included:

[0137] 1. X-axis (xAxis): Mapped to a categorical or time-series field (such as quarter) in the data. Set type to 'category'.

[0138] 2. Y-axis (yAxis): Mapped to numeric fields in the data (such as growth_rate). The type is set to 'value', and the axisLabel can be configured to set a percentage format (formatter: '{value}%').

[0139] 3. Data Series: Defines the core data of the chart. Taking a line chart as an example, the type is 'line', the data field is bound to a numerical array (such as the specific value of growth_rate), and you can set itemStyle (data point style), lineStyle (line style), etc.

[0140] 4. Configure the title, tooltip, and legend as the chart title, hover tooltip, and legend respectively to improve readability.

[0141] For example: Based on the above example, suppose the obtained SQL query result is "[("2024Q1", 15.2), ("2024Q2", 23.0), ("2024Q3", 18.7)]". Then, after inputting the third-party prompt generated from this SQL query result and the target chart type into the Large Language Model (LLM), the LLM can recognize the data type (time series + percentage), select a line chart, map the quarter to xAxis.data, the growth rate to series.data, and configure the Y-axis percentage display, etc. Correspondingly, the LLM output can be shown in the following example:

[0142] {

[0143] "title": {"text": "Online sales growth rate in East China in the first three quarters of 2024", "left":"center"},

[0144] "tooltip": {"trigger": "axis", "formatter": "{b}growth rate: {c}%"},

[0145] "xAxis": {"type": "category", "data": ["2024Q1", "2024Q2", "2024Q3"]},

[0146] "yAxis": {"type": "value", "axisLabel": {"formatter": "{value}%"}},

[0147] "series": [{

[0148] "name": "Sales growth rate",

[0149] "type": "line",

[0150] "data": [15.2, 23.0, 18.7],

[0151] "itemStyle": {"color": "#5470c6"}

[0152] }]

[0153] }".

[0154] Based on this, the first chart can be generated and displayed to the user using the chart configuration parameters determined by the LLM. Furthermore, to further improve the user experience, an optional implementation method is to have a chart interpretation agent analyze the chart configuration parameters to locate key information, and based on the analysis results (such as the located key information), generate natural language descriptions of the chart annotations and embed them into the charts (such as the first chart and the second chart mentioned later) to assist the user in understanding.

[0155] Specifically, in this implementation, after obtaining the chart configuration parameters (such as the complete ECharts configuration (JSON object)), the chart interpretation agent can further integrate the chart configuration parameters and the original dataset into a prompt template to generate a fourth prompt. This fourth prompt is then input into a Large Language Model (LLM) to analyze data trends, extreme values, outliers, etc. Based on the extracted key insights, concise and accurate descriptive text is generated as chart annotations.

[0156] For example: Based on the above example, after obtaining the complete ECharts chart configuration (JSON object), the chart interpretation agent can further input the fourth prompt command generated from the ECharts chart configuration and the original dataset into the Large Language Model (LLM). The LLM can then identify the Q2 growth rate (23.0%) as the peak and generate a comparative description as a chart annotation. The corresponding LLM output can be shown in the following example:

[0157] "Online sales in East China saw significant growth in the second quarter of 2024, with a growth rate of 23.0%, which was 7.8 and 4.3 percentage points higher than the first quarter (15.2%) and the third quarter (18.7%), respectively."

[0158] To illustrate further: Suppose the user's first question is "Compare the number of on-duty operators for international payment and receipt business in January 2025 and February 2025", then the first chart generated through the above steps can be as shown in Figure 3, and the chart annotation embedded in the chart is "The number of on-duty operators for international payment and receipt business in February 2025 was 4.6, which is a decrease of 0.6 people from 5.2 in January, indicating that the manpower allocation for this business was tightened in that month".

[0159] S105: Based on the user's second question instruction for the first chart, the intent parsing agent is used to determine the type corresponding to the user's second intent recognition result; and based on the type, at least one of the intent parsing agent, SQL generation agent, and chart generation agent is called again to perform the corresponding data processing steps to generate the second chart, and so on, until the generated Nth chart meets the preset conditions, then the Nth chart is taken as the final target chart.

[0160] In this embodiment, after generating the first chart in step S104, the user's evaluation result of the first chart can be obtained. If the user is satisfied with the content displayed in the first chart and does not make any other instructions, the first chart can be used as the final target chart. Figure 2As shown. Alternatively, if the user is not satisfied with the first chart and raises a second question instruction (and subsequent multiple rounds of question interaction instructions) based on the first chart, this application proposes a hybrid memory management strategy and dynamic correction mechanism to improve the accuracy of the final chart generation and user experience. Specifically, for the user's second question instruction (and subsequent multiple rounds of question interaction instructions), relevant contextual information is first retrieved from pre-stored short-term and long-term memories. Then, the intent parsing agent is used to determine the type of the user's second intent recognition result (including at least one of modifying chart configuration parameters, adding data query conditions, changing intent, etc.). Finally, based on the type of the second intent recognition result and the current chart (which is the first chart in the first case), at least one of the intent parsing agent, SQL generation agent, and chart generation agent is precisely invoked again to perform corresponding data processing steps to generate a corrected chart, such as the second chart. By analogy, after N rounds of dynamic context modification (the specific value is not limited and can be any positive integer greater than 0, such as 5), a more accurate target chart that meets preset conditions (the specific content is not limited and can be set according to actual conditions and experience; for example, the preset conditions can be set as the chart generated in the current round matching the user's question instruction in the current round, and the user not raising any further question instructions for the chart generated in the current round, etc.) can be generated. Therefore, compared to existing methods that generate charts based on user intent, this method can effectively improve the accuracy of recognizing user intent and further improve the accuracy of the final chart generation result.

[0161] The pre-stored short-term memory (STM) is used to maintain the real-time dialogue state of the current session. It can employ a sliding window mechanism to cache the original user commands from the last 3-5 rounds of dialogue, key parameters of generated charts (such as selected metrics, applied filtering conditions, and chart type), and structured parsing results (JSON format) output by the intent parsing agent. For each round of interaction, the input user commands, chart parameters, and intent parsing results can be used to output a structured context package based on the pre-stored STM, containing key entities, conditions, and operation records from recent dialogue history. Therefore, the main function of the pre-stored STM is to resolve referential resolution (e.g., "it," "this data") and context inheritance (e.g., the user first says "show sales figures," then "by weekly granularity"). For example, when the user says "change it to a line chart," the system can clearly identify from the STM that "it" refers to the chart generated in the previous round.

[0162] Pre-stored long-term memory is used to store relatively stable information across sessions, primarily recording users' personalized preferences (such as preference for using bar charts or frequently viewed specific metrics) and domain knowledge (such as logical relationships between metrics). Based on user behavior patterns, explicitly set user preferences, and pre-defined domain knowledge accumulated from each interaction, personalized background information and preference constraints can be output using pre-stored long-term memory. Therefore, the main function of pre-stored long-term memory is to achieve personalized recommendations and domain knowledge assistance. For example, a financial analyst typically focuses on "gross profit margin" and "net profit margin," and when parsing related instructions, long-term memory can help locate relevant data more quickly and accurately.

[0163] Furthermore, when using the intent parsing agent to determine the type corresponding to the user's second intent recognition result, the intent parsing agent can input data such as the user's second question instruction for the first chart, the recent dialogue context retrieved from pre-stored short-term memory, and user preferences (if any) obtained from pre-stored long-term memory. This allows the intent parsing agent to leverage the capabilities of a large language model to comprehensively analyze new and old information, identify the user's core intent in the current round, and the specific operation type for the historical chart (such as the first chart). It then outputs a structured judgment, which may include the following:

[0164] "1. Operation Intent: such as "Add Filter Conditions" (ADD_FILTER), "Change Chart Type" (CHANGE_CHART_TYPE), "Completely Switch Analysis Dimensions" (SWITCH_ANALYSIS), etc."

[0165] 2. Target of operation: Which specific parameter or part of the data needs to be modified.

[0166] 3. New / Modified Content: New conditions or requirements parsed out.

[0167] For example, based on the user's second instruction regarding the first chart, "Add data from the same period in North China and convert it to a line chart," the corresponding output could be as follows:

[0168] "{"operation": "ADD_FILTER & CHANGE_CHART_TYPE", "target": "region_filter, chart_type", "new_value": {"region": "north_china"}, "new_chart_type": "line"}".

[0169] Based on this, according to the type of the user's second intent recognition result determined by the intent parsing agent (i.e., modifying chart configuration parameters, adding data query conditions, or changing intent at least one of them), the current state of the chart (which can be obtained from pre-stored short-term memory), and the relevant data query results, the processing pipeline corresponding to at least one of the intent parsing agent, SQL generation agent, and chart generation agent can be called again to achieve precise incremental updates or minimal reconstruction.

[0170] Specifically, one possible implementation is that when the user's second intent recognition result corresponds to the type of modifying chart configuration parameters (such as "change to line chart"), the chart generation agent can be called again, and the modified chart configuration parameters (representing the new chart type) can be routed to the chart generation agent so that the chart generation agent can use the modified chart configuration parameters and the queried data to modify the first chart and obtain the second chart, such as changing the chart type of the first chart from bar chart to line chart, while keeping the data consistent. This process does not require re-querying the database.

[0171] For example: Suppose a user submits the first question, "Compare the number of on-duty operators for international payment and receipt transactions in January 2025 and February 2025," and generates an example like this: Figure 3 Following the first chart shown, a second instruction was given regarding the first chart: "Add contemporaneous data for private international remittances and change it to a line chart for comparison." The second chart, obtained by modifying the first chart, can be as follows: Figure 4 As shown in the second chart, and with the option to embed a chart annotation: "The number of on-duty personnel for international payment and receipt operations was 5.2 and 4.6 in January and February 2025, respectively, showing a downward trend, while the number of on-duty personnel for private international remittance operations remained stable at 0.1 in both months. Overall, the manpower input for international payment and receipt operations is much higher than that for private international remittance operations, and it fluctuates, requiring attention to its personnel allocation efficiency."

[0172] Alternatively, when the user's second intent recognition result corresponds to a new data query condition (such as "add North China region"), it is not necessary to regenerate the entire data query SQL statement and chart. Instead, the SQL generation agent can be invoked again, and the new data query condition (such as region = 'north_china') can be routed to the SQL generation agent. The SQL generation agent can then incrementally modify the original data query SQL statement (such as adding conditions in the WHERE clause) to generate a new modified data query SQL statement. By executing this new modified data query SQL statement, the updated SQL query result can be obtained. Furthermore, the chart generation agent can be invoked again, and the updated SQL query result can be passed to it. The chart generation agent can then convert the updated SQL query result into updated chart configuration parameters and use these parameters to modify the first chart to obtain the second chart. For example, a data series can be added to the first chart (such as adding a line representing "North China").

[0173] Alternatively, when the user's second intent identification result corresponds to a changed intent (e.g., from "trend analysis" to "distribution analysis"), it indicates that the target object the user wants to analyze has fundamentally changed. In this case, it is necessary to reset the working state of all agents, that is, to call the intent parsing agent, SQL generation agent, and chart generation agent again to perform their respective data processing steps to generate the second chart. The specific implementation process will not be repeated here. However, it should be noted that in the process of resetting the working state of all agents to generate the second chart, in order to improve processing efficiency, it is still possible to try to reuse some of the identified indicators and conditions, rather than starting from scratch entirely.

[0174] Furthermore, it should be noted that if the second question command and subsequent new commands raised by the user clearly conflict with the historical context (for example, the user first raises a question command requesting "only count online channels", and then raises a new question command requesting "show all channels"), the recent priority principle can be adopted by default, taking the latest command raised by the user as the standard, and the stored short-term memory will be updated.

[0175] For example, assuming N=3, meaning the user has engaged in three rounds of interaction, in the first round, if the user's initial instruction is "Compare the online sales growth rate in East China for the first three quarters of 2024," then by executing steps S101-104 above, a bar chart showing the sales growth rate for East China from Q1 to Q3 can be generated. Short-term memory is also used to store the instruction, key parameters (such as metrics: sales growth rate; region: East China; channel: online; time: Q1-Q3 2024; chart type: bar chart, etc.) and the initial intent recognition result.

[0176] Secondly, in the second round of interaction (taking the user's additional instruction as an example), assuming that the user's second question instruction is "add the same period data of North China and change it to a line chart for comparison", then by executing the above step S105, after recalling the chart parameters of the previous round from the previously stored short-term memory, the intent parsing agent analyzes the second question instruction and the recalled information to obtain the type corresponding to the user's second intent recognition result (i.e., the user's operation intent) as adding data query conditions and modifying chart configuration parameters, specifically ADD_FILTER (adding a region) and CHANGE_CHART_TYPE (modifying the chart type). To address this, the SQL generation agent can be invoked to add the condition `OR region = 'north_china'` to the existing data query SQL statement based on the incremental modification instruction. This generates a new data query SQL statement for East China and North China. After executing the new query SQL statement in the database, the data for both regions can be returned and passed to the chart generation agent as the updated SQL query result. The agent can then generate a comparison chart (i.e., the second chart) containing two lines (East China and North China) based on the new chart type "line chart" and the updated SQL query result. Simultaneously, the stored short-term memory can be updated to record the new chart state (i.e., region: East China, North China; chart type: line chart).

[0177] Secondly, in the third round of interaction (taking further user correction as an example), assuming the user's third instruction is "only view the data for Q2, excluding Q1 and Q3," the current chart state (including East China and North China, chart type: line) can be retrieved from the previously stored short-term memory. The intent parsing agent then analyzes the third instruction and the retrieved information again, obtaining the user's third intent identification result, which corresponds to the type (i.e., the user's operational intent) MODIFY_FILTER (modify time condition). Further, the SQL generation agent can be invoked to modify the original data query SQL statement, limiting the time range to quarter = '2024Q2', generating a new updated data query SQL statement. After executing this updated SQL statement in the database, the updated SQL query result is passed to the chart generation agent, which then updates the line chart based on the updated SQL query result (i.e., only Q2 data), displaying only two data points from Q2 as the third chart. Thus, what is ultimately presented to users is a double-series line chart (i.e., the third chart) that only shows the growth rate of online sales in East and North China in the second quarter of 2024.

[0178] Furthermore, experiments have shown that the chart generation method implemented through steps S101-S105, compared to existing chart generation methods, not only effectively reduces the error rate to below 10% through the RAG-enhanced chart knowledge retrieval mechanism, but also, in terms of efficiency, the end-to-end automated process shortens the chart construction time from 5-10 minutes required for manual configuration to within 10 seconds. Moreover, the multi-round interaction support capability allows for more than 5 consecutive rounds of condition addition, dynamically correcting the chart output without restarting the process.

[0179] In summary, the chart generation method provided in this embodiment first obtains a first question instruction from the user; then, through RAG enhancement, it retrieves a target chart template and indicator data matching the first question instruction from a pre-constructed indicator library. Next, an intent parsing agent performs intent recognition processing based on the first question instruction, the target chart template, and the indicator data to obtain the user's first intent recognition result; then, an SQL generation agent generates a data query SQL statement based on the first intent recognition result; and executes the data query SQL statement to obtain the SQL query result. Next, a chart generation agent converts the SQL query result into chart configuration parameters conforming to a preset format specification; and uses these chart configuration parameters to generate a first chart. Furthermore, based on the user's second question instruction regarding the first chart, the intent parsing agent determines the type corresponding to the user's second intent recognition result; and based on this type, at least one of the intent parsing agent, SQL generation agent, and chart generation agent is invoked again to perform corresponding data processing steps to generate a second chart, and so on, until the generated Nth chart meets preset conditions, at which point the Nth chart is taken as the final target chart.

[0180] As can be seen, when generating charts, this application first retrieves target chart templates and indicator data from the indicator library that match the user's first question instruction (such as having high semantic similarity), and then uses the intent parsing agent to perform intent recognition based on the retrieved data to obtain the first intent recognition result, thereby enhancing the ability to capture the user's true intent and improving the accuracy of intent recognition results.

[0181] Building upon this foundation, this application further utilizes an end-to-end chart generation process that coordinates the SQL generation agent, the chart generation agent, and the intent parsing agent. Based on the first intent recognition result, the first chart is generated step by step, thereby decomposing the chart generation task into multiple specialized stages executed sequentially. Each agent focuses on a specific subtask and can transmit intermediate results through structured messages (such as JSON format), forming a closed-loop decision-making chain to ensure high-precision conversion from the first question instruction to the final visualized first chart.

[0182] Next, after determining the type of the user's second intent recognition result based on the second question instruction posed by the user to the first chart, this application further, based on this type and the current chart's (initially the first chart) state, precisely invokes at least one of the following agents: intent parsing agent, SQL generation agent, and chart generation agent. This executes a specific step in the corresponding workflow to incrementally update or reconstruct the data, thereby generating a corrected chart (such as the second chart). This process is repeated N times (e.g., 5 times) of dynamic context modification to ultimately generate a target chart that meets preset conditions and has higher accuracy. Therefore, compared to existing methods for generating charts based on user intent, this approach effectively improves the accuracy of user intent recognition and further enhances the accuracy of the corresponding chart generation results, ultimately achieving the desired chart generation effect.

[0183] Furthermore, embodiments of this application also provide a chart generation device, including: a processor, a memory, and a system bus;

[0184] The processor and the memory are connected via the system bus;

[0185] The memory is used to store one or more programs, the one or more programs including instructions that, when executed by the processor, cause the processor to perform any of the above-described implementations of the graph generation method.

[0186] refer to Figure 5 The diagram illustrates a structure suitable for implementing the chart generation device in the embodiments of this application. The chart generation device in the embodiments of this application may include, but is not limited to, terminals such as mobile phones, tablets, and smartwatches, as well as servers. Figure 5 The chart generation device shown is merely an example of an electronic device and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0187] like Figure 5 As shown, the chart generation device may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. When the chart generation device is powered on, the RAM 503 also stores various programs and data required for device operation. The processor 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0188] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 508 including, for example, memory card, hard disk, etc.; and communication devices 509. Communication device 509 allows the electronic device to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 A diagram generation device with various means is shown; however, it should be understood that implementation or possession of all the means shown is not required. More or fewer means may be implemented alternatively.

[0189] Furthermore, embodiments of this application also provide a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform any of the above-described implementations of the chart generation method.

[0190] Furthermore, this application embodiment also provides a computer program product, which, when run on a terminal device, causes the terminal device to execute any of the above-described implementation methods of the chart generation method.

[0191] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0192] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and relevant parts can be referred to the method section.

[0193] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0194] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A chart generation method, characterized in that, include: Get the user's first question instruction; And by using a search-enhanced generation method, the target chart template and indicator data that match the first question instruction are retrieved from the pre-constructed indicator library; The intent parsing agent performs intent recognition processing based on the first question instruction, target chart template, and indicator data to obtain the user's first intent recognition result. An intelligent agent is generated using SQL. Based on the first intent recognition result, a data query SQL statement is generated; and the data query SQL statement is executed to perform a data query and obtain the SQL query result. The intelligent agent generates a chart by converting the SQL query results into chart configuration parameters that conform to a preset format specification; and uses the chart configuration parameters to generate a first chart. Based on the user's second question instruction for the first chart, the intent parsing agent is used to determine the type corresponding to the user's second intent recognition result; Based on the type, at least one of the intent parsing agent, SQL generation agent, and chart generation agent is invoked again to perform corresponding data processing steps to generate a second chart. This process continues until the generated Nth chart meets the preset conditions, at which point the Nth chart is taken as the final target chart. N is a positive integer greater than 0.

2. The method according to claim 1, characterized in that, The indicator library is constructed as follows: Obtain basic document data; the basic document data includes indicator metadata documents, predefined chart template documents, and business terminology document data; The basic document data is semantically segmented to obtain M semantic text blocks; where M is a positive integer greater than 0. Generate semantic vectors corresponding to each of the M semantic text blocks; and store the M semantic text blocks and their corresponding semantic vectors into a vector database as an index library.

3. The method according to claim 2, characterized in that, The method of enhanced generation through retrieval retrieves target chart templates and indicator data that match the first question instruction from a pre-selected indicator library, including: Generate a query vector corresponding to the first question instruction; and retrieve K text block semantic vectors similar to the query vector and their corresponding chart templates and indicator data from a pre-constructed indicator library, as target chart templates and indicator data matching the first question instruction; where K is a positive integer greater than 0.

4. The method according to claim 1, characterized in that, The process of obtaining the user's first intent recognition result by performing intent recognition processing based on the first question instruction, the target chart template, and indicator data through the intent parsing intelligent agent includes: The intent parsing agent concatenates the first question instruction, the target chart template, and the indicator data to obtain a concatenation result; and uses the concatenation result to generate a first prompt instruction, which is then input into a large language model for intent recognition processing to obtain the user's first intent recognition result.

5. The method according to claim 1, characterized in that, The step of generating an intelligent agent via SQL, based on the first intent recognition result, to generate a data query SQL statement includes: The system generates an intelligent agent using SQL, retrieves data table information from the database, and uses the data table information and the first intent recognition result to generate a second prompt instruction, which is then input into the large language model to obtain the data query SQL statement output by the model.

6. The method according to claim 1, characterized in that, The step of generating an intelligent agent through charts, converting the SQL query results into chart configuration parameters conforming to a preset format specification, includes: The system generates an intelligent agent based on the chart, determines the target chart type, and uses the target chart type and SQL query results to generate a third prompt instruction, which is then input into the large language model to obtain chart configuration parameters that conform to the preset format specifications.

7. The method according to claim 1, characterized in that, The type corresponding to the user's second intent recognition result includes at least one of modifying chart configuration parameters, adding data query conditions, and changing intent; the step of calling at least one of the intent parsing agent, SQL generation agent, and chart generation agent again to perform corresponding data processing steps to generate the second chart, based on the type, includes: When the user's second intent recognition result corresponds to the type of modifying chart configuration parameters, the chart generation agent is called again, and the first chart is modified using the modified chart configuration parameters to obtain the second chart; Alternatively, when the type corresponding to the user's second intent recognition result is a new data query condition, the SQL generation agent is called again to generate a modified data query SQL statement. After executing the modified data query SQL statement to obtain the updated SQL query result, the chart generation agent is called again to generate updated chart configuration parameters, so as to generate a second chart using the updated chart configuration parameters. Alternatively, when the user's second intent recognition result corresponds to the type of change intent, the intent parsing agent, SQL generation agent, and chart generation agent are invoked again to perform their respective data processing steps in order to generate the second chart.

8. The method according to any one of claims 1-7, characterized in that, After generating the intelligent agent through the chart and converting the SQL query results into chart configuration parameters conforming to a preset format specification, the method further includes: The intelligent agent analyzes the configuration parameters of the chart and generates chart annotations based on the analysis results.

9. A chart generation device, characterized in that, include: Processor, memory, system bus; The processor and the memory are connected via the system bus; The memory is used to store one or more programs, the one or more programs including instructions that, when executed by the processor, cause the processor to perform the method according to any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the method described in any one of claims 1-8.

11. A computer program product, characterized in that, The program product includes a computer program that, when executed by an electronic product, can implement the method described in any one of claims 1-8.

Citation Information

Cited By

  • Data table visualization method based on user-triggered and ai-driven visualized recommendations

    CN122153189A