Agent-based page generation method and device, electronic equipment and storage medium

By dynamically generating pages using intelligent agents, the problem of insufficient page generation flexibility in existing technologies is solved, enabling low-cost and rapid response to page change requests and improving user experience.

CN122173074APending Publication Date: 2026-06-09BEIJING QIYI CENTURY SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING QIYI CENTURY SCI & TECH CO LTD
Filing Date
2026-02-24
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, page generation methods are not very flexible when content modules, layouts, or interaction scenarios change, resulting in high page generation costs and difficulty in quickly responding to change requirements.

Method used

A page generation method based on intelligent agents is adopted. It uses a large language model to parse page type and context information, generates task call plans for content MCP tools and layout MCP tools, dynamically adjusts content modules and layout, generates structured page build packages, and renders the target page on the front end.

Benefits of technology

It eliminates the need for frequent manual adjustments when content modules, layouts, or interaction scenarios change, reducing the cost of generating pages and improving responsiveness and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173074A_ABST
    Figure CN122173074A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a page generation method and device based on an agent, an electronic device and a storage medium. The method is applied to a server deployed with a large language model, and includes: receiving a page loading request initiated by a front end, the page loading request including a page type and context information of a page to be loaded; inputting the page type and the context information into the large language model to obtain a tool calling plan; executing a task calling plan of a content MCP tool according to the tool calling plan to obtain content module data of the page to be loaded, and executing a task calling plan of a layout MCP tool to generate layout description information of the page to be loaded; and generating a structured page construction package of a target page based on the content module data and the layout description information, so that the front end renders the target page based on the structured page construction package. By applying the embodiments of the present application, the cost of generating a page when a content module, a layout or an interactive scenario changes can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device and storage medium for generating pages based on intelligent agents. Background Technology

[0002] With the rapid development of online content platforms, homepages, detail pages, and special topic pages on personal computers (PCs) are becoming increasingly complex, containing various content modules such as recommendation slots, rankings, channel cards, and activity modules.

[0003] In related technologies, page construction heavily relies on front-end static configuration or back-end templates, with each content module directly bound to fixed interfaces, parameters, and layout templates. However, in today's increasingly complex interactive scenarios, this method of page generation lacks flexibility and struggles to respond quickly and cost-effectively to changes in content modules, layouts, or interactive scenarios, thus increasing the cost of generating pages when changes occur. Summary of the Invention

[0004] The purpose of this application is to provide a page generation method, apparatus, electronic device, and storage medium based on intelligent agents, so as to reduce the cost of generating pages when content modules, layouts, or interaction scenarios change. The specific technical solution is as follows:

[0005] In a first aspect of this application, an agent-based page generation method is provided, applied to a server, the server having deployed a large language model, the method comprising:

[0006] Receive a page loading request initiated by the front end, wherein the page loading request includes the page type and context information of the page to be loaded, and the context information includes user information related to the page to be loaded;

[0007] The page type and the user information are input into the large language model to obtain the tool invocation plan output by the large language model. The tool invocation plan includes the task invocation plans of the Content Model Context Protocol (MCP) tool and the typography MCP tool.

[0008] According to the tool invocation plan, the task invocation plan of the content MCP tool is executed to obtain the content module data of the page to be loaded, and the task invocation plan of the layout MCP tool is executed to generate the layout description information of the page to be loaded;

[0009] A structured page building package for the target page is generated based on the content module data and the layout description information, and the structured page building package is sent to the front end so that the front end can render the target page based on the structured page building package.

[0010] In one possible embodiment, the context information further includes terminal device information related to the page to be loaded; the step of inputting the page type and the user information into the large language model to obtain the tool invocation plan output by the large language model includes:

[0011] The page type, the terminal device information, and the user information are input into the large language model to obtain the tool invocation plan output by the large language model.

[0012] In one possible embodiment, the user information includes user instruction information and / or user behavior events; the user instruction information includes natural language description information input by the user in a search scenario or a dialogue scenario; the user behavior events include browsing behavior that represents the user's content browsing preferences, interactive behavior that represents the user's content interest tendencies, and skipping behavior that represents the user's content rejection preferences.

[0013] In one possible embodiment, the step of executing the task invocation plan of the layout MCP tool according to the tool invocation plan to generate the layout description information of the page to be loaded includes:

[0014] Receive the content module data returned by the content MCP tool;

[0015] Based on the layout MCP tool, the content module data, and the context information, the layout description information of the page to be loaded is generated.

[0016] In one possible embodiment, generating the layout description information of the page to be loaded based on the layout MCP tool, the content module data, and the context information includes:

