Display device and chart generation method based on large model
By using big model technology in the display device, automatically identifying the corresponding chart type of user question text and generating chart structure data, the problem of low chart generation efficiency in the prior art is solved, and efficient chart generation and display is achieved.
Patent Information
- Application Number
- CN202411677434.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the efficiency of generating charts based on user questions is inefficient, and a lot of development work is required to support the viewing of different dimensions of users' multiple rounds of interactions.
A display device and a large-model-based chart generation method are provided. The first large-model determines the target chart type corresponding to the user's question text, and combines the second large-model to analyze and generate target chart structure data based on the question text and database query results, without manual code writing.
Improve the efficiency of chart generation and display, reduce development workload, and support users' multiple rounds of interaction to view different dimensions.
Smart Images

Figure CN119646017A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a display device and a diagram generation method based on a large model. Background Art
[0002] In vertical industries, different chart presentation methods such as pie charts, line charts, bar charts, and scatter charts are required for data analysis of data query results. At present, the main method of chart display is that development engineers use coding to compile the data queried in the database into structural data of different charts, and pass it to front-end engineers, who then render the data and generate corresponding charts. However, this method requires a lot of development work. If users can view chart data in different dimensions at will through multiple rounds of interaction, back-end development engineers and front-end engineers need to continuously develop new logic to support it, and users cannot ask questions at will, which is extremely inefficient.
[0003] Therefore, how to improve the efficiency of data chart generation has become an urgent problem to be solved. Summary of the invention
[0004] The embodiments of the present application provide a display device and a chart generation method based on a large model, so as to solve the problem of low efficiency in chart generation based on user questions in the prior art.
[0005] The present application provides a display device, the display device comprising a display and a processor:
[0006] The display is configured to: display a target chart generated for a question text input by a user;
[0007] The processor is configured to:
[0008] If a question text of the user is received, determining a target chart type corresponding to the question text based on the first large model;
[0009] Fill the target chart type, the question text, and the database query result corresponding to the question text into a first prompt word template to obtain a first prompt text; input the first prompt text into a second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text to generate target chart structure data corresponding to the target chart type;
[0010] A target chart is generated according to the target chart structure data, and the display is controlled to display the target chart.
[0011] The above technical solution has the following advantages or beneficial effects: if a user's question text is received, the target chart type corresponding to the question text is determined based on the first large model, and then the target chart type, the question text, and the database query result corresponding to the question text are filled into the first prompt word template to obtain the first prompt text, and the first prompt text is input into the second large model, and the second large model analyzes the question text and the database query result according to the requirements of the first prompt text to generate the target chart structure data corresponding to the target chart type, thereby generating the target chart according to the target chart structure data, and controlling the display to display the target chart. First, the target chart type corresponding to the user's question text is identified by using the first large model, and then the target chart structure data corresponding to the target chart type is generated by using the second large model according to the question text and the database query result, thereby generating the target chart according to the target chart structure data. In the process of chart generation, no code needs to be manually written, which improves the efficiency of chart generation and display.
[0012] Furthermore, the processor is specifically configured to:
[0013] Filling the question text and chart judgment criteria into the second prompt word template to obtain a second prompt text, wherein the chart judgment criteria is used to describe the applicability of different types of charts;
[0014] The second prompt text is input into the first large model, the first large model analyzes the question text, and determines the target chart type corresponding to the question text according to the applicability of different types of charts in the chart judgment standard.
[0015] The above technical solution has the following advantages or beneficial effects: pre-setting chart judgment criteria, when using the first large model to determine the target chart type corresponding to the question text, constructing a second prompt text according to the question text and the chart judgment criteria, so that when the first large model determines the target chart type, it determines it according to the applicability of different types of charts in the chart judgment criteria, thereby improving the accuracy of determining the target chart type.
[0016] Furthermore, the processor is further configured to:
[0017] If an instruction to view the chart judgment standard is received, controlling the display to display the chart judgment standard;
[0018] If an instruction to adjust any chart judgment standard is received, the target content carried in the instruction is obtained, the chart judgment standard is updated using the target content, and the display is controlled to display the updated chart judgment standard.
[0019] The above technical solution has the following advantages or beneficial effects: users can view and adjust the currently saved chart judgment criteria, and can adjust the chart type as needed, which improves the user experience and facilitates subsequent maintenance without having to rewrite the code.
[0020] Furthermore, the processor is also configured to:
[0021] Acquire each pre-saved standard chart information, wherein the standard chart information includes a summary encoding embedding of chart structure data and chart structure data;
[0022] Determine the similarity between the question text and the summary encoding embedding included in each standard chart information respectively;
[0023] According to each similarity and a preset similarity threshold, selecting the target chart information with the highest matching degree with the question text from each standard chart information;
[0024] The processor is specifically configured to:
[0025] The target chart type, the question text, the database query result corresponding to the question text, and the chart structure data corresponding to the target chart information are filled into a first prompt word template to obtain a first prompt text; and the second large model is enabled to learn the generation idea of the chart structure data in the target chart information when generating the target chart structure data.
[0026] The above technical solution has the following advantages or beneficial effects: in each pre-saved standard chart information, the target chart information with the highest degree of matching with the question text is found, and the chart structure data corresponding to the target icon information is filled into the first prompt word template together with the target chart type, the question text and the database query result to obtain the first prompt text, so that the subsequent second largest model can learn the generation idea of the chart structure data in the target chart information when generating the target chart structure data, and improve the accuracy of the second largest model in generating the target chart structure data through small sample learning.
[0027] Furthermore, the standard chart information also includes a chart type; and the processor is further configured to:
[0028] According to the chart type in each standard chart information and the target chart type corresponding to the question text, in each standard chart information, the standard chart information inconsistent with the target chart type is eliminated.
[0029] The above technical solution has the following advantages or beneficial effects: standard chart information inconsistent with the target chart type is eliminated, the efficiency of determining the target chart information is improved, and the screened target chart information is ensured to be consistent with the target chart type, further ensuring the accuracy of generating the target chart structure data.
[0030] Furthermore, the processor is also configured to:
[0031] Determine the similarity between the chart information recorded in the target chart structure data and the question text, the chart information including a chart title and a key-value pair corresponding to the data included in the chart;
[0032] If the similarity meets the preset threshold requirement, the subsequent step of generating a target chart according to the target chart structure data is continued.
[0033] The above technical solution has the following advantages or beneficial effects: after obtaining the target chart structure data generated by the second largest model, the similarity between the chart information recorded in the target chart structure data and the question text is determined, and the target chart is generated based on the target chart structure information only after the similarity meets the preset threshold requirement, thereby improving the accuracy of target chart generation.
[0034] Furthermore, the processor is also configured to:
[0035] If the similarity does not meet the preset threshold requirement, the target graph structure data and the question text are saved in a generated error record table.
[0036] The above technical solution has the following advantages or beneficial effects: if the similarity does not meet the preset threshold requirement, the target graph structure data and the corresponding question text are saved in the generation error record table for user viewing, so that the user can understand in real time whether the generation ability of the second largest model is insufficient.
[0037] Furthermore, the processor is also configured to:
[0038] If an instruction to modify any target chart structure data in the generation error record table is received, the target chart structure data is modified according to the modified information carried in the instruction, and the second large model is fine-tuned and trained based on the modified generation error record table.
[0039] The above technical solution has the following advantages or beneficial effects: erroneous target graph structure data is corrected, and the corrected data is used to train the second largest model, thereby improving the accuracy of generating graph structure data.
[0040] Furthermore, the processor is specifically configured to:
[0041] Filling the target chart structure data into a third prompt word template to obtain a third prompt text;
[0042] Input the third prompt text into the third large model, so that the third large model determines the front-end rendering code corresponding to the target chart structure data according to the requirements of the third prompt text;
[0043] The display is controlled to display the target chart according to the front-end rendering code.
[0044] The above technical solution has the following advantages or beneficial effects: the third model is used to intelligently generate the front-end rendering code corresponding to the target chart structure data, without the need for manual code writing, thereby improving the efficiency of chart generation.
[0045] The present application provides a diagram generation method based on a large model, the method comprising:
[0046] If a question text of the user is received, determining a target chart type corresponding to the question text based on the first large model;
[0047] Fill the target chart type, the question text, and the database query result corresponding to the question text into a first prompt word template to obtain a first prompt text; input the first prompt text into a second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text to generate target chart structure data corresponding to the chart type;
[0048] A target chart is generated according to the target chart structure data, and the target chart is displayed.
[0049] The present application provides a diagram generation device based on a large model, the device comprising:
[0050] a determination module, configured to determine, upon receiving a question text from the user, a target chart type corresponding to the question text based on a first large model;
[0051] A filling module, used to fill the target chart type, the question text and the database query result corresponding to the question text into the first prompt word template to obtain the first prompt text;
[0052] A generation module is used to input the first prompt text into the second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text, and generates target chart structure data corresponding to the chart type; generates a target chart according to the target chart structure data, and displays the target chart.
[0053] The present application also provides an electronic device, which includes a processor, and the processor is used to implement the steps of any of the above-mentioned large model-based chart generation methods when executing a computer program stored in a memory.
[0054] The present application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-mentioned large model-based chart generation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0056] Figure 1 A schematic diagram of the structure of a display device provided in an embodiment of the present application;
[0057] Figure 2 A schematic diagram showing a chart judgment standard provided in an embodiment of the present application;
[0058] Figure 3a A schematic diagram of generating an error record table display provided in an embodiment of the present application;
[0059] Figure 3b A schematic diagram of a target chart structure data modification page provided in an embodiment of the present application;
[0060] Figure 4 A schematic diagram of a target chart structure data verification process provided by an embodiment of the present application;
[0061] Figure 5 A schematic diagram of a diagram generation process based on a large model provided in an embodiment of the present application;
[0062] Figure 6a A diagram showing a diagram provided in an embodiment of the present application;
[0063] Figure 6b A diagram showing a diagram provided in an embodiment of the present application;
[0064] Figure 7a A diagram showing a diagram provided in an embodiment of the present application;
[0065] Figure 7b A diagram showing a diagram provided in an embodiment of the present application;
[0066] Figure 8A schematic diagram of a diagram generation process based on a large model provided in an embodiment of the present application;
[0067] Fig. 9 A schematic diagram of the structure of a diagram generating device based on a large model provided in an embodiment of the present application;
[0068] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the embodiment of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiment is only a part of the embodiment of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of this application.
[0070] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0071] It should be noted that the terms "including" and "having" and their variations involved in the documents of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0072] The terms "first" and "second" in this document are used for descriptive purposes only and should not be understood as explicitly or implicitly indicating relative importance or implicitly indicating the number of technical features indicated. Therefore, features defined as "first" and "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0073] The word “exemplary” is used hereinafter to mean “serving as an example, example, or illustration.” Any embodiment described as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0074] In the prior art, the most direct way to generate chart data based on a large model is to let the large model generate chart data based on the questions input by the user. The actual application accuracy is low and the effect is poor. The large model can directly generate the chart data structure, but the generated structure is single, and the format required by the front end for different charts is different. The chart structure data directly generated by the large model requires the front-end engineer to develop and adapt. How to generate standardized chart data with an accuracy that meets business requirements is a difficult point. Based on this, an embodiment of the present application provides a display device and a chart generation method based on a large model, wherein the display device includes a display and a processor: the display is configured to: display a target chart generated for a question text input by a user; the processor is configured to: if a question text of the user is received, determine the target chart type corresponding to the question text based on the first large model; fill the target chart type, the question text, and the database query result corresponding to the question text into a first prompt word template to obtain a first prompt text; input the first prompt text into a second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text, and generates target chart structure data corresponding to the target chart type; generate a target chart according to the target chart structure data, and control the display to display the target chart.
[0075] Figure 1 A structural schematic diagram of a display device provided in an embodiment of the present application, the display device 10 includes a display 101 and a processor 102; wherein the display 101 is configured to: display a target chart generated for a question text input by a user; the processor 102 is configured to: if a question text of the user is received, determine a target chart type corresponding to the question text based on a first large model; fill the target chart type, the question text and a database query result corresponding to the question text into a first prompt word template to obtain a first prompt text; input the first prompt text into a second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text, and generates target chart structure data corresponding to the target chart type; generate a target chart according to the target chart structure data, and control the display 101 to display the target chart.
[0076] When users are conducting intelligent question-answering, some data may need to be displayed using charts. For example, the query results need to be displayed as pie charts, line charts, bar charts, scatter charts, etc. Therefore, a display device 10 is provided in an embodiment of the present application, and the display device 10 at least includes a display 101 and a processor 102. In order to facilitate users to view the answer information, in an embodiment of the present application, the display 101 can be configured to display a target chart generated for the question text entered by the user. Of course, the display 101 can also display the questions entered by the user, as well as other content.
[0077] The user can input a question text to the display device 10. Specifically, the user can input the question text in text form or in audio form. Of course, the question text can also be sent by other electronic devices connected to the display device 10. In the embodiment of the present application, the display device 10 can be a mobile phone, a computer, a tablet computer, etc.
[0078] Since the large model has a strong semantic understanding ability, if the processor 102 receives the user's question text, it can determine the target chart type corresponding to the question text based on the first large model. That is to say, the first large model is used to determine which type of chart is suitable for displaying the query result corresponding to the user's question text. In the traditional scheme, the target chart type corresponding to the user's question text must have a clear indicator, for example, "the chart type of the number of newly registered vehicles is a line chart", "the chart type of the key indicator driver is a bar chart", and the user's question content is generally not very standardized, and the traditional scheme cannot accurately determine the target chart type. In the embodiment of the present application, even if the user does not specify the chart type in the question text, the target chart type corresponding to the prompt text can be determined by the first large model. If the chart type is specified in the question text, the first large model can directly determine the chart type as the target chart type. Among them, the first large model can be any large language model with semantic understanding ability. Exemplarily, the question text and the prompt word can be input into the first large model, and the prompt word can be "Please analyze the following question and determine what type of chart is suitable for displaying the query result corresponding to the question". How the first model analyzes the corresponding text based on the prompt words is a prior art, and the embodiment of the present application will not elaborate on this process.
[0079] In an embodiment of the present application, the second largest model can be used to generate the target chart structure data corresponding to the question text. The second largest model can be the same as or different from the first largest model. The target chart structure data can be understood as text used to describe the content included in the corresponding chart. Exemplarily, taking a line chart as an example, the corresponding chart structure data can include the chart title, legend, the physical quantities represented by the horizontal and vertical axes of the chart, and the values to be displayed. Exemplarily, the chart structure data can be in the following form:
[0080]
[0081] Among them, "type":"Line chart" means the chart type is a line chart; "title":"The trend of the number of newly registered vehicles in each district of ** City" means the chart title is "The trend of the number of newly registered vehicles in each district of ** City"; "x_axis":"District" means the X-axis of the line chart, that is, the horizontal axis represents the district; "y_axis":"Number of vehicles" means the Y-axis of the line chart, that is, the vertical axis represents the number of vehicles; data means the data set; "Shinan District":{"y1":"1000"} means that the value of y1 corresponding to Shinan District in the line chart is 1000; "Shi* District":{"y1":"800"} means that the value of y1 corresponding to Shi* District in the line chart is 800.
[0082] Since the displayed data table needs to include specific data, in an embodiment of the present application, after receiving the user's question text, a corresponding structured query language (SQL) statement can be generated based on the question text, and a query can be performed in the database based on the SQL statement. How to generate an SQL statement corresponding to the question text is a prior art, and the embodiment of the present application will not go into details about this process. After obtaining the database query result corresponding to the question text, the target chart type, the question text, and the database query result corresponding to the question text can be filled into the first prompt word template to obtain the first prompt text. The first prompt text can be a text used to prompt the second large model to generate the target chart structure data corresponding to the target chart type according to the question text and the database query result. Exemplarily, the first prompt text can be:
[0083] "You are a chart data expert and need to provide chart structure data that can be directly rendered by front-end developers. Please generate chart structure data based on user input and the following requirements. --- Instructions
[0084] #The following is the definition of the database table structure: ---Table structure
[0085] ##Table name: drivinglicense, driver table, fields are as follows:
[0086]
[0087] #When the chart type is a pie chart, you need to calculate the proportion value, the proportion field is proportion---other requirements
[0088] #User demand chart type is line chart
[0089] #The user's question is: "The trend of the number of registered vehicles in each district and city in ** City this month."
[0090] After obtaining the first prompt text, the first prompt text can be input into the second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text to generate the target chart structure data corresponding to the target chart type.
[0091] After obtaining the target chart structure data, a target chart can be generated according to the target chart structure data, and the display 101 can be controlled to display the target chart. Exemplarily, when generating a target chart, the target chart structure data can be filled into a preset front-end code template to obtain a front-end rendering code, thereby displaying the target chart according to the front-end rendering code. The target chart structure data can also be sent to an electronic device of a front-end engineer, who writes a front-end rendering code based on the target chart structure data and feeds it back to the display device 10, and then the display 101 of the display device 10 displays the target chart based on the front-end rendering code.
[0092] Because in the embodiment of the present application, if the user's question text is received, the target chart type corresponding to the question text is determined based on the first large model, and then the target chart type, the question text, and the database query result corresponding to the question text are filled into the first prompt word template to obtain the first prompt text, and the first prompt text is input into the second large model, and the second large model analyzes the question text and the database query result according to the requirements of the first prompt text to generate the target chart structure data corresponding to the target chart type, thereby generating the target chart according to the target chart structure data, and controlling the display to display the target chart. First, the first large model is used to identify the target chart type corresponding to the user's question text, and then the second large model is used to generate the target chart structure data corresponding to the target chart type according to the question text and the database query result, thereby generating the target chart according to the target chart structure data. In the process of chart generation, no code needs to be manually written, which improves the efficiency of chart generation and display.
[0093] In order to improve the accuracy of chart generation, based on the above embodiments, in the embodiment of the present application, the processor 102 is specifically configured to: fill the question text and chart judgment criteria into the second prompt word template to obtain a second prompt text, wherein the chart judgment criteria are used to describe the applicability of different types of charts; input the second prompt text into the first large model, the first large model analyzes the question text, and determines the target chart type corresponding to the question text according to the applicability of different types of charts in the chart judgment criteria.
[0094] In order to improve the accuracy of chart generation, in an embodiment of the present application, a chart judgment standard can be pre-configured, and the chart judgment standard describes the applicability of different types of charts. When the first large model subsequently determines the target chart type corresponding to the prompt text, it can be determined based on the applicability of different types of charts described in the chart judgment standard.
[0095] When using the first large model to determine the target chart type corresponding to the question text, the processor 102 can fill the question text and the chart judgment standard into the second prompt word template to obtain the second prompt text. For example, the second prompt text can be:
[0096] “#You are a language expert. Please select the most appropriate visualization chart based on the user’s question and give the chart name according to the input question.
[0097] #The following are the chart judgment criteria:
[0098] Pie chart: suitable for displaying proportions, and can show the proportional relationship of various indicators in the overall picture.
[0099] Bar charts and line charts: suitable for showing the comparison and trend between different indicators, and can present the numerical size and changes of each indicator.
[0100] Scatter charts and bubble charts: suitable for showing the relationship between multiple indicators and helping to discover the correlation between different indicators.
[0101] Heat map: It is suitable for displaying the heat and correlation between various indicators in multidimensional data, and can intuitively show the distribution of data.
[0102] ##Think about the output results in the following way:---Output format
[0103] 1. Determine the chart type of the user input question, including pie chart, bar chart, line chart, scatter chart, bubble chart, heat map, and others
[0104] 2. When the chart type is pie chart, bar chart, line chart, scatter chart, bubble chart, or heat map, output the chart name
[0105] 3. When the chart type is other, analyze the user's question according to the chart judgment criteria and select the most appropriate chart name, and output the selected chart name. In other words, a chart type corresponding to the user's question must be output
[0106] ##The output is in json format, containing one field, the fields are as follows:
[0107] -type, list format
[0108] ##Example:
[0109] - Input: Take a look at the trend of the number of newly registered vehicles in each district of ** City in the first half of the year
[0110] Output: {"Chart Type":["Line Chart"]
[0111] - Input: Let’s take a look at the trend of the number of newly registered vehicles in each district of ** City in the first half of the year and display it in a bar chart. Output: {"chart type": ["bar chart"]".
[0112] Among them, "Pie chart: suitable for showing proportions, can show the proportional relationship of various indicators in the overall. Bar chart and line chart: suitable for showing the comparison and trend between different indicators, can show the numerical size and changes of each indicator. Scatter chart and bubble chart: suitable for showing the correlation between multiple indicators, help discover the correlation between different indicators. Heat map: suitable for showing the heat and correlation between various indicators in multidimensional data, can intuitively see the distribution of data." is the chart judgment standard.
[0113] After obtaining the second prompt text, the second prompt text can be input into the first large model, which analyzes the prompt text and determines the target chart type corresponding to the question text based on the applicability of different types of charts in the chart judgment standard.
[0114] In an embodiment of the present application, a chart judgment standard is preset. When the first large model is used to determine the target chart type corresponding to the question text, a second prompt text is constructed based on the question text and the chart judgment standard. When the first large model determines the target chart type, it can be determined based on the applicability of different types of charts in the chart judgment standard, thereby improving the accuracy of determining the target chart type.
[0115] In order to improve the user experience, based on the above embodiments, in the embodiment of the present application, the processor 102 is further configured as follows:
[0116] If an instruction to view the chart judgment standard is received, controlling the display to display the chart judgment standard;
[0117] If an instruction to adjust any chart judgment standard is received, the target content carried in the instruction is obtained, the chart judgment standard is updated using the target content, and the display is controlled to display the updated chart judgment standard.
[0118] In order to enhance the user experience, in an embodiment of the present application, in addition to the preset standards for chart judgment standards, users can also dynamically adjust the standards on the front-end page. After the adjustment, the chart judgment standards used when determining the target chart type corresponding to the question text are the chart judgment standards modified by the user, which can achieve a dynamic display effect. In order to enable the user to view the currently used chart judgment standards, in an embodiment of the present application, the user can send an instruction to view the chart judgment standards to the display device 10. If the processor 102 receives an instruction to view the chart judgment standards sent by the user, in an embodiment of the present application, the processor 102 can obtain the currently saved chart judgment standards and control the display 101 to display the chart judgment standards. Figure 2 A schematic diagram showing a chart judgment standard is provided in an embodiment of the present application, such as Figure 2 As shown, the user can view the currently saved chart judgment criteria, and the user can adjust any chart judgment criteria on this page. If the processor 102 receives an instruction to adjust any chart judgment criteria, it can obtain the target content carried in the instruction, use the target content to update the chart judgment criteria, and control the display 101 to display the updated chart judgment criteria. Among them, the target content can be understood as the text modified by the user.
[0119] Specifically, the user's instruction to adjust the chart judgment standard may be to delete, add, modify, etc. the current chart judgment standard. If the user wishes to delete a certain chart judgment standard, the target content carried in the instruction may be empty, and the instruction may identify which chart judgment standard is to be deleted. Exemplarily, the content carried in the instruction may be to modify "A chart judgment standard" to empty, or to delete "A chart judgment standard". After parsing the "delete" information, the processor 102 may determine the target content to be empty.
[0120] If the user wishes to add a certain chart judgment standard, the target content carried in the instruction may be the content of the chart judgment standard that is desired to be added. For example, the content carried in the instruction may be the addition of "B chart judgment standard".
[0121] If the user wants to modify a chart judgment standard, the target content carried in the instruction can be the content of the chart judgment standard after modification, and the instruction identifies which chart judgment standard content is to be modified. For example, the content carried in the instruction can be to modify "C chart judgment standard" to "M chart judgment standard".
[0122] Specifically, users can view Figure 2 After the page is displayed, you can click the "Delete" button to delete the corresponding chart judgment standard, or directly modify the content of the currently displayed chart judgment standard, or click the "Add Standard" button to add a new chart judgment standard. After the user has adjusted all the chart judgment standards that need to be adjusted, he can click Figure 2 The "Submit" button shown in the figure sends the adjustment instruction. If the user clicks the "Cancel Modification" button, the instruction will not be sent.
[0123] For example, assume that the chart judgment criteria corresponding to the bar chart are: suitable for showing the comparison and trend between different indicators, and can present the numerical size and change of each indicator. The user can modify the original chart judgment criteria, for example, modify it to "continuous data that changes over time or ordered categories, especially suitable for showing the increase and decrease trend of data. The proportion of added value of different industries is shown in a bar chart." Based on the modified chart judgment criteria, the first model can understand that when asking about the proportion of added value of industries, it is judged as a bar chart instead of a pie chart.
[0124] In the embodiment of the present application, the user is supported to input the chart judgment criteria at the front end, and the chart type recognition effect is continuously optimized. In the embodiment of the present application, all chart types are supported, not limited to the commonly used pie charts, bar charts, line charts, scatter charts, bubble charts, and heat maps in the examples, but also support uncommon types such as ring charts, radar charts, funnel charts, and water wave charts. In the embodiment of the present application, by using the understanding ability of the large model, clear chart judgment criteria can be written in advance, and users are supported to input concepts and define class descriptions.
[0125] Due to the powerful semantic understanding ability of the big model, even if the chart judgment criteria input by the user are vague concepts, the big model can still accurately understand them.
[0126] In an embodiment of the present application, the user can view and adjust the currently saved chart judgment criteria and can adjust the chart type as needed, which improves the user experience and facilitates subsequent maintenance without having to rewrite the code.
[0127] In order to further improve the accuracy of chart generation, based on the above embodiments, in the embodiment of the present application, the processor 102 is further configured to:
[0128] Acquire each pre-saved standard chart information, wherein the standard chart information includes chart structure data summary encoding embedding and chart structure data;
[0129] Determine the similarity between the question text and the summary encoding embedding included in each standard chart information respectively;
[0130] According to each similarity and a preset similarity threshold, selecting the target chart information with the highest matching degree with the question text from each standard chart information;
[0131] The processor 102 is specifically configured to:
[0132] The target chart type, the question text, the database query result corresponding to the question text, and the chart structure data corresponding to the target chart information are filled into a first prompt word template to obtain a first prompt text; and the second large model is enabled to learn the generation idea of the chart structure data in the target chart information when generating the target chart structure data.
[0133] In order to improve the accuracy of the target chart structure data generated by the second largest model, in an embodiment of the present application, a plurality of standard chart information may be pre-saved, and the standard chart information may be manually pre-written. For example, qualified chart structure data is manually pre-written, and a corresponding chart structure data summary is written for the written chart structure data. Of course, the standard chart information may also be pre-generated based on the model and manually verified after the model generation is completed. After obtaining the chart structure data summary, an embedding generation model may be used to generate a chart structure data summary code embedding corresponding to the chart structure data summary. In an embodiment of the present application, the chart structure data summary code embedding and the chart structure data may be used as standard chart information.
[0134] In the embodiment of the present application, after determining the target chart type corresponding to the prompt text, before determining the first prompt text, the similarity between the question text and the summary encoding embedding included in each standard chart information can be determined respectively. After obtaining each similarity, the target chart information with the highest matching degree with the question text can be selected from each standard chart information according to each similarity and a preset similarity threshold.
[0135] Specifically, the encoding embedding corresponding to the question text can be determined, denoted as e, and the summary encoding embedding included in each standard chart information can be denoted as e1, e2, e3...ei. Where i is an integer, representing the number of the summary encoding embedding. The cosine similarity calculation of e of the question text and ei is performed in turn to obtain cos1, cos2, cos3...cosi. Where,
[0136] cos1=e@e1
[0137] cos2=e@e2
[0138] cos3=e@e3
[0139] …
[0140] After obtaining all the similarities cos1, cos2, cos3…cosi, if only one similarity is greater than the preset similarity threshold pf, the standard chart information corresponding to the similarity is determined as the target chart information. If there are multiple standard chart information with similarities greater than the preset similarity threshold pf, the standard chart information corresponding to the maximum similarity is determined as the target chart information. The preset similarity threshold pf has a value interval of [0,1].
[0141] After obtaining the target chart information, the processor 102 may fill the target chart type, the question text, the database query result corresponding to the question text, and the chart structure data corresponding to the target chart information into the first prompt word template to obtain the first prompt text, so that when the second large model generates the target chart structure data based on the first prompt text, it can learn the generation idea of the chart structure data in the target chart information.
[0142] Exemplarily, the first prompt text may be:
[0143] "You are a chart data expert and need to provide chart structure data that can be directly rendered by front-end developers. Please generate chart structure data based on user input and the following requirements. --- Instructions
[0144] #The following is the definition of the database table structure: ---Table structure
[0145] ##Table name: drivinglicense, driver table, fields are as follows:
[0146]
[0147] #Input: The trend of the number of registered vehicles in each district and city in ** city this month}".
[0148] According to the first prompt text mentioned above, the target chart type is "line chart"; the question text is "the trend of the number of registered vehicles in each district and city of ** city in that month"; the database query result is "[{"xzqh":"Li* District","count":116},{"xzqh":"City* District","count":183},{"xzqh":"City* District","count":128},......]"; the chart structure data corresponding to the target chart information is "Input: Let's take a look at the trend of the number of newly registered vehicles in each district of ** city; Output: {"type":"line chart","title":"The trend of the number of newly registered vehicles in each district of ** city","x_axis":"District","y_axis":"Number of vehicles","data":{"Shinan District":{"y1":"1000"},"City* District":{"y1":"800"}}}".
[0149] Based on the first prompt text, the target graph structure data generated by the second largest model can be:
[0150]
[0151]
[0152] In an embodiment of the present application, in each pre-saved standard chart information, the target chart information with the highest degree of match with the question text is searched, and the chart structure data corresponding to the target icon information is filled into the first prompt word template together with the target chart type, the question text and the database query result to obtain the first prompt text, so that the subsequent second largest model can learn the generation idea of the chart structure data in the target chart information when generating the target chart structure data. By means of small sample learning, the accuracy of the second largest model in generating the target chart structure data is improved.
[0153] In order to further improve the accuracy of chart generation, based on the above embodiments, in the embodiment of the present application, the standard chart information also includes a chart type; the processor 102 is further configured to:
[0154] According to the chart type in each standard chart information and the target chart type corresponding to the question text, in each standard chart information, the standard chart information inconsistent with the target chart type is eliminated.
[0155] Since the standard chart information may include many chart types, if the chart type corresponding to the target chart information finally determined is inconsistent with the target chart type corresponding to the question text, then the reference value for the second largest model to generate the target chart structure data is not very large, and the wrong reference sample may even cause the second largest model to generate wrong target chart structure data. Therefore, in the embodiment of the present application, before the processor 102 determines the similarity between the question text and the summary encoding embedding included in each standard chart information, it can also filter out all standard chart information that is consistent with the target chart type corresponding to the question text in each pre-saved standard chart information, and then determine the similarity between the question text and the summary encoder embedding in all the filtered standard chart information.
[0156] In the embodiment of the present application, based on the chart type in each standard chart information and the target chart type corresponding to the question text, standard chart information that is inconsistent with the target chart type can be eliminated in each standard chart information.
[0157] In the embodiment of the present application, standard chart information inconsistent with the target chart type is eliminated, which improves the efficiency of determining the target chart information and ensures that the screened target chart information is consistent with the target chart type, further ensuring the accuracy of generating the target chart structure data.
[0158] For example, in an embodiment of the present application, standard chart information can be stored in a database. Table 1 is an example of standard chart information storage provided in an embodiment of the present application. As shown in Table 1, a summary of chart structure data, summary code embedding, chart type, and chart structure data can be stored in a data table of the database. Among them, the summary code embedding can be generated based on the embedding model, eliminating the need to perform coding determination each time a similarity calculation is performed subsequently.
[0159] Table 1
[0160]
[0161] In order to further improve the accuracy of chart generation, based on the above embodiments, in the embodiment of the present application, the processor 102 is further configured to:
[0162] Determine the similarity between the chart information recorded in the target chart structure data and the question text, the chart information including a chart title and a key-value pair corresponding to the data included in the chart;
[0163] If the similarity meets the preset threshold requirement, the subsequent step of generating a target chart according to the target chart structure data is continued.
[0164] If a chart is generated based on wrong target chart structure data, then the chart must be wrong. Therefore, in order to ensure that the generated chart is accurate, in the embodiment of the present application, after obtaining the target chart structure data, before generating the target chart according to the target chart structure data, the processor 102 can also determine whether the target chart structure data is correct. In the embodiment of the present application, the similarity between the chart information recorded in the target chart structure data and the question text can be determined. The chart information can include a chart title and a key-value pair corresponding to the data included in the chart. Exemplarily, the target chart structure data can be:
[0165]
[0166] Among them, the title of the chart is "Trend of the number of registered vehicles in each district and city in ** City in the current month"; "x_axis":"District", "y_axis":"Number of vehicles", "Li*District":{"y1":"116"}, "City*District":{"y1":"183"}, "City*District":{"y1":"128"} can be understood as key-value pairs.
[0167] After obtaining the similarity, if the similarity meets the preset threshold requirement, it means that the generated target chart structure data is correct, and the subsequent steps of generating the target chart according to the target chart structure data can be continued. If the similarity does not meet the preset threshold requirement, it means that the target chart structure data is wrong, and the target chart structure data and the question text can be saved in the generation error record table for the user to view.
[0168] In the embodiment of the present application, after obtaining the target chart structure data generated by the second largest model, the similarity between the chart information recorded in the target chart structure data and the question text is determined, and the target chart is generated based on the target chart structure information only after the similarity meets the preset threshold requirement, thereby improving the accuracy of target chart generation. In addition, in the embodiment of the present application, if the similarity does not meet the preset threshold requirement, the target chart structure data and the corresponding question text are saved in the generation error record table for the user to view, so that the user can understand in real time whether the generation capability of the second largest model is lacking.
[0169] In order to further improve the accuracy of chart generation, based on the above embodiments, in the embodiment of the present application, the processor 102 is further configured to:
[0170] If an instruction to modify any target chart structure data in the generation error record table is received, the target chart structure data is modified according to the modified information carried in the instruction, and the second large model is fine-tuned and trained based on the modified generation error record table.
[0171] Since the target chart structure data generated by the second largest model is wrong, this means that the second largest model still lacks the ability to generate target chart structure data. Therefore, in an embodiment of the present application, the erroneous data recorded in the error record table can also be corrected to obtain the correct target chart structure data, and the second largest model can be fine-tuned and trained based on the corrected target chart structure data.
[0172] In the embodiment of the present application, when an instruction to view a generated error record table is received, the target chart structure data recorded in the currently generated error record table may be displayed. Figure 3a A schematic diagram of generating an error record table display provided in an embodiment of the present application is as follows: Figure 3a As shown in the figure, the current error record table records 3 erroneous target chart structure data. The user can modify any target chart structure data. For example, the user can click "To be modified" on the page to modify the corresponding target chart structure data. After clicking the "To be modified" button, you can jump to the following page: Figure 3b Modify the page shown, Figure 3b A schematic diagram of a target chart structure data modification page provided in an embodiment of the present application. Figure 3b As shown, users can modify the question and target chart structure data on this page. After the modification is completed, users can click the "Submit" button to complete the modification. Figure 3a The "to be modified" mark of the corresponding target chart structure data in the table is changed to "modification completed". Figure 3b If the "Cancel modification" button is clicked, it means that the user cancels the modification operation. After clicking the "Cancel modification" button, you can jump to Figure 3a The page shown in the figure, at this time, the "to be modified" mark of the corresponding target chart structure data remains unchanged. In order to train the second largest model, in the embodiment of the present application, the user can click Figure 3a The "go to training" button shown in the figure is used to train the second largest model. When receiving the "go to training" instruction, the processor 102 can obtain the target chart structure data currently marked as "modification completed", and fine-tune the second largest model based on the obtained target chart structure data. How to fine-tune the second largest model based on the existing data is a prior art, and the embodiment of the present application does not elaborate on this process.
[0173] Figure 4A schematic diagram of a target chart structure data verification process provided by an embodiment of the present application, such as Figure 4 As shown, when verifying the target chart structure data, the first coding feature corresponding to the chart information recorded in the target chart structure data and the second coding feature corresponding to the question text can be determined based on the Embedding model, and then the similarity between the first coding feature and the second coding feature is calculated. After obtaining the similarity, it can be determined whether the similarity meets the preset threshold requirement. If it does, it can be determined that the target chart structure data is correct, and the subsequent steps of generating the target chart according to the target chart structure data can be continued. If the similarity does not meet the preset threshold requirement, the target chart structure data is recorded in the error record table, and the data in the error record table is corrected by manual error correction, and the corrected target chart structure data is used to train the second largest model.
[0174] In an embodiment of the present application, erroneous target graph structure data is corrected, and the corrected data is used to train the second largest model, thereby improving the accuracy of graph structure data generation and eliminating the work of manually constructing a training set, and the constructed training set is in line with the actual task.
[0175] In order to further improve the efficiency of chart generation, based on the above embodiments, in the embodiment of the present application, the processor 102 is specifically configured as follows:
[0176] Filling the target chart structure data into a third prompt word template to obtain a third prompt text;
[0177] Input the third prompt text into the third large model, so that the third large model determines the front-end rendering code corresponding to the target chart structure data according to the requirements of the third prompt text;
[0178] The display 101 is controlled to display the target chart according to the front-end rendering code.
[0179] When generating a target chart according to the target chart structure data and controlling the display 101 to display the target chart, in an embodiment of the present application, a front-end rendering code can be generated based on the third large model without the need for secondary processing by a front-end engineer, thereby further improving the efficiency of chart generation. The third large model may be the same as or different from the first large model and the second large model. In an embodiment of the present application, the target chart structure data may be filled into a third prompt word template to obtain a third prompt text. The subsequent third large model may determine the front-end rendering code corresponding to the target chart structure data based on the requirements of the third prompt text. Exemplarily, the third prompt text may be:
[0180] "You are a front-end web development engineer. Please generate the code for direct front-end rendering based on the input chart data.
[0181] ###Requirement: Only define the data and configuration of the chart, and do not output other irrelevant content.
[0182]
[0183]
[0184]
[0185] After obtaining the front-end rendering code, the processor 102 may control the display 101 to display the target chart according to the front-end rendering code.
[0186] In the embodiment of the present application, the third largest model is used to intelligently generate the front-end rendering code corresponding to the target chart structure data, eliminating the need for manual code writing, thereby improving the efficiency of chart generation.
[0187] In order to improve the accuracy of the second largest model in generating the target chart structure data, in an embodiment of the present application, the second largest model can be completed by fine-tuning training. If the existing large model is used directly to generate the target chart structure data, the format of the chart structure data generated by the large model is single, and the front-end engineer needs to be processed again. Therefore, in an embodiment of the present application, a training set can be pre-constructed, and the open source large model can be trained based on the data in the training set to obtain a large model dedicated to a specific field, that is, the second largest model described in the above embodiments. In an embodiment of the present application, when constructing a training set, a small amount of data set can be manually annotated, and a large model can be generated by a prompt word (prompt), and a large amount of data can be generated by the large model after generation. Manual verification and screening are performed to construct a training set. Using a large model to generate a training set, there is no need to train the model separately, and the data scale can be quickly expanded. A high-quality training set can be obtained through manual verification, which can save a lot of training time and resource costs. In an embodiment of the present application, the prompt word can include instructions + table structure + other requirements + output format + input + output. The following is an example of a statement:
[0188] "You are a chart data expert and need to provide chart structure data that can be directly rendered by front-end developers. Please generate chart structure data according to the following requirements. --- Instructions
[0189] #The following is the definition of the database table structure: ---Table structure
[0190] ##Table name: drivinglicense, driver table, fields are as follows:
[0191] name, string, name
[0192] …
[0193] #When the chart type is a pie chart, you need to calculate the percentage value, and the percentage field is count---other requirements
[0194] #Output the results according to the following different chart types: ---Output format
[0195] ##Chart type: bar chart
[0196] ###The chart structure data is as follows:
[0197]
[0198]
[0199] Figure 5 A schematic diagram of a diagram generation process based on a large model provided in an embodiment of the present application, such as Figure 5 As shown, the chart generation process mainly includes four parts, namely chart type determination, dynamic prompt, error detection and correction, and front-end code generation.
[0200] After obtaining the user's question text, the chart type is first determined. In the embodiment of the present application, a second prompt text can be constructed based on the question text, the chart judgment standard and the second prompt word template, and then the second prompt text is input into the first large model to obtain the target chart type corresponding to the question text.
[0201] After obtaining the target chart type, a dynamic prompt is constructed. In the embodiment of the present application, each pre-saved standard chart information can be obtained, and the target chart information with the highest degree of matching with the question text can be searched in these standard chart information to determine. Based on the target chart information, the question text, the database query results, the chart structure data corresponding to the target chart information, and the first prompt word template, a dynamic prompt, i.e., the first prompt text, is generated. The first prompt text is input into the second largest model that has been pre-trained to obtain the target chart structure data corresponding to the question text output by the second largest model.
[0202] After obtaining the target chart structure data, error detection and correction processing is performed. In the embodiment of the present application, the similarity between the chart information recorded in the target chart structure data and the question text is determined. If the similarity meets the preset threshold requirement, the target chart structure data can be filled into the third prompt word template to obtain the third prompt text. The third prompt text is input into the third large model to obtain the front-end rendering code output by the third large model.
[0203] In the embodiment of the present application, the implementation method of Chain of Thought (CoT) is mainly based on the ability of the large model, and the front-end rendering code is finally generated in combination with the business. The front-end directly renders the chart, which greatly reduces the development cost of the front-end and back-end. The present application improves the accuracy of chart data generation and enhances the user experience.
[0204] In an embodiment of the present application, the chart generation method can support multiple rounds of interactive display of data charts of different dimensions, thereby improving the user-friendliness of multiple rounds of interaction. For example, the question text is: Let's take a look at the trend of the number of registered vehicles in each district and city of ** City in the past three years, and the second round asks: Let's take a look at the data in 2022. Then the result displayed is the trend of the number of registered vehicles in each district and city of ** City in 2022. The above scheme design greatly saves manpower and resources, and provides a new implementation method for presenting charts of database data on the front-end page.
[0205] Figure 6a A diagram showing a diagram provided in an embodiment of the present application, such as Figure 6a As shown, the user's question text is: What is the ** index of ** city from January to June? Figure 6a The user's questions are answered in the form of a dialogue, and the table data is displayed on the right side of the screen (left and right in the figure).
[0206] Figure 6b A diagram showing a diagram provided in an embodiment of the present application, such as Figure 6b As shown, the user's question text is: Query the ** index of ** city from January to June and display it in a bar chart. Figure 6b The user's questions are answered in the form of a dialogue, and the query results are displayed in the form of a bar chart on the right side of the screen (left and right in the figure).
[0207] Figure 7a A diagram showing a diagram provided in an embodiment of the present application, such as Figure 7a As shown, the user's question text is: Query the first indicator of ** city from January to June, and the second indicator is displayed in a bar chart. Figure 7a The user's questions are answered in the form of a dialogue, and the query results are displayed in the form of a bar chart on the right side of the screen (left and right in the figure).
[0208] Figure 7b A diagram showing a diagram provided in an embodiment of the present application, such as Figure 7b As shown in the figure, the user continued to ask questions based on the previous question content, and the current question text is: Let's take a look at the trend of the added value of the primary industry. The user's previous question was to look at the data of a certain dimension, and the current question is the first indicator. Figure 7bThe user's questions are answered in the form of a dialogue, and the query results are displayed in the form of a bar chart on the right side of the screen (left and right in the figure).
[0209] In the embodiment of the present application, the data is multi-dimensionally displayed in a dynamic manner, and a large model is used to generate a chart structure data set. There is no need to train the model separately, and the data scale can be quickly expanded. A high-quality training set is obtained through manual verification, which can save a lot of training time and resource costs. COT reasoning method (understanding the user's chart display form + recalling accurate chart data examples to generate dynamic prompts) improves the overall accuracy. Formulate data output standards, and finally generate front-end rendering code to support direct rendering of charts by the front end, without the need for the front end to adapt the chart data structure. Reduce the traditional development costs of the front and back ends. At the same time, the scheme introduces multiple rounds of fusion, which can support multiple rounds of interactive display of data charts of different dimensions, and improve the user's multi-round interactive friendliness. In addition, in the embodiment of the present application, the rag model is also used to realize that when generating chart structure data, the chart structure data examples of the retrieved standard chart information summary are dynamically introduced to form a dynamic prompt, thereby improving the accuracy of generating chart structure data.
[0210] In the traditional manual coding method, the code is written with customized logic, supporting chart types and asking questions with boundaries. The large model has a strong understanding ability. The advantage of this application is that it can support users to ask various questions and realize multi-dimensional dynamic display of data without the need for engineers to add customized logic for each new question. In addition, the chart generation solution provided by this application can be quickly applied to new scenarios. Even if the system scenario changes, this solution is still applicable, and the workload of adaptation development is relatively small.
[0211] Based on the same inventive concept, the embodiment of the present application also provides a diagram generation method based on a large model. Figure 8 A schematic diagram of a diagram generation process based on a large model provided in an embodiment of the present application, such as Figure 8 As shown, the process includes the following steps:
[0212] S801: If a question text of the user is received, determine a target chart type corresponding to the question text based on a first large model.
[0213] S802: Fill the target chart type, the question text and the database query result corresponding to the question text into the first prompt word template to obtain the first prompt text; input the first prompt text into the second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text, and generates the target chart structure data corresponding to the chart type.
[0214] S803: Generate a target chart according to the target chart structure data, and display the target chart.
[0215] In a possible implementation, determining the target chart type corresponding to the question text based on the first large model includes:
[0216] Filling the question text and chart judgment criteria into the second prompt word template to obtain a second prompt text, wherein the chart judgment criteria is used to describe the applicability of different types of charts;
[0217] The second prompt text is input into the first large model, the first large model analyzes the question text, and determines the target chart type corresponding to the question text according to the applicability of different types of charts in the chart judgment standard.
[0218] In a possible implementation, the method further includes:
[0219] If an instruction to view the chart judgment criteria is received, displaying the chart judgment criteria;
[0220] If an instruction to adjust any chart judgment standard is received, the target content carried in the instruction is obtained, the chart judgment standard is updated using the target content, and the updated chart judgment standard is displayed.
[0221] In a possible implementation, after determining the target chart type corresponding to the question text based on the first large model, and before filling the target chart type, the question text, and the database query result corresponding to the question text into the first prompt word template and obtaining the first prompt text, the method further includes:
[0222] Acquire each pre-saved standard chart information, wherein the standard chart information includes a summary encoding embedding of chart structure data and chart structure data;
[0223] Determine the similarity between the question text and the summary encoding embedding included in each standard chart information respectively;
[0224] According to each similarity and a preset similarity threshold, selecting the target chart information with the highest matching degree with the question text from each standard chart information;
[0225] The step of filling the target chart type, the question text, and the database query result corresponding to the question text into a first prompt word template to obtain a first prompt text includes:
[0226] The target chart type, the question text, the database query result corresponding to the question text, and the chart structure data corresponding to the target chart information are filled into a first prompt word template to obtain a first prompt text; and the second large model is enabled to learn the generation idea of the chart structure data in the target chart information when generating the target chart structure data.
[0227] In a possible implementation manner, the standard chart information also includes a chart type;
[0228] After acquiring each pre-stored standard chart information, and before respectively determining the similarity between the question text and the summary encoding embedding included in each standard chart information, the method further includes:
[0229] According to the chart type in each standard chart information and the target chart type corresponding to the question text, in each standard chart information, the standard chart information inconsistent with the target chart type is eliminated.
[0230] In a possible implementation, after generating the target chart structure data corresponding to the target chart type and before generating the target chart according to the target chart structure data, the method further includes:
[0231] Determine the similarity between the chart information recorded in the target chart structure data and the question text, the chart information including a chart title and a key-value pair corresponding to the data included in the chart;
[0232] If the similarity meets the preset threshold requirement, the subsequent step of generating a target chart according to the target chart structure data is continued.
[0233] In a possible implementation, the method further includes:
[0234] If the similarity does not meet the preset threshold requirement, the target graph structure data and the question text are saved in a generated error record table.
[0235] In a possible implementation, the method further includes:
[0236] If an instruction to modify any target chart structure data in the generation error record table is received, the target chart structure data is modified according to the modified information carried in the instruction, and the second large model is fine-tuned and trained based on the modified generation error record table.
[0237] In a possible implementation, generating a target chart according to the target chart structure data and displaying the target chart includes:
[0238] Filling the target chart structure data into a third prompt word template to obtain a third prompt text;
[0239] Input the third prompt text into the third large model, so that the third large model determines the front-end rendering code corresponding to the target chart structure data according to the requirements of the third prompt text;
[0240] The display is controlled to display the target chart according to the front-end rendering code.
[0241] It should be noted that the process of the chart generation method based on the large model is similar to the processing process of the processor of the display device in the above-mentioned embodiments, and the embodiments of the present application will not be repeated here.
[0242] Based on the same inventive concept, the embodiment of the present application also provides a diagram generating device based on a large model. Fig. 9 A schematic diagram of a diagram generating device based on a large model provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the device comprises:
[0243] A determination module 901 is used for determining a target chart type corresponding to the question text based on a first large model if a question text of the user is received;
[0244] A filling module 902 is used to fill the target chart type, the question text and the database query result corresponding to the question text into a first prompt word template to obtain a first prompt text;
[0245] Generation module 903 is used to input the first prompt text into the second large model, so that the second large model analyzes the question text and the database query results according to the requirements of the first prompt text, and generates target chart structure data corresponding to the chart type; generates a target chart according to the target chart structure data, and displays the target chart.
[0246] In a possible implementation, the determination module 901 is specifically used to fill the question text and chart judgment criteria into a second prompt word template to obtain a second prompt text, wherein the chart judgment criteria are used to describe the applicability of different types of charts; the second prompt text is input into the first large model, the first large model analyzes the question text, and determines the target chart type corresponding to the question text according to the applicability of different types of charts in the chart judgment criteria.
[0247] In a possible implementation, the device further includes:
[0248] A display module 904, configured to display the chart judgment criteria if an instruction to view the chart judgment criteria is received;
[0249] The updating module 905 is used for, if receiving an instruction to adjust any chart judgment standard, obtaining the target content carried in the instruction, using the target content to update the chart judgment standard, and displaying the updated chart judgment standard.
[0250] In a possible implementation, the determination module 901 is further used to obtain each pre-saved standard chart information, wherein the standard chart information includes a summary code embedding of chart structure data and chart structure data; respectively determine the similarity between the question text and the summary code embedding included in each standard chart information; and select the target chart information with the highest matching degree with the question text from each standard chart information according to each similarity and a preset similarity threshold;
[0251] The filling module 902 is specifically used to fill the target chart type, the question text, the database query result corresponding to the question text, and the chart structure data corresponding to the target chart information into the first prompt word template to obtain the first prompt text; and enable the second large model to learn the generation idea of the chart structure data in the target chart information when generating the target chart structure data.
[0252] In a possible implementation manner, the standard chart information also includes a chart type;
[0253] The determination module 901 is further configured to remove standard chart information that is inconsistent with the target chart type in each standard chart information based on the chart type in each standard chart information and the target chart type corresponding to the question text.
[0254] In a possible implementation, the determination module 901 is further used to determine the similarity between the chart information recorded in the target chart structure data and the question text, the chart information including the chart title and the key-value pairs corresponding to the data included in the chart;
[0255] The generating module 903 is further configured to continue to execute the subsequent step of generating a target chart according to the target chart structure data if the similarity meets a preset threshold requirement.
[0256] In a possible implementation manner, the generating module 903 is further configured to save the target graph structure data and the question text into a generation error record table if the similarity does not meet the preset threshold requirement.
[0257] In a possible implementation, the update module 905 is also used to, if receiving an instruction to modify any target chart structure data in the generation error record table, modify the target chart structure data according to the modified information carried in the instruction, and fine-tune the second large model based on the modified generation error record table.
[0258] In a possible implementation, the generation module 903 is specifically used to, if receiving an instruction to modify any target chart structure data in the generation error record table, modify the target chart structure data according to the modified information carried in the instruction, and fine-tune the second large model based on the modified generation error record table.
[0259] Based on the same inventive concept, an embodiment of the present application further provides an electronic device, Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, it includes: a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004;
[0260] The memory 1003 stores a computer program. When the program is executed by the processor 1001, the processor 1001 executes the steps of the large model-based chart generation method described in the above embodiments.
[0261] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 1002 is used for communication between the above electronic device and other devices. The memory may include a random access memory (RAM) and may also include a non-volatile memory (NVM), such as at least one disk storage. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0262] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0263] On the basis of the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program executable by a processor. When the program runs on the processor, the processor implements the steps of the large model-based chart generation method described in the above embodiments.
[0264] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0265] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0266] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0267] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0268] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A display device, characterized in that: The display device comprises a display and a processor: The display is configured to: display a target chart generated for a question text input by a user; The processor is configured to: If a question text of the user is received, determining a target chart type corresponding to the question text based on the first large model; Fill the target chart type, the question text, and the database query result corresponding to the question text into a first prompt word template to obtain a first prompt text; Inputting the first prompt text into the second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text, and generates target chart structure data corresponding to the target chart type; A target chart is generated according to the target chart structure data, and the display is controlled to display the target chart.
2. The display device according to claim 1, characterized in that The processor is specifically configured to: Filling the question text and chart judgment criteria into the second prompt word template to obtain a second prompt text, wherein the chart judgment criteria is used to describe the applicability of different types of charts; The second prompt text is input into the first large model, the first large model analyzes the question text, and determines the target chart type corresponding to the question text according to the applicability of different types of charts in the chart judgment standard.
3. The display device according to claim 2, characterized in that The processor is further configured to: If an instruction to view the chart judgment standard is received, controlling the display to display the chart judgment standard; If an instruction to adjust any chart judgment standard is received, the target content carried in the instruction is obtained, the chart judgment standard is updated using the target content, and the display is controlled to display the updated chart judgment standard.
4. The display device according to claim 1, characterized in that The processor is further configured to: Acquire each pre-saved standard chart information, wherein the standard chart information includes a summary encoding embedding of chart structure data and chart structure data; Determine the similarity between the question text and the summary encoding embedding included in each standard chart information respectively; According to each similarity and a preset similarity threshold, selecting the target chart information with the highest matching degree with the question text from each standard chart information; The processor is specifically configured to: Fill the target chart type, the question text, the database query result corresponding to the question text, and the chart structure data corresponding to the target chart information into a first prompt word template to obtain a first prompt text; The second large model is enabled to learn the generation idea of the chart structure data in the target chart information when generating the target chart structure data.
5. The display device according to claim 4, characterized in that The standard chart information also includes a chart type; and the processor is further configured to: According to the chart type in each standard chart information and the target chart type corresponding to the question text, in each standard chart information, the standard chart information inconsistent with the target chart type is eliminated.
6. The display device according to claim 1, characterized in that The processor is further configured to: Determine the similarity between the chart information recorded in the target chart structure data and the question text, the chart information including a chart title and a key-value pair corresponding to the data included in the chart; If the similarity meets the preset threshold requirement, the subsequent step of generating a target chart according to the target chart structure data is continued.
7. The display device according to claim 6, characterized in that The processor is further configured to: If the similarity does not meet the preset threshold requirement, the target graph structure data and the question text are saved in a generated error record table.
8. The display device according to claim 7, characterized in that The processor is further configured to: If an instruction to modify any target chart structure data in the generation error record table is received, the target chart structure data is modified according to the modified information carried in the instruction, and the second large model is fine-tuned and trained based on the modified generation error record table.
9. The display device according to claim 1, characterized in that The processor is specifically configured to: Filling the target chart structure data into a third prompt word template to obtain a third prompt text; Input the third prompt text into the third large model, so that the third large model determines the front-end rendering code corresponding to the target chart structure data according to the requirements of the third prompt text; The display is controlled to display the target chart according to the front-end rendering code.
10. A diagram generation method based on a large model, characterized in that: The method comprises: If a question text of the user is received, determining a target chart type corresponding to the question text based on the first large model; Fill the target chart type, the question text, and the database query result corresponding to the question text into a first prompt word template to obtain a first prompt text; input the first prompt text into a second large model, so that the second large model analyzes the question text and the database query result according to the requirements of the first prompt text to generate target chart structure data corresponding to the chart type; A target chart is generated according to the target chart structure data, and the target chart is displayed.