Role playing graph issuing method, system and equipment based on large language model and storage medium
By classifying and vectorizing role attributes, combining large language models and database retrieval, the problems of high latency and poor consistency of image generation in traditional role-playing systems are solved, and more efficient and accurate role image generation is achieved.
Patent Information
- Application Number
- CN202510518106.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-08
AI Technical Summary
In traditional role-playing systems based on large language models, the image generation delay is high, the context correlation is insufficient, and the image quality consistency is poor, making it difficult to meet the diverse needs, and the image generation mechanism is passive, resulting in low image generation efficiency and low accuracy.
By collecting role attributes and classifying them, corresponding pictures and text content are generated, converted into feature vectors and stored in vector databases, and using large language models to determine whether images need to be published, and image attributes are determined through database search, and target images are selected using collaborative filtering method.
It improves the diversity of image content, context relevance and consistency of individual character pictures, reduces the delay in generating pictures, and improves the accuracy and initiative of posting pictures.
Smart Images

Figure CN120448570A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, system, device and storage medium for role-playing and image distribution based on a large language model. Background Art
[0002] With the rapid development of artificial intelligence technology, role-playing systems based on large language models have gradually become a popular form of digital entertainment. Role-playing generative models can not only conduct multi-round conversations, but also meet users' interactive and entertainment needs by generating specific text content, images, or scenarios. Currently, large language models (such as GPT-4 and LLaMA) have made significant progress in natural language generation and emotion understanding, and can efficiently support complex role-playing dialogue forms. However, during role-playing dialogues, users often also want to obtain visual feedback that matches the context, such as the character's expression, actions, or vivid presentation of the scene. By generating this visual content, the system can provide users with a more realistic and immersive experience, which has important application value in scenarios such as gaming, virtual social networking, education, and AI customer service systems. Traditional role-playing systems based on large language models are mainly composed of a language generation module, an image generation module, a scene adaptation module, and an interactive interface. They generate text dialogue content, generate corresponding character responses based on user input and context, and use a diffusion model to generate character images or scene diagrams. Based on the emotion or scene description, the generated images are adjusted to specific emotions or actions, integrating language and image output into a unified interactive interface to facilitate user interaction.
[0003] However, in traditional role-playing systems based on large language models, which are usually based on deep neural networks, generating a high-quality character image or scene image requires a long computing time and has high image generation latency; there is a lack of effective context information sharing mechanisms; the generated images may be inconsistent in quality and style; current role-playing image distribution systems mostly use a passive triggering method, that is, the system usually generates an image only after receiving a user request or reaching a specific interaction node.
[0004] Therefore, the traditional role-playing image distribution method based on large language models often has problems such as low image distribution efficiency and low image distribution accuracy due to high image generation delay, insufficient context relevance, poor image quality consistency, difficulty in meeting diverse needs, and passive image distribution mechanism. Summary of the Invention
[0005] Based on this, in order to solve the above technical problems, a role-playing picture posting method, system, device and storage medium based on a large language model are provided, which can improve the diversity of picture content, the relevance of pictures to contextual content, the consistency of individual character pictures, increase the probability of active picture posting, and reduce the delay in generating pictures.
[0006] A method for sending pictures through role-playing based on a large language model, the method comprising:
[0007] Collect and classify the attributes of each character, generate corresponding images and character text content based on the classified attributes, and convert the character text content into feature vectors and store them in a vector database in a one-to-one correspondence with the images;
[0008] Determine the target role selected by the user and enter the role-playing model. Based on the role-playing model, obtain user input information and role information, and generate response content through the large language model.
[0009] Determine whether the character needs to post a picture based on the user input information, character information, and reply content. If so, determine the image attributes of the character's picture and output it. If the character does not need to post a picture, output the reply content through the large language model.
[0010] Put the image attributes into the vector database, search in each of the feature vectors, calculate all similarity values under the image attributes, and weight them together to obtain a weighted image sequence;
[0011] The image sequence is filtered to determine the target image and output it.
[0012] In one embodiment, the attributes of each character are collected and classified, corresponding images and character text content are generated based on the classified attributes, and the character text content is converted into feature vectors and stored in a vector database in a one-to-one correspondence with the images, including:
[0013] Collect and classify the attributes of each role, and generate corresponding attribute content through the large model;
[0014] Inputting the attribute content into a diffusion model to generate a character image corresponding to the attribute content;
[0015] Embedding and encoding the attribute content through an embedded model to obtain an encoded feature vector;
[0016] The character photo and the corresponding feature vector are placed in a vector database.
[0017] In one embodiment, a target role selected by a user is determined and a role-playing model is entered. User input information and role information are obtained based on the role-playing model, and a response content is generated using a large language model, including:
[0018] Obtaining a target role determined according to user needs, and engaging in a dialogue in a role-playing model based on the target role;
[0019] Collect user input information and role information during the conversation process, and store historical information during the conversation process;
[0020] According to the role information, the user input information is used to generate reply content using the corresponding role of the role-playing model through a large language model.
[0021] In one embodiment, determining whether the character needs to post a picture based on the user input information, character information, and reply content, and if so, determining and outputting the image attributes of the character's picture includes:
[0022] Extracting the historical information and combining it with the user input information and reply content as context information;
[0023] Input the context information into the big model, infer the user's intention through the big model, and determine whether the role corresponding to the role information needs to post a role picture based on the user's intention;
[0024] If necessary, the image attributes of the current conversation are determined based on the user input information, role information, and historical information.
[0025] In one embodiment, the image attributes are placed in the vector database, searched in each of the feature vectors, and all similarity values under the image attributes are calculated and weighted to obtain a weighted image sequence, including:
[0026] Convert the image attributes into a key-value pair format, and obtain corresponding embedding vectors for the values corresponding to different keys through an embedded model;
[0027] Determine the attribute vector corresponding to each attribute content in the vector database;
[0028] Calculating the cosine similarity between the embedding vector and the attribute vector to obtain each similarity value;
[0029] Each of the similarity values is weighted, and the images are sorted to obtain an image sequence.
[0030] In one embodiment, filtering the image sequence, determining the target image and outputting the target image includes:
[0031] Determining the attribute dimension similarity value of each image in the image sequence from each of the similarity values, and calculating a cumulative dimension similarity score value;
[0032] The image sequence is filtered based on the attribute dimension similarity value and the dimension similarity score accumulation value, and a target image is determined and output.
[0033] In one embodiment, filtering the image sequence based on the attribute dimension similarity value and the dimension similarity score accumulation value, determining the target image and outputting it, includes:
[0034] Filtering out, from the image sequence, images whose attribute dimension similarity value is not less than a reference attribute dimension similarity value and whose dimension similarity score cumulative value is not less than a reference dimension similarity score cumulative value as target images;
[0035] When the number of target images is 1, output the target image;
[0036] When the number of the target images is greater than 1, the image with the largest cumulative value of the dimension similarity score among the target images is output.
[0037] A role-playing picture distribution system based on a large language model, the system comprising:
[0038] The image generation and vectorized storage module is used to collect and classify the attributes of each character, generate corresponding images and character text content based on the classified attributes, and convert the character text content into feature vectors and store them in a vector database in a one-to-one correspondence with the image;
[0039] The role-playing module is used to determine the target role selected by the user and enter the role-playing model. Based on the role-playing model, it obtains user input information and role information, and generates response content through the large language model.
[0040] An intention determination module is used to determine whether the character needs to post a picture based on the user input information, character information, and reply content. If so, the image attributes of the character's picture are determined and output; if not, the reply content is output through the large language model;
[0041] A retrieval module is used to put the image attributes into the vector database, search in each of the feature vectors, calculate all similarity values under the image attributes, and collaboratively weight them to obtain a weighted image sequence;
[0042] The filtering module is used to filter the image sequence, determine the target image and output it.
[0043] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a role-playing picture distribution method based on a large language model are implemented.
[0044] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a role-playing picture distribution method based on a large language model.
[0045] The above-mentioned role-playing picture-posting method, system, device and storage medium based on a large language model, by performing attribute classification, uses a role-playing model to determine whether a role needs to post a picture according to user input information, role information, and reply content, thereby improving the diversity of picture content, the relevance of pictures to contextual content, and the consistency of individual character pictures; since the character text content is converted into feature vectors and stored in a vector database in a one-to-one correspondence with pictures, the similarity value is calculated using a database search method to determine the output image, which can reduce the delay in generating pictures, and the attribute retrieval collaborative filtering method effectively improves the accuracy of pictures. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 This is a diagram of an application environment of a role-playing image distribution method based on a large language model in one embodiment;
[0047] Figure 2 1. A flowchart of a method for sending images through role-playing based on a large language model in one embodiment;
[0048] Figure 3 This is a structural block diagram of a role-playing image distribution system based on a large language model in one embodiment;
[0049] Figure 4 A schematic diagram of the system architecture of a role-playing image distribution system based on a large language model in one embodiment;
[0050] Figure 5 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0052] The role-playing image distribution method based on a large language model provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Figure 1As shown, the application environment includes a computer device 110. The computer device 110 can collect and classify the attributes of each character, generate corresponding images and character text content based on the classified attributes, and convert the character text content into feature vectors, which are stored in a one-to-one correspondence with the images in a vector database. The computer device 110 can determine the target character selected by the user and enter a role-playing model. Based on the role-playing model, the computer device 110 obtains user input information and character information, and generates a reply content using a large language model. The computer device 110 can determine whether the character needs to post an image based on the user input information, character information, and reply content. If so, the computer device 110 determines the image attributes of the character's image and outputs it. If the character does not need to post an image, the computer device 110 outputs the reply content using the large language model. The computer device 110 can store the image attributes in the vector database, search through each feature vector, calculate all similarity values under the image attributes, and weight them together to obtain a weighted image sequence. The computer device 110 can filter the image sequence, determine the target image, and output it. The computer device 110 can be, but is not limited to, various personal computers, laptops, smartphones, robots, tablets, and other devices.
[0053] In one embodiment, Figure 2 As shown, a role-playing image posting method based on a large language model is provided, comprising the following steps:
[0054] Step 202 : collect and classify the attributes of each character, generate corresponding pictures and character text content based on the classified attributes, and convert the character text content into feature vectors and store them in a vector database in a one-to-one correspondence with the pictures.
[0055] Computer equipment can use large models to generate information from as many different angles as possible about a character's multi-purpose attributes as the basic semantic information of a picture, thereby ensuring that users' diverse needs are met.
[0056] In one embodiment, a role-playing picture distribution method based on a large language model is provided, which may also include a process of character information classification, picture generation, and vectorized storage. The specific process includes: collecting attributes of each character and classifying the attributes, generating corresponding attribute content through a large model; inputting the attribute content into a diffusion model to generate a character picture corresponding to the attribute content; embedding and encoding the attribute content through an embedded model to obtain an encoded feature vector; and placing the character photo and the corresponding feature vector into a vector database.
[0057] Computer equipment can use the diffusion model Difussion to generate offline images for multiple characters, multiple attributes, and multiple angles. The generated images are saved in a vector database. By searching multiple attributes of a specific character, the images that need to be output are determined, reducing the time it takes to send images and ensuring real-time reply images.
[0058] Specifically, a computer device can classify multiple attributes of a character and generate content corresponding to these attributes from multiple perspectives using a large model. This content is then passed to a diffusion model to generate images corresponding to these attributes. The text-image content for different characters is then stored in different databases. For example, the characters stored in the database can be divided into character 1, character 2, character 3, ..., character n, where each character has attributes such as "action," "costume," "context," and "appearance." This different content is encoded and embedded using an embedding model, converting the text information into a feature vector that can be used for calculation. Ultimately, a single image corresponds to multiple attributes, and these attributes carry different feature vectors that can be used for calculation, facilitating similarity calculation during retrieval.
[0059] In this embodiment, the process of character information classification generation, image generation, and vectorized storage can mainly include: defining the attribute class of the character and generating attribute content through a large model; generating the corresponding character image according to the attributes and attribute content generated by the large model through a diffusion model; using an embedded model to embed the attribute content to obtain the encoded feature vector, and putting the image and the multi-attribute feature vector corresponding to the image into a vector database.
[0060] Specifically, when defining the attribute classes of the characters and generating the attribute content through the large model, you can specifically investigate a series of characters that different users like, refine the characteristics and habits of these characters themselves, and collect 10 to 20 pictures of each character.
[0061] The computer device can then use the instruction "Please help me classify the attributes of a specific known person's photo into seven attribute categories." to instruct the large model to define the character's attribute categories, which are divided into "action / posture", "expression", "clothing", "facial features", "background / scene", "style", and "angle". The large model can then be used to generate as much attribute content as possible for each attribute. For example, a picture corresponds to seven different attributes and their attribute content of a character. For example, the seven different attributes and attribute content corresponding to [Character 1][Picture 1] can be represented as: ["lying down"]["grinning"]["coat and sunglasses"]["blue eyes"]["cyber"]["alien space"]["side view"].
[0062] For a specific role, the computer device can use the diffusion model to train the original specific role image to obtain the diffusion model of the specific role; for the specific role, the attribute content of all existing attribute classes is combined, and the role diffusion model is used to generate images for all combinations, and finally the images of all roles are generated, and the content is saved as a json list with the role as the distinction; then, the attributes of the specific role can be extracted, and the attribute content can be encoded and embedded using the embedded model to obtain the feature embedding vector of each attribute content; then, the image path of the specific role and its corresponding feature embedding are placed in the vector database, and the vector databases of different roles are named with different role names, and finally an offline separated role vector database is constructed.
[0063] Step 204 , determining the target role selected by the user and entering the role-playing model, obtaining user input information and role information based on the role-playing model, and generating reply content through the large language model.
[0064] The computer device may generate output based on the content input by the user using a corresponding role of the role-playing model.
[0065] In one embodiment, a role-playing picture posting method based on a large language model is provided, which may also include a role-playing process, the specific process including: obtaining a target role determined according to user needs, and accessing a role-playing model for a conversation based on the target role; collecting user input information and role information during the conversation, and storing historical information during the historical conversation; based on the role information, using the large language model to generate reply content using the corresponding role of the role-playing model for the user input information.
[0066] In actual use, users first select a specific character based on their needs through their computer device, then connect to the role-playing model and engage in a conversation with the character. The overall conversation process is user input followed by character output. Conversation history is stored in a history file to prevent missing historical content and inconsistent context. Users enter content on the computer's system interface, and the model responds, saving all responses as a JSON file.
[0067] Step 206: Determine whether the character needs to post a picture based on the user input information, character information, and reply content. If so, determine the image attributes of the character's picture and output it. If the character does not need to post a picture, output the reply content through the large language model.
[0068] The computer device can accurately determine the user's intention based on the historical and current interaction data between the user and the character model. If the user's intention is to send a picture, the guidance model will fill in various attributes based on the character's own content and interaction data, and accurately generate the user's intention for the character in the current dialogue state.
[0069] Specifically, the computer device can determine whether it is necessary to send a picture based on the user input content and the output content of the corresponding character of the big model; if it is necessary to send a picture, the big model is guided to classify the input and output information, and divide the text information into attribute content under multiple attribute categories such as "action", "clothing", "situation", and "appearance".
[0070] In one embodiment, a role-playing picture-posting method based on a large language model is provided, which may also include a process of inferring user intentions. The specific process includes: extracting historical information and using it as context information together with user input information and reply content; inputting the context information into the large model, inferring user intentions through the large model, and judging whether the role corresponding to the role information needs to post a role picture based on the user intention; if necessary, determining the image attributes under the current conversation based on the user input information, role information, and historical information.
[0071] The computer device can extract the historical JSON data of the user and the character, and use it together with the current conversation content as context to guide the large model in determining user intent. The input prompts to the model may include: historical conversation jsonlist, current conversation jsonlist, and the instruction is: Based on the above conversation content, please infer the user's intention and determine whether the character should send a picture to the user, and write the reason. The output format is as follows: Reason: Because the user's attitude towards the character in the chat is quite intense, the character is strongly requested to send a picture; Is it necessary to send a picture: Yes. The large model can follow the rules in the prompt to standardize the output format, and determine whether the character has sent a picture based on the final output of "Yes" or "No".
[0072] In this embodiment, if a picture needs to be posted, the prompts provided to the model may include: character information, historical conversation jsonlist, current conversation jsonlist. The instructions are: Based on the above conversation content, please infer the seven attributes of the character's picture that are consistent with the current conversation state, including action / posture, expression, clothing, facial features, background / scene, style, and picture angle. The computer device can guide the model to generate attribute content consistent with the attributes in the database according to the instructions and output it in json format, which facilitates subsequent direct loading of the output content in json format. If a picture is not needed, the content text can be directly output.
[0073] Step 208: put the image attributes into the vector database, search in each feature vector, calculate all similarity values under the image attributes, and weight them together to obtain a weighted image sequence.
[0074] The computer device can encode each attribute content using a coding model, and then calculate the feature similarity with the encoded content under the corresponding attribute in the vector database to obtain all similarity values under the attribute, and accumulate the weighted similarity values of different attributes according to the picture. The picture with the highest value is finally output.
[0075] The computer device can put different attributes of the character in the current dialogue state into the vector database for retrieval, and collaboratively weight the similarity values obtained from the retrieval to obtain a picture sorting from high to low weight, filter out the largest K pictures for selection, and obtain the final picture to be sent.
[0076] In one embodiment, a role-playing image distribution method based on a large language model is provided, which may also include a vector database retrieval process, the specific process including: converting image attributes into a key-value pair format, and obtaining corresponding embedding vectors for values corresponding to different keys through an embedded model; determining the attribute vector corresponding to each attribute content in the vector database; calculating the cosine similarity between the embedding vector and the attribute vector to obtain each similarity value; weighting each similarity value, and sorting the images to obtain an image sequence.
[0077] Specifically, the computer device can use json.load() to convert the output json text format to obtain tuple format (Dict) data, where the key is the attribute and the value is the attribute content. Then, the computer device can use the embedded model to obtain the embedding vector corresponding to the value corresponding to each key. The data format corresponding to an image is:
[0078] {'key1':{'text':'value1','embedding':[embedding1]},......
[0079] {'key7':{'text':'value7','embedding':[embedding7]}.
[0080] Among them, embedding is the vector that needs to be calculated, defined as A.
[0081] Due to the complexity of text semantics, it's difficult to define text content and determine the relevance and semantic consistency between texts through direct rule matching. Therefore, it's necessary to select an excellent similarity algorithm to probabilistically calculate the relevance and semantic consistency between texts. In this example, 20 test data sets were constructed using actual user input and corresponding attributes as examples. If all attributes matched those of the retrieved images, the retrieval was accurate; otherwise, it was inaccurate.
[0082] In this embodiment, the Euclidean distance, cosine similarity, dot product, and Manhattan distance can be calculated, and finally the cosine similarity is determined to be the optimal solution. The formula for calculating cosine similarity can be expressed as: Among them, A is the embedding vector corresponding to the attribute content of the expected attribute, and B is the vector corresponding to the attribute content of the corresponding attribute in the database. The resulting similarity range is between [-1, 1]. The higher the value, the more similar the two vectors are.
[0083] The computer device can use the expected vector of the current attribute to calculate the similarity with all vectors of the attribute in the specific role database to obtain a column of similarity values. Similarly, the similarity values of all attributes under the role are calculated. Each attribute is weighted by importance to obtain the accumulated similarity value of each weighted attribute. The formula can be expressed as: Among them, W i The weight of each attribute is artificially assigned, ranging from [0.5, 1.5], which is used to appropriately adjust the importance of each attribute. i is the similarity value of each attribute dimension, and L is the total similarity value of the 7 attributes.
[0084] Step 210: filter the image sequence, determine the target image and output it.
[0085] The computer device can filter the image sequence to determine the target image.
[0086] In one embodiment, a role-playing image distribution method based on a large language model is provided, which may also include an image filtering process, the specific process including: determining the attribute dimension similarity value of each image in the image sequence from each similarity value, and calculating the cumulative value of the dimension similarity score; filtering the image sequence based on the attribute dimension similarity value and the cumulative value of the dimension similarity score, determining the target image and outputting it.
[0087] When the computer device filters the image, the filtering conditions can be: single-dimensional attribute difference constraint (S i ≥0.7), that is, to ensure that the similarity value S of all data in each attribute dimension i All are greater than or equal to 0.7 to avoid extreme differences in a certain attribute dimension; multi-dimensional comprehensive similarity constraint (L≥5.5): L is the cumulative value of the similarity scores of the entire 7 dimensions. This constraint ensures a high similarity in the overall dimension.
[0088] When conducting preliminary screening of computer equipment, you can use Si The rules of ≥0.7 and L≥5.5 are used to filter out the qualified data sets from the database, which are recorded as M.
[0089] In one embodiment, a role-playing image distribution method based on a large language model is provided, which may also include a process of outputting a target image. The specific process includes: filtering out images from an image sequence whose attribute dimension similarity value is not less than a reference attribute dimension similarity value, and whose dimension similarity score cumulative value is not less than a reference dimension similarity score cumulative value as target images; when the number of target images is 1, outputting the target image; when the number of target images is greater than 1, outputting the image with the largest dimension similarity score cumulative value among the target images.
[0090] The similarity value of the reference attribute dimension can be 0.7, and the cumulative similarity score value of the reference dimension can be 5.5. The computer device can filter out M pieces of data according to the filtering conditions. If M is 0, there is no data that meets the conditions, and no image is output. If M is 1, there is only one record in the data set, and the character image corresponding to the data is directly output. If M is greater than 1, there are multiple records in the data set, and a random image is selected from the K character images with the highest L value for output.
[0091] Through the strategy and mechanism for controlling the role's picture posting in a role-playing picture posting method based on a large language model provided in this application, the diversity of picture content, the relevance of pictures to contextual content, and the consistency of individual character pictures can be improved, which greatly improves the probability of active picture posting. The delay in generating pictures is reduced by using database retrieval rather than generation, and the attribute-based retrieval and collaborative filtering method effectively improves the accuracy of pictures.
[0092] The present application provides a role-playing picture posting method based on a large language model, which combines a large model, a diffusion model, and an embedded model to complete the role-playing picture posting task. The existing direct keyword generation picture posting has poor real-time, diversity, consistency, context relevance, and initiative. To address these problems, the attributes of the generated image content are classified, and an offline role-separated vector database is designed. At the same time, a large model is used to determine the intention and attribute content of user input content and role output content using a large model. The attributes are synchronously retrieved through an embedded model - a collaborative filtering retrieval mechanism. These strategies effectively solve the above problems, enhance the picture posting effect, and improve user stickiness.
[0093] In one embodiment, a method for sending pictures through role-playing based on a large language model is provided, and the specific process may include:
[0094] First, store the text-semantic vectors of different roles and attributes and their corresponding images offline.
[0095] Then, during the system operation, the user needs to first select a role, and use the role-playing model to output a text module as the basic dialogue mode for the user to interact with the role;
[0096] After the role-playing model generates the response content, the user input and the role-playing model text output are rewritten and judged;
[0097] If it is determined that a picture needs to be posted, the context is again determined and classified by the large model, and corresponding content is generated for multiple attributes of the current character, such as "action", "expression", "clothing", "appearance", and "situation".
[0098] Through the vector database retrieval and collaborative filtering module, the vectorized features of specific attributes are calculated with the database for similarity, and images with high attribute content similarity are collaboratively selected. The attribute similarity content is determined. If the similarity is high, it is output together with the text content, otherwise the output is canceled.
[0099] In this application, a role-playing picture posting method based on a large language model is provided, which uses a large model to generate as much information from different angles as possible for multiple attributes of a character as the basic semantic information of a picture to ensure that the diverse needs of users are met; a Difussion model is used to generate offline pictures of multiple characters, multiple attributes, and multiple angles, and the generated pictures are saved to a vector database. The pictures to be output are determined by searching multiple attributes of a specific character, which reduces the time for posting pictures and ensures the real-time nature of the reply pictures; a large model-based judgment + classification method and a rule-based keyword matching method are used for intent classification to accurately obtain the intention of the user input content and increase the probability of active picture posting; a separate character database is used to save specific characters in the corresponding database to ensure the consistency of the characters in multiple rounds of interaction; user input and image content are retrieved based on attribute labels and text embedding to ensure the relevance of contextual content, thereby accurately reflecting the emotions and actions of the characters.
[0100] It should be understood that, although the various steps in the above flow chart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above flow chart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0101] In one embodiment, Figure 3As shown, a role-playing image distribution system based on a large language model is provided, including: an image generation and vectorized storage module 310, a role-playing module 320, an intention determination module 330, a retrieval module 340 and a filtering module 350, wherein:
[0102] Image generation and vectorized storage module 310, for collecting and classifying attributes of each character, generating corresponding images and character text content based on the classified attributes, and converting the character text content into feature vectors and storing them in a vector database in a one-to-one correspondence with the images;
[0103] The role-playing module 320 is used to determine the target role selected by the user and enter the role-playing model, obtain user input information and role information based on the role-playing model, and generate response content through the large language model;
[0104] Intent determination module 330 is used to determine whether the character needs to post an image based on the user input information, character information, and reply content. If so, it determines the image attributes of the character's image and outputs it; if not, it outputs the reply content through the large language model;
[0105] The retrieval module 340 is used to put the image attributes into the vector database, search in each feature vector, calculate all similarity values under the image attributes, and collaboratively weight them to obtain a weighted image sequence;
[0106] The filtering module 350 is used to filter the image sequence, determine the target image and output it.
[0107] In one embodiment, Figure 4 As shown, a system architecture of a role-playing picture-posting system based on a large language model is provided, which mainly includes the generation and storage of data in a separate role vector database, user content intention determination and classification, vector database retrieval and collaborative filtering modules, so as to realize the functions of the role-playing picture-posting system based on a large language model.
[0108] The data generation and storage part of the separated character vector database can collect and classify the attributes of each character, generate corresponding pictures and character text content based on the classified attributes, and convert the character text content into feature vectors and store them in the vector database in a one-to-one correspondence with the pictures;
[0109] The user content intention determination and classification part can determine the target role selected by the user and enter the role-playing model. Based on the role-playing model, it obtains user input information and role information, and generates reply content through the large language model. Based on the user input information, role information, and reply content, it determines whether the role needs to post a picture. If so, it determines the image attributes of the role's picture and outputs it. If the role does not need to post a picture, the reply content is output through the large language model.
[0110] The vector database retrieval and collaborative filtering module can put image attributes into the vector database, search in each feature vector, calculate all similarity values under the image attributes, collaboratively weight them to obtain a weighted image sequence, filter the image sequence, determine the target image and output it.
[0111] In one embodiment, the image generation and vectorized storage module 310 is also used to collect the attributes of each character and classify the attributes, generate corresponding attribute content through a large model; input the attribute content into a diffusion model to generate a character image corresponding to the attribute content; embed the attribute content through an embedded model to obtain the encoded feature vector; and put the character photo and the corresponding feature vector into a vector database.
[0112] In one embodiment, the role-playing module 320 is also used to obtain a target role determined according to user needs, and to conduct a conversation in a role-playing model based on the target role; to collect user input information and role information during the conversation, and to store historical information during the historical conversation; and to generate reply content using the corresponding role of the role-playing model using a large language model based on the role information.
[0113] In one embodiment, the intention determination module 330 is also used to extract historical information and use it as context information together with user input information and reply content; the context information is input into the big model, the user intention is inferred through the big model, and based on the user intention, it is determined whether the role corresponding to the role information needs to post a role picture; if necessary, the image attributes under the current conversation are determined based on the user input information, role information, and historical information.
[0114] In one embodiment, the retrieval module 340 is also used to convert image attributes into a key-value pair format, and obtain corresponding embedding vectors for the values corresponding to different keys through an embedded model; determine the attribute vector corresponding to each attribute content in the vector database; calculate the cosine similarity between the embedding vector and the attribute vector to obtain each similarity value; weight each similarity value, and sort the images to obtain an image sequence.
[0115] In one embodiment, the filtering module 350 is also used to determine the attribute dimension similarity value of each image in the image sequence from each similarity value, and calculate the cumulative value of the dimension similarity score; filter the image sequence based on the attribute dimension similarity value and the cumulative value of the dimension similarity score, determine the target image and output it.
[0116] In one embodiment, the filtering module 350 is also used to filter out images from the image sequence whose attribute dimension similarity value is not less than the reference attribute dimension similarity value and whose dimension similarity score cumulative value is not less than the reference dimension similarity score cumulative value as target images; when the number of target images is 1, the target image is output; when the number of target images is greater than 1, the image with the largest dimension similarity score cumulative value among the target images is output.
[0117] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a role-playing drawing method based on a large language model is implemented. The display screen of the computer device can be a liquid crystal display or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.
[0118] Those skilled in the art will understand that Figure 5 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.
[0119] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, steps of a role-playing picture distribution method based on a large language model are implemented.
[0120] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the role-playing picture distribution method based on a large language model are implemented.
[0121] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0122] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0123] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A role-playing image distribution method based on a large language model, characterized in that: The method comprises: Collect and classify the attributes of each character, generate corresponding images and character text content based on the classified attributes, and convert the character text content into feature vectors and store them in a vector database in a one-to-one correspondence with the images; Determine the target role selected by the user and enter the role-playing model. Based on the role-playing model, obtain user input information and role information, and generate response content through the large language model. Determine whether the character needs to post a picture based on the user input information, character information, and reply content. If so, determine the image attributes of the character's picture and output it. If the character does not need to post a picture, output the reply content through the large language model. Put the image attributes into the vector database, search in each of the feature vectors, calculate all similarity values under the image attributes, and weight them together to obtain a weighted image sequence; The image sequence is filtered to determine the target image and output it.
2. The role-playing image distribution method based on a large language model according to claim 1, characterized in that: Collect and classify the attributes of each character, generate corresponding images and character text content based on the classified attributes, and convert the character text content into feature vectors and store them in a vector database in a one-to-one correspondence with the images, including: Collect and classify the attributes of each role, and generate corresponding attribute content through the large model; Inputting the attribute content into a diffusion model to generate a character image corresponding to the attribute content; Embedding and encoding the attribute content through an embedded model to obtain an encoded feature vector; The character photo and the corresponding feature vector are placed in a vector database.
3. The role-playing image distribution method based on a large language model according to claim 1 is characterized in that: Determine the target role selected by the user and enter the role-playing model. Based on the role-playing model, obtain user input information and role information, and generate response content through the large language model, including: Obtaining a target role determined according to user needs, and engaging in a dialogue in a role-playing model based on the target role; Collect user input information and role information during the conversation process, and store historical information during the conversation process; According to the role information, the user input information is used to generate reply content using the corresponding role of the role-playing model through a large language model.
4. The role-playing image distribution method based on a large language model according to claim 3 is characterized in that: Determining whether the character needs to post a picture based on the user input information, character information, and reply content; and if so, determining and outputting the image attributes of the character's picture, including: Extracting the historical information and combining it with the user input information and reply content as context information; Input the context information into the big model, infer the user's intention through the big model, and determine whether the role corresponding to the role information needs to post a role picture based on the user's intention; If necessary, the image attributes of the current conversation are determined based on the user input information, role information, and historical information.
5. The role-playing image distribution method based on a large language model according to claim 1 is characterized in that: The image attributes are placed in the vector database, and searched in each of the feature vectors to calculate all similarity values under the image attributes and weight them together to obtain a weighted image sequence, including: Convert the image attributes into a key-value pair format, and obtain corresponding embedding vectors for the values corresponding to different keys through an embedded model; Determine the attribute vector corresponding to each attribute content in the vector database; Calculating the cosine similarity between the embedding vector and the attribute vector to obtain each similarity value; Each of the similarity values is weighted, and the images are sorted to obtain an image sequence.
6. The role-playing image distribution method based on a large language model according to claim 5 is characterized in that: Filtering the image sequence, determining the target image and outputting it, including: Determining the attribute dimension similarity value of each image in the image sequence from each of the similarity values, and calculating a cumulative dimension similarity score value; The image sequence is filtered based on the attribute dimension similarity value and the dimension similarity score accumulation value, and a target image is determined and output.
7. The method for sending pictures through role-playing based on a large language model according to claim 6, characterized in that: Filtering the image sequence based on the attribute dimension similarity value and the dimension similarity score accumulation value, determining the target image and outputting it, including: Filtering out, from the image sequence, images whose attribute dimension similarity value is not less than a reference attribute dimension similarity value and whose dimension similarity score cumulative value is not less than a reference dimension similarity score cumulative value as target images; When the number of target images is 1, output the target image; When the number of the target images is greater than 1, the image with the largest cumulative value of the dimension similarity score among the target images is output.
8. A role-playing image distribution system based on a large language model, characterized in that: The system comprises: The image generation and vectorized storage module is used to collect and classify the attributes of each character, generate corresponding images and character text content based on the classified attributes, and convert the character text content into feature vectors and store them in a vector database in a one-to-one correspondence with the image; The role-playing module is used to determine the target role selected by the user and enter the role-playing model. Based on the role-playing model, it obtains user input information and role information, and generates response content through the large language model. An intention determination module is used to determine whether the character needs to post a picture based on the user input information, character information, and reply content. If so, the image attributes of the character's picture are determined and output; if not, the reply content is output through the large language model; A retrieval module is used to put the image attributes into the vector database, search in each of the feature vectors, calculate all similarity values under the image attributes, and collaboratively weight them to obtain a weighted image sequence; The filtering module is used to filter the image sequence, determine the target image and output it.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.