[0017] Based on the layout MCP tool, the content module data, and the context information, the optimal layout template is matched from multiple preset rule knowledge bases, and the parameters of each content module in the optimal layout template are generated. The different preset rule knowledge bases record the priority of each preset layout template corresponding to different types of context information.

[0018] Based on the optimal layout template and the parameters of each content module, a layout node tree of the page to be loaded is generated, and the layout description information of the page to be loaded is obtained.

[0019] In one possible embodiment, the method further includes:

[0020] Determine whether the total number of content modules in the layout node tree is less than a preset number;

[0021] If yes, then a preset layout template is selected from the preset rule knowledge base as the optimal layout template; otherwise, then the step of generating a structured page building package for the target page based on the content module data and the layout description information is executed, so that the front end can render the target page based on the structured page building package.

[0022] In a second aspect of this application, an agent-based page generation apparatus is also provided, the apparatus comprising:

[0023] A receiving module is used to receive a page loading request initiated by the front end. The page loading request includes the page type and context information of the page to be loaded, wherein the context information includes user information related to the page to be loaded.

[0024] The first generation module is used to input the page type and the user information into the large language model to obtain the tool invocation plan output by the large language model, wherein the tool invocation plan includes the task invocation plan of the Content Model Context Protocol (MCP) tool and the layout MCP tool;

[0025] The execution module is used to execute the task call plan of the content MCP tool according to the tool call plan to obtain the content module data of the page to be loaded, and execute the task call plan of the layout MCP tool to generate the layout description information of the page to be loaded.

[0026] The second generation module is used to generate a structured page building package for the target page based on the content module data and the layout description information, and send the structured page building package to the front end so that the front end can render the target page based on the structured page building package.

[0027] In one possible embodiment, the first generation module is specifically used for:

[0028] When the page type is homepage, a first scenario that is automatically triggered is identified based on the page type of the homepage;

[0029] Input the first scenario and the user information into the large language model to obtain the tool invocation plan output by the large language model.

[0030] In one possible embodiment, the context information further includes terminal device information related to the page to be loaded; the first generation module is specifically used for:

[0031] The page type, the terminal device information, and the user information are input into the large language model to obtain the tool invocation plan output by the large language model.

[0032] In one possible embodiment, the user information includes user instruction information and / or user behavior events; the user instruction information includes natural language description information input by the user in a search scenario or a dialogue scenario; the user behavior events include browsing behavior that represents the user's content browsing preferences, interactive behavior that represents the user's content interest tendencies, and skipping behavior that represents the user's content rejection preferences.

[0033] In one possible embodiment, the execution module includes:

[0034] A receiving submodule is used to receive the content module data returned by the content MCP tool;

[0035] The first generation submodule is used to generate layout description information of the page to be loaded based on the layout MCP tool, the content module data and the context information.

[0036] In one possible embodiment, the first generation submodule is specifically used for:

[0037] Based on the layout MCP tool, the content module data, and the context information, the optimal layout template is matched from multiple preset rule knowledge bases, and the parameters of each content module in the optimal layout template are generated. The different preset rule knowledge bases record the priority of each preset layout template corresponding to different types of context information.

[0038] Based on the optimal layout template and the parameters of each content module, a layout node tree of the page to be loaded is generated, and the layout description information of the page to be loaded is obtained.

[0039] In one possible embodiment, the device further includes:

[0040] The judgment module is used to determine whether the total number of content modules in the layout node tree is less than a preset number.

[0041] If yes, then a preset layout template is selected from the preset rule knowledge base as the optimal layout template; otherwise, then the step of generating a structured page building package for the target page based on the content module data and the layout description information is executed, so that the front end can render the target page based on the structured page building package.

[0042] In a third aspect of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0043] Memory, used to store computer programs;

[0044] When a processor executes a program stored in memory, it implements any of the steps described in the first aspect.

[0045] In a fourth aspect of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when executed by a processor, the computer program implements any of the above-described agent-based page generation methods.

[0046] In a fifth aspect of this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the agent-based page generation methods described above.

[0047] This application provides a page generation method, apparatus, electronic device, and storage medium based on intelligent agents. The method is applied to a server deployed with a large language model and includes: receiving a page loading request initiated by a front-end, the page loading request including the page type and context information of the page to be loaded, wherein the context information includes user information related to the page to be loaded; inputting the page type and user information into the large language model to obtain a tool invocation plan output by the large language model, wherein the tool invocation plan includes task invocation plans for the Content Model Context Protocol (MCP) tool and the Layout MCP tool; executing the task invocation plan of the Content MCP tool according to the tool invocation plan to obtain the content module data of the page to be loaded, and executing the task invocation plan of the Layout MCP tool to generate layout description information of the page to be loaded; generating a structured page building package for the target page based on the content module data and the layout description information, so that the front-end renders the target page based on the structured page building package.

