Website generation method and device, medium and product

By obtaining the SQL files required by users, creating a data model and using the FreeMarker engine and AI code generation engine to generate source code, it solves the problem that existing technology cannot generate static websites with data management functions, and realizes website generation suitable for actual needs. , supports dynamic data management and reduces repetitive development.

CN118642691AInactive Publication Date: 2024-09-13BEIJING PROINSIGHT TECH

Patent Information

Application Number
CN202410277044.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-12
Publication Date
2024-09-13
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology cannot generate a static website with data management functions and cannot meet users' needs for dynamic data management.

Method used

By obtaining the SQL file required by the user, create a data model, use the FreeMarker engine and AI code generation engine controller to generate source code, compile the installation program, send it to the server to obtain the interface document and URL, and display the packaged source code on the human-computer interaction terminal and interface documents to implement the data management function of the website.

Benefits of technology

It realizes the generation of websites with data management functions suitable for actual needs based on user needs. It supports common business logic such as additions, deletions, modifications, and searches, reducing repetitive development work. Users can adjust the data model through dialogue with AI to achieve the best results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642691A
    Figure CN118642691A
Patent Text Reader

Abstract

The invention discloses a website generation method and device, a medium and a product, and relates to the technical field of website generation. The method comprises the steps of obtaining an SQL file corresponding to a to-be-built software engineering project name; respectively creating a data model corresponding to each SQL statement packet; publishing the plurality of data models into a database to obtain an overall database model; substituting the overall database model into a FreeMarker template by utilizing a FreeMarker engine, and performing rendering processing to obtain a source code corresponding to the name of the to-be-built software engineering project; compiling the source code by using an AI code generation engine controller to generate an installation program result; sending the installation program result to a server, and obtaining an interface document and a website; according to the method, the website with the data management function can be generated by constructing the overall database model and the FreeMarker template.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of website generation, and in particular to a website generation method, device, medium and product. Background Art

[0002] The website www.pineapplebuilder.com (pineapplebuilde for short) allows users to upload their company's icon, then select an AI template, customize colors and fonts, and proceed to the next step: AI generates static website content. Pineapplebuilder allows users to select a static web page template, and the gpt3 / gpt4 interface generates text and images to fill in the template, and finally generates static website code. It cannot generate a website with data management functions. Summary of the invention

[0003] The purpose of the present invention is to provide a website generation method, device, medium and product, which can generate a website with data management function.

[0004] To achieve the above object, the present invention provides the following solutions:

[0005] A website generation method, the method comprising:

[0006] Obtain an SQL file corresponding to the name of the software engineering project to be built; the SQL file includes an SQL statement package corresponding to each function name in the function list; the multiple function names in the function list are determined by the AI ​​code generation engine controller according to user requirements after receiving a product manager template with user requirements added thereto;

[0007] Create the data model corresponding to each SQL statement package respectively;

[0008] Publishing the plurality of said data models into a database to obtain an overall database model;

[0009] Use the FreeMarker engine to substitute the overall database model into the FreeMarker template and render it to obtain the source code corresponding to the name of the software engineering project to be built;

[0010] Compile the source code using the AI ​​code generation engine controller to generate the installer result;

[0011] The installation program result is sent to the server, and an interface document and a website are obtained; the interface document and the website are generated by the server according to the installation program result.

[0012] Optionally, after using the FreeMarker engine to substitute the entire database model into the FreeMarker template and render it to obtain the source code corresponding to the name of the software engineering project to be built, it also includes:

[0013] Package the source code corresponding to the name of the software engineering project to be built to obtain the packaged source code.

[0014] Optionally, after packaging the source code corresponding to the name of the software engineering project to be built and obtaining the packaged source code, it also includes:

[0015] The packaged source code is displayed on the human-computer interaction terminal.

[0016] Optionally, after sending the installation program result to the server and obtaining the interface document and the website, the method further includes:

[0017] The interface document and the URL are displayed on the human-computer interaction terminal, and the website corresponding to the URL is tested.

[0018] Optionally, after trial running the website corresponding to the URL, the method further includes:

[0019] After the trial run time reaches a preset time threshold, the computing resources of the AI ​​code generation engine controller are released.

[0020] A computer device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the website generation method.

