CN-122018898-A - Visual cockpit generation method and device based on natural language instruction
Abstract
The invention discloses a visual cockpit generation method and device based on natural language instructions, and relates to the technical field of data processing. The method comprises the steps of receiving a natural language instruction which is input by a user and contains factors such as a data theme and a visual requirement, invoking an artificial intelligence algorithm based on a large language model to carry out semantic analysis and entity extraction on the instruction, constructing a structured instruction object containing operation intention and parameter set, matching a candidate component set in a component registry based on the object and verifying user permission, injecting the parameters into the component and generating cockpit configuration metadata through an automatic layout algorithm, creating a cockpit instance based on the metadata, dynamically mounting the component through a front-end rendering frame and triggering data loading. The invention can reduce the construction threshold of the cockpit, shorten the development period and realize the quick generation of the semantic-driven personalized cockpit.
Inventors
- TIAN XUE
- LIU GUANGJIE
- WU MIN
- DONG SHAOJIANG
- Yan Zelai
- ZHU RUI
Assignees
- 重庆数字资源集团有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251222
Claims (10)
- 1. A method for generating a visual cockpit based on natural language instructions, the method comprising: Receiving a natural language instruction input by a user on a console, wherein the natural language instruction at least comprises one or more elements of a data theme, a time range, a geographic range and a visual requirement; Invoking a pre-integrated artificial intelligence algorithm based on a large language model, carrying out semantic analysis and entity extraction on the natural language instruction, and constructing a standardized structured instruction object, wherein the structured instruction object comprises an operation intention field and a parameter set field; based on the structured instruction object, matching and searching are carried out in a mapping table of a preset component registry, a candidate component set meeting the condition is screened out according to the mapping relation between the visual requirement and the component capability, and the access right of the current user to the candidate component set is verified; injecting parameter set fields in the structured instruction object into the candidate component set, calculating the coordinate position and the size of each component on a large screen canvas through a preset automatic layout algorithm, and generating cockpit configuration metadata; and creating a cockpit instance based on the cockpit configuration metadata, dynamically mounting the candidate component set through a front-end rendering frame, triggering a data interface of each component to carry out real-time data loading, and completing the generation of the visual cockpit.
- 2. The method for generating a visual cockpit based on natural language instructions according to claim 1, further comprising the step of establishing a component registry and an instruction binding relationship before receiving the natural language instructions about generating the cockpit input by a user at a console, wherein the step of establishing the component registry and the instruction binding relationship comprises: receiving an assembly package uploaded by a developer, wherein a visual definition file, a data interface specification and an interactive logic script are packaged in the assembly package; Decompressing and structuring the component package, extracting basic attributes, supported instruction sets and dependency relations of the component, and disassembling the component into a reusable unit comprising a data acquisition logic unit, a rendering template unit and an interactive behavior unit; Registering the analyzed component information to a back-end database, and distributing a unique component version number, wherein the component version number is used for supporting rollback and gray release of a component; And establishing a mapping relation table of the natural language instruction and the component function, wherein the mapping relation table is stored in a form of a triplet of the instruction intention, the component identification and the parameter template and is used for defining how the natural language instruction triggers specific behavior or attribute change of a specific component.
- 3. The method of claim 2, wherein in the step of disassembling the component into a reusable unit comprising a data acquisition logic unit, a rendering template unit, and an interactive behavior unit, the reusable unit comprises: the data adapter unit is used for packaging unified data acquisition logic, supporting the docking of back-end API interfaces with different formats and converting the data formats; the view rendering unit is used for defining a visual presentation template of the component and supporting dynamic mounting and style rendering based on the front end frame; The event interaction unit is used for defining interaction behavior logic of clicking drill-down, linkage refreshing and state switching of the component; The instruction response unit is used for registering and processing instruction messages from the console, and defining callback processing logic of the component for different types of structured instructions; And automatically identifying the data adapter unit, the view rendering unit, the event interaction unit and the instruction response unit by analyzing the directory structure and the configuration file of the component package, and establishing indexes so that logic units of the same type can be shared and multiplexed among different components.
- 4. The visual cockpit generation method of claim 1, wherein invoking a pre-integrated artificial intelligence algorithm based on a large language model, performing semantic parsing and entity extraction on the natural language instruction, and constructing a standardized structured instruction object comprises: Invoking a large language model of localized deployment or cloud by using an artificial intelligence development framework, and inputting a natural language instruction of a user into the large language model as a prompt word; executing the intention recognition task, and judging which type of operation targets in the process of generating a new cockpit, modifying the existing assembly style, analyzing the data drill down or controlling the interaction behavior belong to the operation targets of the user; performing entity extraction tasks, and extracting key entity information from the natural language instructions, wherein the key entity information comprises a service field serving as a data subject, a time window serving as a filtering condition, a geographic area serving as a space dimension and a desired chart type; mapping the identified operation intention into a standard operation code, filling the extracted key entity information into a predefined JSON format template, and generating the structured instruction object; the structured instruction object includes a unique action identifier, a theme parameter, a timeframe object, an area tag, and a component list array containing specific chart types and data source bindings.
- 5. The method for generating a visual cockpit based on natural language instructions according to claim 1, wherein based on the structured instruction object, matching search is performed in a mapping table of a preset component registry, and a candidate component set meeting the condition is screened out according to the mapping relation between the visual requirement and the component capability, which comprises the following steps: Traversing the component list array in the structured instruction object to obtain a chart type identifier corresponding to each visual requirement; Querying all available component versions supporting the chart type identification in the component registry, and checking metadata of each available component to confirm whether data interface parameters of the available component are compatible with data source binding information in the structured instruction object; Invoking an authority control interface, filtering the compatible available components based on the role identification of the current user and the information of the affiliated tenant, and eliminating components which are not authorized to be accessed or used by the user; When a plurality of components meeting the conditions exist, selecting the optimal component as a candidate component according to a preset priority rule or historical use frequency of the component, and acquiring a front-end rendering path and an API interface specification of the candidate component from the component registry.
- 6. The method for generating a visual cockpit based on natural language instructions according to claim 1, wherein the steps of injecting parameter set fields in the structured instruction object into the candidate component set, and calculating the coordinate position and the size of each component on a large screen canvas through a preset automatic layout algorithm comprise: Analyzing the configuration item of each component in the candidate component set, dynamically injecting the time range, the geographic area and the business theme parameters in the structured instruction object into the data request parameters of the component to form an instantiation configuration parameter; initializing a grid system of a large screen canvas, and planning a layout area of each component by adopting a grid layout algorithm according to the number and the type weight of the candidate components; Marking a core index class component or a thermodynamic diagram class component as a main view, distributing a significant area at the center or the top of the large screen canvas, and distributing an auxiliary trend diagram or list class component to a side rail or a bottom area; Calculating the initial coordinate, crossing line number and crossing column number of each component in the grid system, and generating cockpit configuration metadata comprising layout information, component reference paths and instantiation configuration parameters; and generating a unique cockpit instance ID, and storing the cockpit configuration metadata and the cockpit instance ID in an instance management database in association to realize configuration isolation among different generation tasks.
- 7. The method for generating a visual cockpit based on natural language instructions of claim 6 wherein the step of managing cockpit instances includes: deriving a plurality of independent cockpit instances based on a large screen template, and distributing independent runtime memory space and state storage areas for each instance; When an instance is generated, an instance-level access control strategy is generated according to the attribute information of the current user and the limiting conditions in the natural language instruction, so that data and authority among the instances are isolated; Monitoring the running state of each instance in real time, and when the idle time of the instance exceeds a preset threshold or a forced offline instruction is received, releasing the resources occupied by the instance and storing the current snapshot state; and carrying out large-screen back display based on the historical instance snapshot, and reloading and recovering the state of the cockpit instance at a specific time point by inquiring the historical instruction record.
- 8. The visual cockpit generation method based on natural language instructions according to claim 1, further comprising the step of interactively controlling the cockpit by natural language instructions after the visual cockpit is generated, comprising: activating an instruction monitoring state, and receiving a control natural language instruction input by a user aiming at a current cockpit instance in real time; analyzing the control natural language instruction by using the artificial intelligence algorithm, and identifying a control action type and a control target parameter, wherein the control action type comprises component style switching, map area positioning, data screening condition changing and component implicit and explicit control; Locating a currently active cockpit instance, and searching an instance reference of a target component according to an analysis result; calling a preset instruction response function in the target assembly, transmitting the control target parameters into the instruction response function, triggering view update or data reload in the target assembly, and realizing end-to-end interaction control; and recording the analyzed control instruction and the execution result to an audit library for history backtracking and model optimization.
- 9. The method for generating a visual cockpit based on natural language instructions according to claim 1, wherein the method further comprises the step of adopting an RBAC and ABAC mixed authority control model to ensure the safety of the generating process, and the specific steps comprise: Based on the RBAC model, verifying whether a user has role rights to generate a cockpit, access a specific component library or execute a control instruction; based on an ABAC model, dynamically calculating a data access strategy according to the attribute of a user, the current environment attribute and the data sensitivity attribute related in the natural language instruction, and limiting the user to only generate and view service data in the jurisdiction of the user; When the natural language instruction is analyzed, compliance filtering is carried out on instruction content, and natural language instructions containing sensitive words or override requests are intercepted; and carrying out log record on component call, data request and instruction execution operation in the whole process of cockpit generation, and carrying out encryption storage on log data to support security audit.
- 10. A visual cockpit generation device based on natural language instructions, the device comprising: the instruction receiving module is used for receiving a natural language instruction about the generation of the cockpit, which is input by a user at the control console, wherein the natural language instruction at least comprises one or more elements of a data theme, a time range, a geographic range and a visual requirement; The semantic analysis module is used for calling a pre-integrated artificial intelligence algorithm based on a large language model, carrying out semantic analysis and entity extraction on the natural language instruction, and constructing a standardized structured instruction object, wherein the structured instruction object comprises an operation intention field and a parameter set field; the component matching module is used for carrying out matching search in a mapping table of a preset component registry based on the structured instruction object, screening out a candidate component set meeting the condition according to the mapping relation between the visual requirement and the component capability, and verifying the access right of the current user to the candidate component set; The layout generation module is used for injecting parameter set fields in the structured instruction object into the candidate component set, calculating the coordinate position and the size of each component on a large screen canvas through a preset automatic layout algorithm, and generating cockpit configuration metadata; And the rendering execution module is used for creating a cockpit instance based on the cockpit configuration metadata, dynamically mounting the candidate component set through a front-end rendering frame, triggering the data interfaces of the components to carry out real-time data loading, and completing the generation of the visual cockpit.
Description
Visual cockpit generation method and device based on natural language instruction Technical Field The invention relates to the technical field of data processing, in particular to a visual cockpit generation method and device based on natural language instructions. Background With the comprehensive promotion of enterprise digital transformation and smart city construction, mass data are generated in the production, management and management decision process of each industry. In order to intuitively and efficiently monitor business states and assist decisions, a visual cockpit (Dashboard) becomes an indispensable tool in the fields of enterprises, finance, manufacturing, and the like. These cabs typically integrate key performance indicators (Key Performance Indicators, KPIs), charts, maps, and real-time video streams for panoramic presentation of business scenarios. Currently, cockpit construction relies primarily on traditional business intelligence (Business Intelligence, BI) platforms or low-code development tools. The prior art generally adopts a construction mode of 'preset template + manual dragging component + static data binding'. The developer or the data analyst needs to design the page layout in advance according to the requirements of the business department, manually select visualization components such as ECharts, antV and the like, and write a structured query language (Structured Query Language, SQL) or an application program interface (Application Programming Interface, API) for data docking. However, the prior art exposes significant limitations in facing the current increasingly complex and dynamically changing business needs. The prior art focuses on "static configuration" rather than "dynamic generation". The production process of the cockpit is highly dependent on professional technicians, and has a higher technical threshold. Business personnel cannot directly convert business thinking of 'I want to see data of a certain area in a certain period' into a visual result in real time. Once the business requirement is changed (such as newly adding analysis dimension or adjusting chart type), a long process of 'requirement communication-redevelopment-test release' is needed, the response period is long, and the requirement of agile decision is difficult to adapt. In addition, existing interaction methods are mainly based on mechanical operations of menus and clicks, and lack understanding ability of natural language. The system can not automatically understand and assemble an interface which accords with the personalized intention of the user, so that the cockpit tends to be uniformly, personalized service of thousands of people and thousands of sides is difficult to realize, and the rapid release of the data value is severely restricted. Disclosure of Invention The invention provides a visual cockpit generation method and device based on natural language instructions, which solve the problems of high cockpit construction threshold, long response period and single interaction mode in the prior art. In order to achieve the above purpose, the embodiment of the present invention adopts the following technical scheme: In a first aspect, an embodiment of the present invention provides a method for generating a visual cockpit based on a natural language instruction, where the method includes: receiving a natural language instruction about generating a cockpit input by a user at a console, wherein the natural language instruction at least comprises one or more elements of a data theme, a time range, a geographic range and a visual requirement; invoking a pre-integrated artificial intelligence algorithm based on a large language model, carrying out semantic analysis and entity extraction on a natural language instruction, and constructing a standardized structured instruction object, wherein the structured instruction object comprises an operation intention field and a parameter set field; Based on the structured instruction object, matching and searching are carried out in a mapping table of a preset component registry, candidate component sets meeting the conditions are screened out according to the mapping relation between the visual requirements and the component capabilities, and the access rights of the current user to the candidate component sets are verified; injecting parameter set fields in the structured instruction object into a candidate component set, and calculating the coordinate position and the size of each component on a large screen canvas through a preset automatic layout algorithm to generate cockpit configuration metadata; Based on the cockpit configuration metadata, a cockpit instance is created, a candidate component set is dynamically mounted through a front-end rendering frame, and the data interfaces of the components are triggered to carry out real-time data loading, so that the generation of the visual cockpit is completed. Preferably, before receiving a natural langua