[0048] The intelligent agent parses the page type and context information of the page to be loaded, generating a tool invocation plan that includes task invocation plans for content MCP tools and layout MCP tools. Based on the tool invocation plan, the content module data and layout description information of the page to be loaded are obtained, and then the target page is generated. Since the context information includes user information related to the page to be loaded, the tool invocation plan generated by the intelligent agent is dynamically adjusted according to the page type of the page to be loaded and the user information related to the page. Therefore, the final target page is dynamically generated in real time according to the relevant characteristics of the page to be loaded, without relying on front-end static configuration or back-end templates, and without binding fixed interfaces, parameters and layout templates to each content module. This reduces the cost of generating pages when content modules, layouts or interaction scenarios change, eliminating the need for frequent manual adjustments by developers. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0050] Figure 1 A flowchart illustrating an agent-based page generation method provided in an embodiment of this application;

[0051] Figure 2 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment;

[0052] Figure 3 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment;

[0053] Figure 4 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment;

[0054] Figure 5 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment;

[0055] Figure 6 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment;

[0056] Figure 7 A schematic diagram of a page generation device based on an intelligent agent provided in an embodiment of this application;

[0057] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0058] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0059] To address the problems existing in the prior art, this application provides a page generation method, apparatus, electronic device, and storage medium based on intelligent agents. The page generation method based on intelligent agents provided in this application will be described first.

[0060] The page generation method based on intelligent agents provided in this application is applied to a server that has a large language model deployed on it. The page generation method includes the following steps.

[0061] The system receives a page loading request from the front end, which includes the page type and context information of the page to be loaded. The context information includes user information related to the page to be loaded. The system inputs the page type and user information into a large language model to obtain the generation tool invocation plan output by the large language model. The tool invocation plan includes the task invocation plans of the Content Model Context Protocol (MCP) tool and the Layout MCP tool. According to the tool invocation plan, the system executes the task invocation plan of the Content MCP tool to obtain the content module data of the page to be loaded, and executes the task invocation plan of the Layout MCP tool to generate the layout description information of the page to be loaded. Based on the content module data and the layout description information, the system generates a structured page build package for the target page and sends the structured page build package to the front end so that the front end can render the target page based on the structured page build package.

[0062] This application embodiment uses an intelligent agent to parse the page type and context information of the page to be loaded, generating a tool invocation plan that includes task invocation plans for content MCP tools and layout MCP tools. Based on the tool invocation plan, the content module data and layout description information of the page to be loaded are obtained, and then the target page is generated. Since the context information includes user information related to the page to be loaded, the tool invocation plan generated by the intelligent agent is dynamically adjusted according to the page type of the page to be loaded and the user information related to the page to be loaded. Therefore, the final target page is dynamically generated in real time according to the relevant characteristics of the page to be loaded, without relying on front-end static configuration or back-end templates, and without binding fixed interfaces, parameters and layout templates to each content module. Thus, when content modules, layouts or interaction scenarios change, developers do not need to make frequent manual adjustments, which can reduce the cost of generating pages when content modules, layouts or interaction scenarios change.

[0063] The following is a detailed explanation.

[0064] See Figure 1 This is a flowchart illustrating a page generation method based on intelligent agents provided in this application embodiment. The method is applied to a server with a large language model deployed and includes the following steps S101-S104.

[0065] S101: Receives page loading requests initiated by the front end.

[0066] The page loading request includes the page type and context information of the page to be loaded, and the context information includes user information related to the page to be loaded.

[0067] In one example, the page type of the page to be loaded includes homepage, detail page, special page, etc.; the user information related to the page to be loaded includes user profile, user commands or behavioral events. Among them, user profile refers to a virtual user model constructed by collecting and analyzing users' basic information, behavioral data, preference characteristics, etc., which is used to accurately describe the characteristics and needs of the target user group, such as whether the user is a guest or a logged-in user.

[0068] S102: Input the page type and user information into the large language model to obtain the tool invocation plan output by the large language model.

[0069] The tool invocation plan includes task invocation plans for the Content Model Context Protocol (MCP) tool and the layout MCP tool. The content MCP tool is generated based on the backend content interface, while the layout MCP tool is generated based on the backend layout logic. The backend content interface is responsible for establishing content data transmission channels, while the layout logic determines the organization and processing flow of content data, ultimately returning structured results. The layout logic may include: content priority sorting algorithms, pagination calculation and data, slice field mapping and format conversion, and responsive layout adaptation rules, etc.