[0021] A computer-readable storage medium stores a computer program, which implements the above-mentioned website generation method when executed by a processor.

[0022] A computer program product includes a computer program, and when the computer program is executed by a processor, the website generation method is implemented.

[0023] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0024] The purpose of the present invention is to provide a website generation method, device, medium and product. The website function generated by AI according to natural language is not a one-time generation and cannot be modified. The data model can be adjusted by continuous dialogue with AI to achieve the best model, thereby generating a website that meets actual needs and has data management functions. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 A flow chart of a website generation method provided in Example 1 of the present invention;

[0027] Figure 2 A diagram showing the division of the first module of the website generation method provided in Example 1 of the present invention;

[0028] Figure 3 This is a diagram of the overall technical architecture provided by Example 1 of the present invention;

[0029] Figure 4 A diagram showing the division of the second module of the website generation method provided in Example 1 of the present invention;

[0030] Figure 5 A schematic diagram of a website generation method provided in Embodiment 1 of the present invention;

[0031] Figure 6 A schematic diagram of a data model provided in Example 1 of the present invention;

[0032] Figure 7 A schematic diagram of a first chat room page provided in Example 1 of the present invention;

[0033] Figure 8 The Java and front-end code generation schematic diagram provided in Example 1 of the present invention;

[0034] Fig. 9 A schematic diagram of releasing resources provided in Example 1 of the present invention;

[0035] Fig.10 A schematic diagram of a monitoring and publishing channel provided in Example 1 of the present invention;

[0036] Fig.11 This is a schematic diagram of a second chat room page provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The purpose of the present invention is to provide a website generation method, device, medium and product, which can generate a website with data management function.

[0039] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0040] Example 1

[0041] like Figure 1 As shown, a website generation method in this embodiment includes:

[0042] Step 101: Obtain the SQL file corresponding to the name of the software engineering project to be built. The SQL file includes a SQL statement package corresponding to each function name in the function list. The multiple function names in the function list are determined by the AI ​​code generation engine controller according to user needs after receiving the product manager template with user needs added.

[0043] Step 102: Create a data model corresponding to each SQL statement package.

[0044] Step 103: Publish multiple data models to the database to obtain an overall database model.

[0045] Step 104: Use the FreeMarker engine to substitute the overall database model into the FreeMarker template and render it, and obtain the source code corresponding to the name of the software engineering project to be built.

[0046] Step 105: Use the AI ​​code generation engine controller to compile the source code to generate an installation program result.

[0047] Step 106: Send the installation program result to the server, and obtain the interface document and website. The interface document and website are generated by the server according to the installation program result.

[0048] After step 104, the method further includes:

[0049] Step 107: Pack the source code corresponding to the name of the software engineering project to be built to obtain the packaged source code.

[0050] Step 108: Display the packaged source code on the human-computer interaction terminal.

[0051] After step 106, the method further includes:

[0052] Step 109: Display the interface document and URL on the human-computer interaction terminal, and test-run the website corresponding to the URL.

[0053] After step 106, the method further includes:

[0054] Step 1010: After the trial run time reaches a preset time threshold, the computing resources of the AI ​​code generation engine controller are released.

[0055] The following is a specific description of a website generation method provided by this embodiment. Figure 2-Figure 4 In this embodiment, natural language is used to generate a project website that supports addition, deletion, modification and query through AI. The technical architecture is divided into three parts: a chat room, an AI code generation engine and an AI interface proxy service; the chat room is mainly responsible for receiving user input requirements, displaying feedback on the code generation process, and outputting generation results. The AI ​​code generation engine receives the natural language requirements sent by the chat room, calls the AI ​​interface proxy service according to the instructions to obtain structured data from the AI ​​platform, converts the structured data into requirement documents, data models, codes, and deployment programs, and feeds back the intermediate products of the code generation process, providing available website links, source codes, and interface documents. The AI ​​interface proxy service receives the prompt words delivered by the AI ​​code generation engine, and calls the OpenAi, Wenxin Yiyan, and huggingface large model interfaces respectively according to the prompt words and settings, and extracts the result information after obtaining the returned results.

[0056] like Figure 5 , the specific steps of this embodiment include:

[0057] Step 1 generates a data model according to the requirements. Based on the detailed functional point requirements, the AI ​​code generation engine controller adds prompt words to each requirement to play the role of a database designer and specifies the table name naming rules. After obtaining the results of the constructed prompt words through the AI ​​interface, the SQL statement for creating the data model is extracted as the result.

[0058] The implementation logic of step 1: Generate database name and table prefix: randomly generate a non-repeating 6-digit lowercase alphanumeric string. If it is repeated, it will be generated until it is not repeated. The generated 6-digit non-repeating string is used as the database name and table prefix; generate prompt words for text to SQL and return the result; extract SQL, the program extracts the SQL of each table through regular expressions; describe the requirements based on the prompt words for generating the relationship between tables and return the result; send each function point to AI in the role of database designer, and AI generates a single table structure according to the requirements. At the same time, AI is required to design the relationship between tables according to the overall system requirements and context, and finally write all table structures into the database. The result of step 1 is a set of table creation statements for all function points, as well as the database name and table prefix.

[0059] Step 2 generates a user role permission data model. According to the table prefix obtained in step 1, replace the variable in the pre-built-in user, role, menu, and permission table structure with the table prefix obtained in step 1 to obtain the user role permission data model.

[0060] The data model structure is as follows: one user corresponds to multiple roles, one role has multiple users, one role has multiple menus, one menu can be authorized to multiple roles, one menu contains multiple permissions, and one permission can be authorized to multiple menus.

[0061] After writing to the database from step 1, query all table names from the database, build the URL for user access, add, delete, modify, query, import and export based on the table name, and insert the URL into the permission table.

[0062] Then, the multiple function point names obtained from step 2 are inserted into the menu table as multiple menu items, and the function points in the menu table are associated with the permissions in the permission table.

[0063] In the role table, an administrator role is created by default, and all menus are granted to this role; in the user table, a user is created by default and granted the administrator role. By combining step 2 with step 1, a complete data model is obtained, such as Figure 6 .

[0064] Step 3 publishes the SQL statement result of the complete data model of step 2 to the chat room for users to download; when the chat room enters the data model generation phase, it will monitor the data model channel, and when it receives the partial SQL statement returned by the backend, it will be displayed as text until the backend outputs the complete SQL statement, and then use the SQL beautification tool to beautify the SQL statement to make it more beautiful. At the same time, through the output blob binary technology of HTML5, the SQL is spliced ​​into a file, and when the user clicks, the SQL file can be downloaded, such as Figure 7 .

[0065] Publish the data model corresponding to the SQL statement results of all step 2 to the database to obtain the entire database model result;

[0066] Implementation:

[0067] Connect to the database; get the database name according to step 1 and create the database; create a local user with the database name as the user name and grant the ownership of the database to the user; separate SQL statements by commas or carriage returns; execute SQL statements one by one; based on the result of step 4, generate a complete project source code result through the data model + template.

[0068] Implementation method: Create a data source for the code generation project, insert the database name in step 1 and the user information created in step 4 into the database; query the maximum service port number currently in use, +1 as the port number for this project; create a code generation project, write the data source information, the project name in step 2, the table prefix in step 1, the database name as the project ID, and the database name as part of the code generation path into the project information table; use the FreeMarker engine to substitute the data model generated in step 4 into the pre-made FreeMarker template, and render the template to generate the source code for the corresponding project; website = data model + template + business logic.

[0069] The present invention mainly realizes the generation of websites integrating common business logic to reduce a large amount of repetitive development work. Special businesses only need to add code separately on this basis. Common business logic is: search list according to table fields and types, add entities, modify entities, delete entities in batches, import Excel, export Excel, generate code, add comments, generate corresponding interface documents, and have simple user role permission verification.

[0070] like Figure 8 , step 5 generates all java and front-end codes in the specified directory.

[0071] Based on the result of step 5, the source code is packaged through the command line, and a source code link is generated and provided to the chat room for users to download.

[0072] Implementation method: Use the project ID as part of the path, and use the compression command to package all Java and front-end codes into a zip package; name the zip package according to <uuid>.zip, where uuid is a random unique string variable; put the zip package in a place where users can download it. After packaging, notify the front end to display the download address; based on the result of step 4, the AI ​​code generation engine controller compiles the source code to generate the installation program result.

