Picture generation method and device, storage medium and computer equipment
The user's prompt words and context information are obtained and optimized through the MCP server, and the image generation tool is used to generate pictures that are more in line with user needs, solving the accuracy and efficiency of the image generation method in the existing technology, and achieving flexible and innovative image generation.
Patent Information
- Application Number
- CN202510598448.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-08-08
AI Technical Summary
The existing image generation methods cannot accurately and efficiently generate personalized pictures according to user needs, especially in the field of professional design, it is difficult to combine the specific background and requirements of the project, and the operation is complex and inefficient, so automation and intelligence cannot be achieved.
The MCP server obtains the image generation request sent by the client that supports the MCP protocol, including the prompt words and context information entered by the user, and uses the preset image generation tool to optimize the prompt words and preprocess them to generate picture data corresponding to the optimized prompt words.
It improves the accuracy and practicality of pictures, breaks the limitations of fixed templates, generates more flexible and innovative pictures, reduces user manual operations, and improves image generation efficiency, especially when batch generation is more significant.
Smart Images

Figure CN120451316A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an image generation method, apparatus, storage medium, and computer equipment. Background Art
[0002] Currently, the common image generation methods are mainly the following:
[0003] 1. Generation based on a single AI model: Directly call AI painting models such as Midjourney and Stable Diffusion. The user enters a text prompt, and the model generates an image based on its own training data and algorithm.
[0004] 2. Use external tools to assist in generation: With the help of graphic design software such as Photoshop, designers manually create images or perform post-processing on AI-generated images.
[0005] 3. Image generation based on fixed templates: In some specific scenarios, use preset image templates and fill in some content to generate images.
[0006] Among the above-mentioned image generation methods, the generation method based on a single AI model lacks a deep understanding of the user's specific demand scenarios. For example, in the field of professional design, this generation method is difficult to generate accurate images based on the specific background and requirements of the project; and the use of external tools to assist in generating images requires relevant professional skills, and the operation is relatively complicated and inefficient, making it difficult to achieve an automated and intelligent image generation process; the image generation method based on fixed templates limits the diversity and innovation of images, and cannot be dynamically adjusted according to diverse needs, making it difficult to meet the ever-changing market demands.
[0007] In summary, existing image generation methods cannot accurately and efficiently generate personalized images according to user needs. Summary of the Invention
[0008] The purpose of this application is to solve at least one of the above-mentioned technical deficiencies, especially the technical defect that the image generation method in the prior art cannot accurately and efficiently generate personalized images according to user needs.
[0009] This application provides a method for generating an image, which is applied to an MCP server. The method includes:
[0010] Obtaining an image generation request sent by a client supporting the MCP protocol through the MCP protocol, wherein the image generation request includes a prompt word input by a user and context information;
[0011] Optimizing the prompt word according to the context information, and generating image data corresponding to the optimized prompt word using a preset image generation tool;
[0012] The image data is preprocessed, and the preprocessed image data is returned to the client via the MCP protocol.
[0013] Optionally, the method further includes:
[0014] Obtaining the image modification request sent by the client;
[0015] After determining the prompt word and context information corresponding to the image modification request, return to executing the step of optimizing the prompt word according to the context information, and using a preset image generation tool to generate image data corresponding to the optimized prompt word and subsequent steps, until no image modification request sent by the client is detected within a preset time period.
[0016] Optionally, determining the prompt word and context information corresponding to the image modification request includes:
[0017] Obtain the prompt word and number included in the image modification request;
[0018] Context information corresponding to the prompt word included in the image modification request is obtained according to the type of the number.
[0019] Optionally, the acquiring, according to the type of the number, context information corresponding to the prompt word included in the image modification request includes:
[0020] If the type of the number is a request number, the context information obtained when the image was last generated is retrieved using the request number;
[0021] If the type of the number is a picture number, the original picture record is searched through the picture number, and the original picture record is used as context information.
[0022] Optionally, the optimizing the prompt word according to the context information includes:
[0023] Inputting the context information and the prompt word into a preset target prompt word optimization model to obtain an optimization result of the target prompt word optimization model after optimizing the prompt word;
[0024] The target prompt word optimization model is obtained by training with sample prompt words and sample context information of different projects as training samples, and with the correspondence between each sample context information and each sample prompt word as the sample label.
[0025] Optionally, the image generation tool includes an AI image generation interface;
[0026] The step of using a preset image generation tool to generate image data corresponding to the optimized prompt word includes:
[0027] The optimized prompt word is sent to the AI picture generation interface, and the picture data corresponding to the optimized prompt word returned by the AI picture generation interface is received.
[0028] Optionally, the preprocessing of the image data includes:
[0029] Obtaining the client's image display requirements;
[0030] The image data is preprocessed according to the image display requirements.
[0031] This application also provides a picture generation device, including:
[0032] An information acquisition module, configured to acquire an image generation request sent by a client supporting the MCP protocol via the MCP protocol, wherein the image generation request includes a prompt word input by the user and context information;
[0033] An image generation module, configured to optimize the prompt word according to the context information and generate image data corresponding to the optimized prompt word using a preset image generation tool;
[0034] The image preprocessing module is used to preprocess the image data and return the preprocessed image data to the client through the MCP protocol.
[0035] The present application also provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image generation method described in any of the above embodiments.
[0036] The present application also provides a computer device, comprising: one or more processors, and a memory;
[0037] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the image generation method described in any one of the above embodiments are performed.
[0038] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0039] The image generation method, device, storage medium and computer equipment provided by the present application, when the MCP server obtains the image generation request sent by the client supporting the MCP protocol through the MCP protocol, since the client has a built-in information collection function, the image generation request sent by the client includes the prompt word and context information input by the user. At this time, the server can optimize the prompt word according to the context information, and then use a preset image generation tool to generate image data corresponding to the optimized prompt word. The image generated in this way is more in line with the actual needs of the user, thereby effectively improving the accuracy and practicality of the image, and the process can also break the limitations of fixed templates, thereby being able to generate more flexible and innovative images. Then, the present application can also pre-process the image data and return the pre-processed image data to the client through the MCP protocol. The present application reduces the manual operation of the user through an automated generation process, greatly improving the efficiency of image generation, especially when generating images in batches. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 A flowchart of a method for generating an image provided in an embodiment of the present application;
[0042] Figure 2 A schematic diagram of the image generation process when a user requests modification of an image provided in an embodiment of the present application;
[0043] Figure 3 A schematic diagram of the image generation process after the user inputs a prompt word provided in an embodiment of the present application;
[0044] Figure 4 A display diagram of the generated image data provided in the embodiment of the present application;
[0045] Figure 5 A schematic diagram of the structure of an image generation device provided in an embodiment of the present application;
[0046] Figure 6 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0048] In one embodiment, Figure 1 As shown, Figure 1 A flowchart of a method for generating an image provided in an embodiment of the present application is provided; the present application provides a method for generating an image, applied to an MCP server, and the method may include:
[0049] S110: Obtaining a picture generation request sent by a client supporting the MCP protocol through the MCP protocol.
[0050] In this step, the MCP (Model Context Protocol) server can communicate with the client that supports the MCP protocol, so that the user can use the client to propose image generation requirements in project development or other task scenarios. After receiving the requirement, the client can generate a corresponding image generation request based on the requirement and send it to the MCP server through the MCP protocol. After receiving the image generation request, the MCP server can generate the corresponding image based on the relevant information contained in the image generation request.
[0051] Among them, the client supporting the MCP protocol in this application differs significantly from the traditional client in design concepts, functional implementation, and applicable scenarios. The client of this application focuses on model context management (such as dynamic loading, version control, and collaborative reasoning), and supports dynamic adjustment of the model runtime environment (such as dependencies and resource allocation). For example, the client of this application can dynamically switch between different model versions of the same task (such as switching from BERT-base to BERT-large), while the traditional client needs to hard-code the model path or restart the service. In addition, the client of this application can also transmit structured context information (such as model configuration, input specifications, runtime parameters, etc.), while traditional clients usually only transmit input / output data (such as JSON forms).
[0052] Therefore, when a user uses a client that supports the MCP protocol to send an image generation request, the request contains not only the prompt word entered by the user but also the corresponding context information. After receiving this information, the MCP server can optimize and adjust the prompt word based on the context information, so as to use the optimized prompt word to generate image data that better meets user needs and has higher accuracy.
[0053] S120: Optimizing the prompt word according to the context information, and using a preset image generation tool to generate image data corresponding to the optimized prompt word.
[0054] In this step, after obtaining the image generation request sent by the client supporting the MCP protocol through the MCP protocol through S110, since the image generation request contains the prompt word entered by the user and the corresponding context information, the present application can optimize the prompt word according to the context information and use the preset image generation tool to generate image data corresponding to the optimized prompt word.
[0055] Specifically, since there are certain differences in the style, language logic, etc. of the prompt words input by different users, in order to improve the accuracy of the generated pictures, this application can optimize the prompt words input by the user so that the optimized prompt words can more accurately express the user's needs, thereby generating more accurate pictures. Among them, when this application optimizes the prompt words input by the user, the optimization process includes but is not limited to clarifying the core meaning of the prompt words to be expressed, converting them into structured expressions, extracting key information, separating key sentences, controlling language style and language quality, excluding negative prompt words, optimizing scenes, etc. For example, this application can expand and refine the prompt words input by the user in combination with the theme and style requirements of the project, and the specific settings can be made according to the actual situation, and are not limited here.
[0056] Furthermore, after optimizing the prompt words based on contextual information, this application can also use a preset image generation tool to generate image data corresponding to the optimized prompt words, so that images corresponding to user needs can be quickly generated, thereby effectively improving image generation efficiency. Among them, the image generation tools used in this application include but are not limited to APIs or SDKs based on technologies such as Stable Diffusion, DALL·E, and MidJourney. The core function of these technologies is to convert text, images, or other inputs into new images through artificial intelligence models (such as diffusion models, GANs, etc.). Therefore, this application can use such tools to quickly and batch generate images.
[0057] S130: Preprocess the image data and return the preprocessed image data to the client via the MCP protocol.
[0058] In this step, after generating image data corresponding to the optimized prompt word using the preset image generation tool through S120, the present application can also pre-process the image data and return the pre-processed image data to the client through the MCP protocol so that the user can view the generated image data through the client.
[0059] It is understandable that when displaying images generated by A, clients supporting the MCP protocol generally need to comply with protocol requirements such as data format, metadata relevance, and dynamic context adaptation. Therefore, after generating image data, this application can also perform preprocessing operations on the image data to ensure that the preprocessed image data meets the client's requirements and is displayed to the user through the client.
[0060] In the above embodiment, after the MCP server obtains the picture generation request sent by the client supporting the MCP protocol through the MCP protocol, since the client has a built-in information collection function, the picture generation request sent by the client includes the prompt word and context information input by the user. At this time, the server can optimize the prompt word according to the context information, and then use a preset picture generation tool to generate picture data corresponding to the optimized prompt word. The picture generated in this way is more in line with the actual needs of the user, thereby effectively improving the accuracy and practicality of the picture, and the process can also break the limitations of fixed templates, thereby being able to generate more flexible and innovative pictures. Then, the application can also pre-process the picture data and return the pre-processed picture data to the client through the MCP protocol. The application reduces the manual operation of the user through an automated generation process, greatly improves the efficiency of picture generation, and has obvious advantages when generating pictures in batches.
[0061] In one embodiment, Figure 2 As shown, Figure 2 This is a schematic diagram of the image generation process when a user requests modification of an image provided in an embodiment of the present application; the method may further include:
[0062] S140: Obtain the image modification request sent by the client.
[0063] S150: After determining the prompt word and context information corresponding to the image modification request, return to executing the step of optimizing the prompt word according to the context information, and using a preset image generation tool to generate image data corresponding to the optimized prompt word and subsequent steps, until no image modification request sent by the client is detected within a preset time period.
[0064] In this embodiment, after the application returns the pre-processed image data to the client through the MCP protocol, the client can provide functions such as saving and viewing. The user can view the currently generated image data through the viewing function. If the user is not satisfied with the image data, the user can also submit modification requirements again on the client, such as adjusting the image style, content details, etc.
[0065] Schematically, as Figure 2As shown, when the client in this application receives the user's modification request, it can generate a corresponding image modification request and send it to the server. After the server receives the image modification request, it can first determine the prompt word and context information corresponding to the image modification request, and then optimize the prompt word according to the context information, and use the preset image generation tool to generate image data corresponding to the optimized prompt word. After that, the image data is pre-processed, the pre-processed image data is returned to the client through the MCP protocol again, and wait for the user's next instruction. If the server does not detect the image modification request sent by the client within the preset time period, it means that the user is satisfied with the currently generated image. At this time, the user can choose to save the image to the specified location, thereby completing the image generation process.
[0066] In one embodiment, determining the prompt word and context information corresponding to the image modification request in S150 may include:
[0067] S151: Obtain the prompt word and number included in the image modification request.
[0068] S152: Acquire context information corresponding to the prompt word included in the image modification request according to the type of the number.
[0069] In this embodiment, since the modification requirements proposed by the user include but are not limited to fine-tuning the picture based on the current project, adjusting the current project, or regenerating new pictures, etc., the picture modification request of this application changes dynamically according to the user's modification requirements.
[0070] For example, the image modification request in this application includes a new prompt word and a number corresponding to the user's modification requirements. The number is used to instruct the server to search for the corresponding context information. Different types of numbers correspond to different context information. Therefore, after receiving the image modification request, the server can obtain the corresponding context information based on the type of number in the image modification request. In this way, it can optimize the prompt word based on the context information and use a preset image generation tool to generate image data corresponding to the optimized prompt word. Then, after pre-processing the image data, the pre-processed image data is returned to the client again via the MCP protocol, thereby automatically completing the image generation operation.
[0071] In one embodiment, obtaining context information corresponding to the prompt word included in the image modification request according to the type of the number in S152 may include:
[0072] S1521: If the type of the number is a request number, the context information obtained when the image was generated last time is retrieved through the request number.
[0073] S1522: If the type of the number is a picture number, search for an original picture record through the picture number, and use the original picture record as context information.
[0074] In this embodiment, when obtaining context information corresponding to the prompt word included in the image modification request according to the type of the number, the type of the number may be determined first, and then the corresponding context information may be searched or retrieved according to the different types of numbers.
[0075] For example, the numbering types of this application may include request numbers and picture numbers. When the user's modification requirement is to fine-tune the picture or make changes to the project, the client can send the request number corresponding to the last picture generation request or picture modification request sent to the server, so that the server can retrieve the context information obtained when the picture was last generated according to the request number; and when the user's modification requirement is to regenerate the picture, the client can send the picture number corresponding to the last generated picture to the server, so that the server can find the corresponding original picture record according to the picture number. This can not only maintain adjustment consistency, but also avoid repeated uploading of large files, thereby saving time and traffic.
[0076] In one embodiment, optimizing the prompt word according to the context information in S120 may include:
[0077] S121: Inputting the context information and the prompt word into a preset target prompt word optimization model, and obtaining an optimization result output by the target prompt word optimization model after optimizing the prompt word.
[0078] In this embodiment, when optimizing prompt words based on contextual information, the server can retrieve a pre-configured target prompt word optimization model and input the acquired contextual information and prompt words into the target prompt word optimization model. This model can then output the corresponding optimization results. For example, the MCP server in this application can use pre-trained models and models capable of deep thinking, such as Claude3.7 and DeepSeek, to optimize the prompt words input by the user and generate more accurate prompt words based on the project context to improve the quality of AI image generation.
[0079] The target prompt word optimization model of this application is obtained after training using sample prompt words and sample context information of different projects as training samples, and the correspondence between each sample context information and each sample prompt word as sample label. For example, this application can collect a large amount of sample data containing different project contexts and corresponding high-quality prompt words, and annotate them. Then, the annotated data can be used to train the model, so that it can learn the relationship between project context and prompt words, thereby optimizing the prompt words entered by the user to improve the quality of image generation.
[0080] In one embodiment, the image generation tool may include an AI image generation interface.
[0081] In S120, using a preset image generation tool to generate image data corresponding to the optimized prompt word may include:
[0082] S122: Send the optimized prompt word to the AI picture generation interface, and receive the picture data corresponding to the optimized prompt word returned by the AI picture generation interface.
[0083] In this embodiment, when generating images, a preset image generation tool can be used to generate image data corresponding to the optimized prompt word. The image generation tools in this application include but are not limited to APIs or SDKs based on technologies such as Stable Diffusion, DALL·E, and MidJourney, also known as AI image generation interfaces. The core function of this interface is to convert text, images, or other inputs into new images through artificial intelligence models (such as diffusion models, GANs, etc.). Therefore, this application can use such tools to quickly and batch generate images.
[0084] In one embodiment, preprocessing the image data in S130 may include:
[0085] S131: Obtaining the image display requirement of the client.
[0086] S132: Pre-process the image data according to the image display requirement.
[0087] In this embodiment, since a client supporting the MCP protocol generally needs to comply with protocol requirements such as data format, metadata relevance, and dynamic context adaptation when displaying an image generated by A, the present application may also perform pre-processing operations on the image data after generating it, so that the pre-processed image data meets the client's requirements and is displayed to the user through the client.
[0088] Specifically, after obtaining the image data, this application can obtain the client's image display requirements, and then pre-process the image data according to the image display requirements. For example, this application can perform pre-processing operations such as format conversion, size adjustment, and dynamic resolution adaptation on the image to adapt to the client's needs.
[0089] Furthermore, when the image data returned by the MCP server belongs to a multi-step generation pipeline (such as first generating a rough sketch and then refining it), after receiving the image data, the client can also display the generation process sequence and allow the user to select intermediate steps for re-editing, or distinguish between the original area and the edited area (such as a semi-transparent mask) during display, etc. The specific settings can be made according to the actual situation.
[0090] Schematically, as Figure 3 、 4 As shown, Figure 3 This is a schematic diagram of the image generation process after the user inputs the prompt word provided in the embodiment of the present application. Figure 4 A display diagram of the generated image data provided in the embodiment of the present application; Figure 3 、 Figure 4 It can be seen that this application can optimize the prompt words after receiving the prompt words input by the user, and then generate corresponding pictures based on the optimized prompt words. It can also analyze the scenes in the pictures and explain the content of the pictures in detail, thereby effectively improving the user experience.
[0091] The following describes the image generation device provided in an embodiment of the present application. The image generation device described below and the image generation method described above can be referenced to each other.
[0092] In one embodiment, Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of an image generation device provided in an embodiment of the present application. The present application also provides an image generation device, which may include an information acquisition module 210, an image generation module 220, and an image preprocessing module 230, specifically including the following:
[0093] The information acquisition module 210 is configured to acquire a picture generation request sent by a client supporting the MCP protocol via the MCP protocol, wherein the picture generation request includes a prompt word input by a user and context information.
[0094] The image generation module 220 is configured to optimize the prompt word according to the context information and generate image data corresponding to the optimized prompt word using a preset image generation tool.
[0095] The image pre-processing module 230 is configured to pre-process the image data and return the pre-processed image data to the client via the MCP protocol.
[0096] In the above embodiment, after the MCP server obtains the picture generation request sent by the client supporting the MCP protocol through the MCP protocol, since the client has a built-in information collection function, the picture generation request sent by the client includes the prompt word and context information input by the user. At this time, the server can optimize the prompt word according to the context information, and then use a preset picture generation tool to generate picture data corresponding to the optimized prompt word. The picture generated in this way is more in line with the actual needs of the user, thereby effectively improving the accuracy and practicality of the picture, and the process can also break the limitations of fixed templates, thereby being able to generate more flexible and innovative pictures. Then, the application can also pre-process the picture data and return the pre-processed picture data to the client through the MCP protocol. The application reduces the manual operation of the user through an automated generation process, greatly improves the efficiency of picture generation, and has obvious advantages when generating pictures in batches.
[0097] In one embodiment, the present application also provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image generation method described in any of the above embodiments.
[0098] In one embodiment, the present application further provides a computer device, including: one or more processors, and a memory.
[0099] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the image generation method described in any one of the above embodiments are performed.
[0100] Schematically, as Figure 6 As shown, Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 can be provided as a server. Figure 6 Computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by memory 301 for storing instructions executable by processing component 302, such as an application. The application stored in memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, processing component 302 is configured to execute the instructions to perform the image generation method of any of the above-mentioned embodiments.
[0101] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or the like.
[0102] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0103] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0104] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.
[0105] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating an image, applied to an MCP server, characterized in that: The method comprises: Obtaining an image generation request sent by a client supporting the MCP protocol through the MCP protocol, wherein the image generation request includes a prompt word input by a user and context information; Optimizing the prompt word according to the context information, and generating image data corresponding to the optimized prompt word using a preset image generation tool; The image data is preprocessed, and the preprocessed image data is returned to the client via the MCP protocol.
2. The image generation method according to claim 1, wherein: The method further comprises: Obtaining the image modification request sent by the client; After determining the prompt word and context information corresponding to the image modification request, return to executing the step of optimizing the prompt word according to the context information, and using a preset image generation tool to generate image data corresponding to the optimized prompt word and subsequent steps, until no image modification request sent by the client is detected within a preset time period.
3. The image generation method according to claim 2, characterized in that: The determining of the prompt word and context information corresponding to the image modification request includes: Obtain the prompt word and number included in the image modification request; Context information corresponding to the prompt word included in the image modification request is obtained according to the type of the number.
4. The image generation method according to claim 3, wherein: The acquiring, according to the type of the number, context information corresponding to the prompt word included in the image modification request includes: If the type of the number is a request number, the context information obtained when the image was last generated is retrieved using the request number; If the type of the number is a picture number, the original picture record is searched through the picture number, and the original picture record is used as context information.
5. The image generation method according to any one of claims 1 to 4, characterized in that: The optimizing the prompt word according to the context information includes: Inputting the context information and the prompt word into a preset target prompt word optimization model to obtain an optimization result of the target prompt word optimization model after optimizing the prompt word; The target prompt word optimization model is obtained by training with sample prompt words and sample context information of different projects as training samples, and with the correspondence between each sample context information and each sample prompt word as the sample label.
6. The image generation method according to any one of claims 1 to 4, characterized in that: The image generation tool includes an AI image generation interface; The step of using a preset image generation tool to generate image data corresponding to the optimized prompt word includes: The optimized prompt word is sent to the AI picture generation interface, and the picture data corresponding to the optimized prompt word returned by the AI picture generation interface is received.
7. The image generation method according to any one of claims 1 to 4, characterized in that: The preprocessing of the image data includes: Obtaining the client's image display requirements; The image data is preprocessed according to the image display requirements.
8. A picture generating device, characterized in that: include: An information acquisition module, configured to acquire an image generation request sent by a client supporting the MCP protocol via the MCP protocol, wherein the image generation request includes a prompt word input by the user and context information; An image generation module, configured to optimize the prompt word according to the context information and generate image data corresponding to the optimized prompt word using a preset image generation tool; The image preprocessing module is used to preprocess the image data and return the preprocessed image data to the client through the MCP protocol.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image generation method according to any one of claims 1 to 7.
10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the image generation method according to any one of claims 1 to 7 are performed.
Citation Information
Cited By
AI model calling method and system of 5G core network
CN120730344A
An ai model calling method and system of a 5g core network
CN120730344B