[0070] Artificial Intelligence (AI) agents like LangChain possess multi-tool invocation capabilities, meaning they can support plug-in tool calls and trigger any registered MCPServer tools in parallel or sequentially. In one example, each backend content interface, such as REST or gRPC, and layout logic can be pre-encapsulated as an MCP Server tool plugin. This includes metadata such as tool name, parameter definitions, invocation methods, timeouts, and degradation settings, thus perfecting the capabilities of the corresponding tools within that MCP. The tool list (i.e., the list of tools corresponding to each MCP Server) is dynamically loaded when the agent framework starts, and a capability query interface is provided. During MCP development, each tool has a corresponding capability description describing its functionality. When an agent chooses whether to execute a tool, it refers to this description.

[0071] In this embodiment, after the agent obtains the page type and context information of the page to be loaded, it inputs them into a large language model. The large language model parses the page type and user information related to the page to be loaded, thereby generating a tool invocation plan (Plan Graph). The generated tool invocation plan generates specific parameters for each tool task. For example, for the content MCP tool, parameters such as content filtering conditions and the number of content modules can be generated. For instance, content filtering conditions might filter out content with a historical click-through rate or search rate of 0 when the user profile indicates a logged-in user. For the layout MCP tool, parameters such as layout template preferences can be generated. Furthermore, the invocation order, concurrency, merging strategy, and fallback plan for each tool can be determined to further improve performance.

[0072] S103: According to the tool call plan, execute the task call plan of the content MCP tool to obtain the content module data of the page to be loaded, and execute the task call plan of the layout MCP tool to generate the layout description information of the page to be loaded.

[0073] After generating the tool invocation plan, the agent executes the task invocation plan of the content MCP tool to obtain the content module data of the page to be loaded. Specifically, multiple different content MCP tools can be triggered in the planned order or concurrently to obtain the content module data. Then, the task invocation plan of the layout MCP tool is triggered to generate the layout description information of the page to be loaded.

[0074] S104: Generate a structured page building package for the target page based on the content module data and layout description information, and send the structured page building package to the front end so that the front end can render the target page based on the structured page building package.

[0075] After obtaining the content module data and layout description information of the page to be loaded, the intelligent agent integrates the content module data and layout description information returned by all tools to generate a structured page build package (JSON Layout Tree). The front-end renders the target page based on this structured page build package. Furthermore, in this embodiment, data streaming or chunked return is supported, allowing the front-end to render each module progressively. In other embodiments, rendering can be completed in one go; the choice can be made based on the user's actual needs.

[0076] In one embodiment, after executing the tool invocation plan, the agent can continuously optimize the tool invocation order, parameters, and layout strategy by collecting feedback on tool execution performance, resource utilization, and user interaction. Specifically, feedback can be provided through a model, which can be stored in specific rules or in the model's memory, thereby achieving feedback and optimization.

[0077] Applying the embodiments of this application, an intelligent agent parses the page type and context information of the page to be loaded, generating a tool invocation plan that includes a content MCP tool and a layout MCP tool. The content MCP tool and layout MCP tool are generated based on the backend content interface and layout logic, respectively, and can be directly invoked by the intelligent agent. Based on the tool invocation plan, the content module data and layout description information of the page to be loaded are obtained, and then the target page is generated. Since the context information includes user information related to the page to be loaded, the tool invocation plan generated by the intelligent agent is dynamically adjusted according to the page type of the page to be loaded and the user information related to the page. Therefore, the final target page is dynamically generated in real time according to the relevant characteristics of the page to be loaded, without relying on frontend static configuration or backend templates, and without binding fixed interfaces, parameters, and layout templates to each content module. This eliminates the need for frequent manual adjustments by developers when content modules, layouts, or interaction scenarios change, reducing the cost of generating pages when content modules, layouts, or interaction scenarios change.

[0078] In one possible embodiment, see Figure 2 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment, and... Figure 1 Compared to the illustrated embodiment, step S102 above includes steps S102A1 and S102B1.

[0079] S102A1: When the page type is homepage, the first scene that is automatically triggered is identified based on the page type of homepage.

[0080] S102B1: Input the first scenario and user information into the large language model to obtain the tool invocation plan output by the large language model.

[0081] The homepage is the initial display area that users see when they open a webpage / application without any interaction; it is the key interface layer for users to obtain core information. Therefore, the content and layout of the homepage directly affect user retention and conversion rates.

[0082] In this embodiment, when the page type of the page to be loaded is the homepage first screen, the scene is identified as "automatically triggered," requiring no natural language input. After parsing the scene using a large language model, task call plans for content MCP tools and layout MCP tools corresponding to the user's preferred content modules can be directly generated based on the user profile of the homepage first screen. When the user profile is a guest or a new user logging in for the first time, task call plans for each content MCP tool and layout MCP tool can be generated based on preset conditions, such as tasks with a historical call frequency greater than a preset call frequency. For example, task call plans for tools including content modules such as popular recommendations, focus images, and channel lists can be generated.