[0073] Implementation method: Use the project ID as part of the path, enter the source code path, execute the mvn command to compile and run the program; after execution, use a timer to check every 1 second whether the login page is accessible. When it is accessible, notify the front end to allow the user to access.

[0074] The deployment program compiles and packages the generated code and deploys it to a secure and isolated server to run, ensuring that it does not affect the code generation platform and automatically releases resources.

[0075] Based on the result of step 7, the generated data is published to the designated server to generate accessible interface documents and URL results.

[0076] Implementation method: Read project information to obtain project port number; interface document address: http: / / ip:project port number / docs / ; access website address: http: / / ip:project port number / login.html; download source code address: http: / / AI code generation engine controller server domain name / dl / <uuid>.zip.

[0077] like Figure 9-10 Based on the result of step 8, information is returned through the chat room after the release is completed and provided to users for access; the chat room monitors the release channel during the release phase and displays the entire release process. When the backend notifies that one is completed, it is checked.

[0078] like Fig.11 Based on the result of step 8, 20 minutes after the trial is completed, the AI ​​code generation engine controller will automatically release resources through the timer control; implementation method: each generated application has a unique port number, which starts from 7000 and increases by 1 each time it is generated. The timer finds the process number corresponding to the application through the command line netstat-npl|grep port number, and then kills the process through the kill process number to release computing resources.

[0079] Example 2

[0080] A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a website generation method in embodiment 1.

[0081] Example 3

[0082] A computer-readable storage medium stores a computer program, which implements the steps of a website generation method in embodiment 1 when executed by a processor.

[0083] Example 4

[0084] A computer program product includes a computer program, which implements the steps of a website generation method in embodiment 1 when executed by a processor.

[0085] Example 5

[0086] A computer device, which may be a database. The computer device includes a processor, a memory, an input / output interface (I / O for short) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store pending transactions. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a website generation method in Example 1 is implemented.

[0087] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0088] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present invention may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided by the present invention may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.

[0089] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0090] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.< / uuid> < / uuid>

Claims

1. A website generation method, characterized in that: The method comprises: Obtain an SQL file corresponding to the name of the software engineering project to be built; the SQL file includes an SQL statement package corresponding to each function name in the function list; the multiple function names in the function list are determined by the AI ​​code generation engine controller according to user requirements after receiving a product manager template with user requirements added thereto; Create the data model corresponding to each SQL statement package respectively; Publishing the plurality of said data models into a database to obtain an overall database model; Use the FreeMarker engine to substitute the overall database model into the FreeMarker template and render it to obtain the source code corresponding to the name of the software engineering project to be built; Compile the source code using the AI ​​code generation engine controller to generate the installer result; The installation program result is sent to the server, and an interface document and a website are obtained; the interface document and the website are generated by the server according to the installation program result.

2. A website generation method according to claim 1, characterized in that: After using the FreeMarker engine to substitute the overall database model into the FreeMarker template and render it, and obtaining the source code corresponding to the name of the software engineering project to be built, it also includes: Package the source code corresponding to the name of the software engineering project to be built to obtain the packaged source code.

3. A website generation method according to claim 2, characterized in that: After packaging the source code corresponding to the name of the software project to be built and obtaining the packaged source code, it also includes: The packaged source code is displayed on the human-computer interaction terminal.

4. A website generation method according to claim 1, characterized in that: After sending the installation program result to the server and obtaining the interface document and website, it also includes: The interface document and the URL are displayed on the human-computer interaction terminal, and the website corresponding to the URL is tested.

5. A website generation method according to claim 1, characterized in that: After trial operation of the website corresponding to the URL, it also includes: After the trial run time reaches a preset time threshold, the computing resources of the AI ​​code generation engine controller are released.

6. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a website generation method according to any one of claims 1 to 5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, a website generation method according to any one of claims 1 to 5 is implemented.

8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, a website generation method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Code generation method and device, electronic equipment and storage medium

    CN114741070A

  • Method and device for automatically generating codes and storage medium

    CN115857914A

  • Dynamic station building method and system based on generative AI

    CN116991408A

  • Code generation and compiling deployment method, platform and equipment based on AI large model

    CN117008923A

Cited By

  • Electromechanical product aided design method based on generative large model

    CN118673634A