[0083] Applying the embodiments of this application, when the page type of the page to be loaded is the homepage, the scene is identified as "automatically triggered." No natural language input is required; only the automatically triggered scene needs to be parsed to generate task call plans for each content MCP tool and layout MCP tool, thus obtaining the tool call plan. This avoids redundant calls that could cause excessively long loading times for users, improving the user experience.

[0084] In one possible embodiment, the context information also includes terminal device information related to the page to be loaded, see [link to relevant documentation]. Figure 3 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment, and... Figure 1 Compared to the illustrated embodiment, step S102 above includes the following step S102A2.

[0085] S102A2: Input the page type, terminal device information and user information into the large language model to obtain the tool invocation plan output by the large language model.

[0086] The terminal device information may include, but is not limited to, the terminal device's network quality, resolution, screen size, and other parameters.

[0087] In this embodiment, the context information also includes terminal device information related to the page to be loaded. Therefore, after inputting the page type and context information of the page to be loaded into the large language model, the large language model parses it, and the generated tool invocation plan is dynamically adjusted according to the page type of the page to be loaded, the user information related to the page to be loaded, and the terminal device information. Therefore, the final target page is dynamically generated in real time according to the relevant characteristics of the page to be loaded, without relying on front-end static configuration or back-end templates, and without binding fixed interfaces, parameters, and layout templates to each content module. Thus, when content modules, layouts, or interaction scenarios change, developers do not need to make frequent manual adjustments, which can reduce the cost of generating pages when content modules, layouts, or interaction scenarios change.

[0088] In one possible embodiment, user information includes user instruction information and / or user behavior events; user instruction information includes natural language description information input by the user in a search scenario or a dialogue scenario; user behavior events include browsing behavior that represents the user's content browsing preferences, interactive behavior that represents the user's content interest tendencies, and skipping behavior that represents the user's content rejection preferences.

[0089] In this embodiment, when the user information of the page to be loaded includes user instruction information and / or user behavior events, the intelligent system uses a large language model to parse the intent of the user instruction information and / or user behavior events, and then generates a task invocation plan that meets the needs of the target user based on the intent.

[0090] In one example, if the user information on the page to be loaded is a user command, specifically "Today's weather in City A," the AI ​​will parse this command using a large language model to generate a task invocation plan that matches the user's needs. This plan might include task invocation plans for content MCP tools such as today's temperatures for each district and county in City A, temperature modules for different time periods in hourly units, suggested clothing, suitable exercise, and next steps for searching and / or dialogue, as well as corresponding task invocation plans for layout MCP tools. In another example, if the user information on the page to be loaded is a user behavior event, specifically browsing actor B's information for a preset time range, such as 10 seconds, the AI ​​will parse this browsing behavior using a large language model to generate a task invocation plan that matches the user's needs. This plan might include task invocation plans for content MCP tools such as actor B's popular film and television works, as well as corresponding task invocation plans for layout MCP tools.

[0091] In the embodiments of this application, when the user information of the page to be loaded includes user instruction information and / or user behavior events, the user instruction information includes natural language description information input by the user in a search scenario or dialogue scenario, and the user behavior events include browsing behavior representing the user's content browsing preferences, interactive behavior representing the user's content interest tendencies, and skipping behavior representing the user's content rejection preferences. The intelligent system uses a large language model to parse the intent of the user instruction information and / or user behavior events, thereby generating a task invocation plan that meets the needs of the target user based on the intent, and finally the page generated based on the task invocation plan is also a page that meets the needs of the target user.

[0092] In one possible embodiment, see Figure 4 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment, and... Figure 1 Compared to the illustrated embodiment, step S103 above includes steps S103A and S103B.

[0093] S103A: Execute the task invocation plan of the content MCP tool according to the tool invocation plan to obtain the content module data of the page to be loaded and receive the content module data returned by the content MCP tool.

[0094] Among them, the content module data is the data returned by the content MCP tool, which is the content module data of user preferences generated after the agent makes a decision.

[0095] S103B: Generate layout description information for the page to be loaded based on the layout MCP tool, content module data, and context information.

[0096] The context information used in S103B is the same context information obtained in step S101, such as user profile, user commands or behavioral events, network quality of the terminal device, resolution of the terminal device, and screen size parameters of the terminal device. After obtaining the content module data returned by the content MCP tool, the layout MCP tool is triggered to generate layout description information. See the example below. Figure 5 This is another flowchart illustrating the agent-based page generation method provided in this application embodiment, and... Figure 4 Compared to the embodiment shown, step S103B above includes steps S103B1 and S103B2.

[0097] S103B1: Based on the layout MCP tool, content module data and context information, the optimal layout template is obtained by matching from multiple preset rule knowledge bases, and the parameters of each content module in the optimal layout template are generated.

[0098] Among them, different preset rule knowledge bases record the priority of each preset layout template corresponding to different types of context information.

[0099] Specifically, the optimal layout template can be obtained through Drools (JBoss Rules, an open-source business rule engine that provides powerful functionality to handle complex decision-making logic, especially in business environments requiring rapid response to changes) or a custom rule engine. The layout MCP Server tool loads various layout templates from the configuration center upon system startup, such as horizontal scrolling, grid, list, and waterfall layouts. It registers a name and parameters for each layout template, such as the number of rows and columns, card size, spacing, preloading threshold, and suitable scenarios, such as homepage, detail page, and special topic page. It should be noted that the types and parameters of layout templates include, but are not limited to, those exemplified above. In this embodiment, any front-end style type of layout template and module parameters can be loaded or generated.

[0100] A custom rule engine can include multiple preset rule knowledge bases. Different rule knowledge bases define the priority of layout templates under different types of context information. Layout templates can be obtained from a configuration center, which stores a preset template library. For example, one rule knowledge base defines the priority of layout templates for different screen sizes. For instance, for screen size A, the highest priority layout template is a row of four cards, and the lowest priority layout template is a focus image module; for screen size B, the highest priority layout template is a row of two cards, and the lowest priority layout template is a waterfall layout, and so on. Another rule knowledge base defines the priority of layout templates for different network qualities, and so on. Multiple rule knowledge bases can be used, and the large model, based on the current content module data and context information, combines the understanding from each rule knowledge base to generate corresponding layout templates and content. The rules in the rule knowledge base can be manually confirmed, while decisions are made through the model. In this embodiment, the content module can also be obtained from a preset content library.

[0101] In this embodiment of the application, after the agent obtains the optimal layout template, it will also generate the parameters of each content module, such as the number of rows, the number of columns, the aspect ratio, and the number of preloaded items.

[0102] S103B2: Based on the optimal layout template and the parameters of each content module, generate the layout node tree of the page to be loaded, and obtain the layout description information of the page to be loaded.

[0103] After obtaining the optimal layout template and parameters of each content module, a layout node tree can be generated based on algorithms such as Grid, Flow, or Virtual Scroll, including fields such as id (user identifier), type (page type), position (module position), size (module size), style (user style), and dataRef (data reference, representing the index between layout nodes and data). In this embodiment, incremental updates and sharded calculations are also supported to optimize performance.

[0104] In this embodiment, the intelligent agent provides the ` / mcp / layout` interface. In one example, the input may include `moduleData` (component data), `screenWidth` (screen width), `networkQuality` (network quality), and `userPrefs` (user preferences), and the output is a structured layout tree. The following is a code example:

[0105] {

[0106] "tool":"generateLayout", (Tool: Layout generation tool)

[0107] "args":{...} (Parameter configuration:)

[0108] }

[0109] -->

[0110] {

[0111] "tool":"generateLayout",

[0112] "status":0, (Status: 0)

[0113] "data":{"layoutTree":{...}} (Data: Layout Tree)

[0114] }

[0115] In the embodiments of this application, after the intelligent agent obtains the tool invocation plan based on the page type, user information related to the page to be loaded, and terminal device information, it first executes the task invocation plan of the content MCP tool according to the tool invocation plan to obtain the content module data of the page to be loaded. Then, based on the layout MCP tool, the content module data, and the context information, it makes a decision to generate the layout description information of the page to be loaded, thereby achieving seamless collaboration between content acquisition and layout decision-making in dynamic scenarios.

[0116] In one possible embodiment, after generating the layout node tree, it is also effectively judged to prevent abnormal generation results from causing request timeouts or rendering errors. In one example, the above method also includes the following step A.

[0117] Step A: Determine whether the total number of content modules in the layout node tree is less than the preset number.

[0118] If yes, then select a preset layout template from the preset rule knowledge base as the optimal layout template; otherwise, proceed to step S104.

[0119] In this embodiment, the total number of content modules in the layout node tree is determined. If the total number of content modules is less than a preset number, a layout template is selected from a preset rule knowledge base as the default template. A new layout node tree is generated based on this template for fallback distribution. The preset number can be manually determined according to actual needs, and this application does not impose a specific limitation on it.

[0120] In this embodiment of the application, after each layout node tree is generated, the total number of content modules in the layout node tree is determined. If the total number of content modules is less than a preset number, a layout template is selected from a preset rule knowledge base as the default template, and a new layout node tree is generated based on this template and distributed as a fallback. This can reduce the problem of request timeouts or rendering errors caused by abnormal generation results.

[0121] See Figure 6 This is another flowchart of the page generation method based on intelligent agents provided in the embodiments of this application. The overall process includes the following S601-S612.

[0122] S601: Obtain the page type and context information of the page to be loaded.

[0123] S602: Page type and context information parsing.

[0124] S603: Tool call plan for content generation MCP tools and layout MCP tools.

[0125] The next step is content acquisition and layout generation. The content acquisition part includes: S604: content MCP request generation; S605: calling the content MCP Server; S606: returning module data.

[0126] The layout generation section includes: S607: Request generation of layout MCP; S608: Call layout MCP Server; S609: Return layout description information.

[0127] S610: Integrates content module data and layout description information.

[0128] S611: Output structured page build package.

[0129] S612: Front-end rendering.

[0130] This application's embodiments can also be applied to other scenarios, such as: related recommendations on playback pages: dynamically pulling similar videos and works by the same actors based on the currently playing content; event topic pages: scenarios where operators need to quickly build diverse modules and layouts when publishing promotions or holiday topics; search results pages: scenarios where users initiate searches, can enter keywords, or automatically complete recommendations based on context.

[0131] In a second aspect of this application, an agent-based page generation apparatus is also provided, see [link to relevant documentation]. Figure 7 This is a schematic diagram of a page generation device based on an intelligent agent provided in an embodiment of this application. The device includes:

[0132] The receiving module 701 is used to receive a page loading request initiated by the front end. The page loading request includes the page type and context information of the page to be loaded, wherein the context information includes user information related to the page to be loaded.

[0133] The first generation module 702 is used to input the page type and the user information into the large language model to obtain the tool invocation plan output by the large language model, wherein the tool invocation plan includes the task invocation plan of the Content Model Context Protocol (MCP) tool and the typesetting MCP tool.

[0134] The execution module 703 is used to execute the task invocation plan of the content MCP tool according to the tool invocation plan to obtain the content module data of the page to be loaded, and execute the task invocation plan of the layout MCP tool to generate the layout description information of the page to be loaded.

[0135] The second generation module 704 is used to generate a structured page building package for the target page based on the content module data and the layout description information, and send the structured page building package to the front end so that the front end can render the target page based on the structured page building package.

[0136] In one possible embodiment, the first generation module 702 is specifically used for:

[0137] When the page type is homepage, a first scenario that is automatically triggered is identified based on the page type of the homepage; the first scenario and the user information are input into the large language model to obtain the tool invocation plan output by the large language model.

[0138] In one possible embodiment, the context information further includes terminal device information related to the page to be loaded; the first generation module 702 is specifically used for:

[0139] The page type, the terminal device information, and the user information are input into the large language model to obtain the tool invocation plan output by the large language model.

[0140] In one possible embodiment, the user information includes user instruction information and / or user behavior events; the user instruction information includes natural language description information input by the user in a search scenario or a dialogue scenario; the user behavior events include browsing behavior that represents the user's content browsing preferences, interactive behavior that represents the user's content interest tendencies, and skipping behavior that represents the user's content rejection preferences.

[0141] In one possible embodiment, the execution module 703 includes:

[0142] A receiving submodule is used to receive the content module data returned by the content MCP tool; a first generating submodule is used to generate the layout description information of the page to be loaded based on the layout MCP tool, the content module data and the context information.

[0143] In one possible embodiment, the first generation submodule is specifically used for:

[0144] Based on the layout MCP tool, the content module data, and the context information, the optimal layout template is matched from multiple preset rule knowledge bases, and the parameters of each content module in the optimal layout template are generated. The different preset rule knowledge bases record the priority of each preset layout template corresponding to different types of context information.

[0145] Based on the optimal layout template and the parameters of each content module, a layout node tree of the page to be loaded is generated, and the layout description information of the page to be loaded is obtained.

[0146] In one possible embodiment, the device further includes:

[0147] The judgment module is used to determine whether the total number of content modules in the layout node tree is less than a preset number; if so, a preset layout template is selected from the preset rule knowledge base as the optimal layout template; if not, the step of generating a structured page building package for the target page based on the content module data and the layout description information is executed so that the front end can render the target page based on the structured page building package.

[0148] This application also provides an electronic device, such as... Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.

[0149] The memory 803 is used to store computer programs; the processor 801, when executing the program stored in the memory 803, performs the following steps:

[0150] Receive a page loading request initiated by the front end, wherein the page loading request includes the page type and context information of the page to be loaded, and the context information includes user information related to the page to be loaded;

[0151] The page type and the user information are input into the large language model to obtain the generation tool invocation plan output by the large language model. The tool invocation plan includes the task invocation plan of the Content Model Context Protocol (MCP) tool and the typesetting MCP tool.

[0152] According to the tool invocation plan, the task invocation plan of the content MCP tool is executed to obtain the content module data of the page to be loaded, and the task invocation plan of the layout MCP tool is executed to generate the layout description information of the page to be loaded;

[0153] A structured page building package for the target page is generated based on the content module data and the layout description information, and the structured page building package is sent to the front end so that the front end can render the target page based on the structured page building package.

[0154] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0155] The communication interface is used for communication between the aforementioned terminal and other devices.

[0156] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0157] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0158] In another embodiment provided in this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the agent-based page generation methods described in the above embodiments.

[0159] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the agent-based page generation methods described in the above embodiments.

[0160] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

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

[0162] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, storage media, and computer program products are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0163] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. A page generation method based on intelligent agents, characterized in that, Applied to a server, wherein a large language model is deployed on the server, the method includes: Receive a page loading request initiated by the front end, wherein the page loading request includes the page type and context information of the page to be loaded, and the context information includes user information related to the page to be loaded; The page type and the user information are input into the large language model to obtain the tool invocation plan output by the large language model. The tool invocation plan includes the task invocation plans of the Content Model Context Protocol (MCP) tool and the typography MCP tool. According to the tool invocation plan, the task invocation plan of the content MCP tool is executed to obtain the content module data of the page to be loaded, and the task invocation plan of the layout MCP tool is executed to generate the layout description information of the page to be loaded; A structured page building package for the target page is generated based on the content module data and the layout description information, and the structured page building package is sent to the front end so that the front end can render the target page based on the structured page building package.

2. The method according to claim 1, characterized in that, The context information also includes terminal device information related to the page to be loaded; the step of inputting the page type and the user information into the large language model to obtain the tool invocation plan output by the large language model includes: The page type, the terminal device information, and the user information are input into the large language model to obtain the tool invocation plan output by the large language model.

3. The method according to claim 1, characterized in that, The user information includes user instruction information and / or user behavior events; the user instruction information includes natural language description information input by the user in a search scenario or a dialogue scenario; the user behavior events include browsing behavior that represents the user's content browsing preferences, interactive behavior that represents the user's content interest tendencies, and skipping behavior that represents the user's content rejection preferences.

4. The method according to any one of claims 1-3, characterized in that, The step of executing the task invocation plan of the layout MCP tool according to the tool invocation plan to generate the layout description information of the page to be loaded includes: Receive the content module data returned by the content MCP tool; Based on the layout MCP tool, the content module data, and the context information, the layout description information of the page to be loaded is generated.

5. The method according to claim 4, characterized in that, The step of generating layout description information for the page to be loaded based on the layout MCP tool, the content module data, and the context information includes: Based on the layout MCP tool, the content module data, and the context information, the optimal layout template is matched from multiple preset rule knowledge bases, and the parameters of each content module in the optimal layout template are generated. The different preset rule knowledge bases record the priority of each preset layout template corresponding to different types of context information. Based on the optimal layout template and the parameters of each content module, a layout node tree of the page to be loaded is generated, and the layout description information of the page to be loaded is obtained.

6. The method according to claim 5, characterized in that, The method further includes: Determine whether the total number of content modules in the layout node tree is less than a preset number; If yes, then a preset layout template is selected from the preset rule knowledge base as the optimal layout template; otherwise, then the step of generating a structured page building package for the target page based on the content module data and the layout description information is executed, so that the front end renders the target page based on the structured page building package.

7. A page generation device based on an intelligent agent, characterized in that, The device includes: A receiving module is used to receive a page loading request initiated by the front end, wherein the page loading request includes the page type and context information of the page to be loaded, and the context information includes user information related to the page to be loaded; The first generation module is used to input the page type and the user information into the large language model to obtain the generation tool invocation plan output by the large language model, wherein the tool invocation plan includes the task invocation plan of the Content Model Context Protocol (MCP) tool and the layout MCP tool; The execution module is used to execute the task call plan of the content MCP tool according to the tool call plan to obtain the content module data of the page to be loaded, and execute the task call plan of the layout MCP tool to generate the layout description information of the page to be loaded. The second generation module is used to generate a structured page building package for the target page based on the content module data and the layout description information, and send the structured page building package to the front end so that the front end can render the target page based on the structured page building package.

8. The apparatus according to claim 7, characterized in that, The context information also includes terminal device information related to the page to be loaded; the first generation module is specifically used for: Input the page type, the terminal device information, and the user information into the large language model to obtain the tool invocation plan output by the large language model.

9. The apparatus according to claim 7 or 8, characterized in that, The execution module includes: A receiving submodule is used to receive the content module data returned by the content MCP tool; The first generation submodule is used to generate layout description information of the page to be loaded based on the layout MCP tool, the content module data, and the context information.

10. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-6.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-6.