LLM character character shaping-based emotional accompanying platform for elderly at home

By applying LLM technology on the home-based elderly care platform, virtual characters of the elderly’s relatives and friends are generated, and the problem that the existing platform cannot meet the emotional needs of the elderly is solved, and more realistic and intimate emotional companionship is achieved.

CN119807344AInactive Publication Date: 2025-04-11HEBEI PETROLEUM VOCATIONAL & TECH UNIV

Patent Information

Application Number
CN202411767611.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-04-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing home-based elderly care platforms cannot effectively utilize AI technology, especially large language models, to meet the emotional needs of the elderly, especially in terms of family comfort.

Method used

Through the character shaping technology based on LLM, social software data is used to mine character portraits and relationships, and virtual characters of elderly relatives and friends are generated to provide emotional companionship.

Benefits of technology

It has achieved the problem of alleviating the emotional needs of elderly people at home to a certain extent, and provides a different sense of reality and intimacy from the traditional conversation companion robot.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807344A_ABST
    Figure CN119807344A_ABST
Patent Text Reader

Abstract

The invention provides a home elder emotion accompanying platform based on LLM character character shaping. The home elder emotion accompanying platform comprises a character relationship management module, a social software terminal data acquisition module, an agent character portrait management module, a large language model module, an agent memory module, an agent operation module and a server side. The character relationship management module is used for user registration and virtual relative and friend character construction and management; the social software terminal data acquisition module is used for acquiring chat records of WeChat, uploading historical chat records to the server in batches and updating the chat records regularly; the intelligent agent figure portrait management module is used for calling a large language model to generate a figure portrait according to the figure chat data of the server side and updating the figure portrait regularly; the agent operation module is used for calling a large language model according to the figure portrait to form a dialogue response; and the agent memory module is used for recording chat records of dialogues between the elderly living at home and the agent operation module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of LLM intelligent bodies, and in particular to an emotional companionship platform for elderly people at home based on LLM character shaping. Background Art

[0002] LLM (Large Language Model) refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. Large language models can handle a variety of natural language tasks, such as text classification, question answering, dialogue, etc., and are an important path to artificial intelligence. Intelligent agent, or IntelligentAgent, is an important concept in the current field of computer science and has been widely used in computer science fields such as AI (artificial intelligence), distributed computing, CSCW (computer-supported collaborative work), and human-computer interface.

[0003] The reasoning and planning capabilities that emerge from large language models are the foundation of intelligent agents. These capabilities need to be induced with the help of prompt words, and prompt word technology is called prompt word engineering. In the application field of LLM agents, the ability of intelligent agent personality shaping has been used in applications related to nonplayer characters and historical and literary virtual characters. Social software such as WeChat has accumulated data on daily communication between individuals, families, relatives and friends. How to apply the character portrait shaping capabilities of LLM intelligent agent technology to shaping the children and friends of elderly people at home, so as to make up for the lack of time for relatives caused by young people being busy with their careers in modern society, and to meet the emotional needs of the elderly to a certain extent, is a problem that needs to be solved urgently.

[0004] At present, home-based elderly care platforms for the elderly (such as conversational companion robots, smart speakers, etc.) are mostly limited to knowledge base functions such as health knowledge, opera poetry, etc., and are unable to utilize the latest capabilities of the AI ​​field, especially large language models. Among the emotional needs of the elderly, health care and hobbies are one of the important aspects, but what is more prominent is family comfort. Therefore, the present invention uses the latest capabilities of language model intelligent agents to shape character portraits, integrates social software data, and shapes virtual characters of relatives and friends of the elderly, which helps to alleviate and solve the emotional needs of the elderly at home to a certain extent. Summary of the invention

[0005] In view of the shortcomings of the above-mentioned prior art, the present invention proposes an emotional companionship platform for elderly people at home based on LLM character shaping, which is used to mine character portraits and character relationships based on social software data, and use LLM intelligent body technology to shape virtual characters of the elderly’s relatives and friends.

[0006] The present invention adopts an emotional companionship platform for elderly people at home based on LLM character shaping, including a character relationship management module, a social software terminal data acquisition module, an intelligent character portrait management module, a large language model module, an intelligent body memory module, an intelligent body operation module and a server end;

[0007] The character relationship management module is used for user registration and building and managing virtual relatives and friends of elderly people at home;

[0008] The social software terminal data collection module is used to obtain the chat records of the selected social software, upload the historical chat records in batches to the server, and update the chat records regularly;

[0009] The intelligent agent character portrait management module is used to obtain the latest chat records between the elderly at home and the chat object through the intelligent agent memory module, and then call the large language model to generate a character portrait or analyze and update the character portrait according to a preset period;

[0010] Large language model module, used to provide large language models through local deployment or cloud services;

[0011] The agent operation module is used to call the large language model for dialogue response based on the prompts formed by the character portrait and memory retrieval results;

[0012] The intelligent agent memory module is used to save the chat records between the elderly at home and their virtual relatives and friends, and to construct chat prompts.

[0013] Furthermore, the character relationship management module includes:

[0014] The account registration submodule is used for user account registration, including setting username and password;

[0015] The add / delete friends and relatives submodule is used to add / delete a chat companion virtual character and assign a unique virtual friend and relative identification ID to each created chat companion virtual character;

[0016] The login account submodule is used for registered elderly people to log in to this platform by entering their username and password.

[0017] Furthermore, the social software terminal data collection module includes:

[0018] The chat record authorization submodule is used to pop up the authorization agreement when collecting the chat records of the user's social software, and obtain the access authorization of the chat records when the user accepts the agreement;

[0019] The chat partner selection submodule is used to read the chat friend list of the social software and associate the selected friend with the virtual relatives and friends of the user account;

[0020] The chat history batch upload submodule is used to upload the chat records between the selected chat object and the elderly at home to the server, and store the chat records into the intelligent body memory module according to the identification ID of the virtual relatives and friends;

[0021] The chat information real-time update submodule is used to set the selected chat object as the monitoring object, read the newly generated chat information within this period of time according to the customized time, upload it to the server, and store it in the intelligent body memory module.

[0022] Furthermore, a pgvector database is provided on the server side, which includes a family_member table and a Member_memory table, wherein the family_member table is a virtual character table, and its persona field is used to store character portraits returned by the large language model, and the Member_memory table is a virtual character memory table, which is used to store chat records between home-based elderly people and virtual relatives and friends.

[0023] Furthermore, the specific steps of the agent character portrait management module regularly updating the character portrait include:

[0024] Step 1: Based on the custom weight function in the Member_memory table, calculate the comprehensive weight according to the values ​​of the importance field and the last_updated_at field, sort the chat records of the agent according to the comprehensive weight, and retrieve the latest chat records;

[0025] The weight function uses the following formula to calculate the comprehensive weight:

[0026] p weight =(Recency*Wrecency+Importance*Wimportance)

[0027] Among them, Importance is the value of the importance field, which is the length of the content field inserted when storing the chat record; Recency is the time correlation, and recency = r n , where n represents the number of days between the current time now and last_updated_at, r is the decay coefficient, r = 0.9;

[0028] Step 2: The search results of step 1 and the old character portrait are constructed into prompts, and the large language model is called through the prompts. The large language model gives a new character portrait description;

[0029] Step 3: Store the new character portrait description in the persona field of the family_member table, thereby updating the character portrait table.

[0030] Furthermore, the agent memory module constructs the companion chat prompt words by retrieving the most valuable records from the chat history, and the step of retrieving the most valuable records includes:

[0031] Step 1: Based on the vector database, according to the distance relevancy between the text embedding vector of the current chat message and the text embedding vector of the historical chat record, the chat record data with the smallest relevancy is screened out;

[0032] Step 2: Based on the chat records filtered in step 1, calculate the comprehensive priority p using the following formula:

[0033] p=(Recency*W recency +Relevancy*W relevancy +Importance*W importance )

[0034] Among them, p is the comprehensive search priority, W recency , W relevancy , W importance is an adjustable weight parameter;

[0035] Step 3: Sort the chat record data according to the value of p, and select the chat record with the highest priority to construct the prompt word.

[0036] Furthermore, the generative agent operation module supports a passive response mode and an active initiation mode, and is implemented by providing a passive response mode API and an active initiation mode API respectively.

[0037] Furthermore, the workflow of the passive response mode API is as follows:

[0038] S1: Get the token when the user logs in, use the token, and enter the virtual character ID and the chat message of the elderly at home when calling;

[0039] S2: The server obtains the character portrait from the persona field of the family_member table based on the virtual character ID;

[0040] S3: According to the virtual character ID, the chat history of the virtual character is obtained through the agent memory module;

[0041] S4: construct prompt words according to the character portrait, the obtained chat records, and the chat message;

[0042] S5: Use the constructed prompt words to call the large language model to obtain the chat response of the virtual character.

[0043] Furthermore, the workflow of the active response mode API is as follows:

[0044] S1: Get the token when the user logs in, use the token, and enter the virtual character ID when calling;

[0045] S2: According to the virtual character ID, the chat history of the virtual character is obtained through the agent memory module;

[0046] S3: Select a fixed chat message pre-stored in this module;

[0047] S4: Obtain a character portrait from the persona field of the family_member table according to the virtual character ID, and construct a prompt word by combining the character portrait, the retrieved chat records, and the fixed chat message;

[0048] S5: Use the prompt words to call the large language model to obtain the chat response of the virtual character.

[0049] A method for emotional companionship of elderly people at home based on LLM character shaping, characterized in that it is implemented according to an emotional companionship platform for elderly people at home, and comprises the following steps:

[0050] Step 1: The user registers through the character relationship management module and adds virtual relatives and friends;

[0051] Step 2: Use the social software terminal data collection module to obtain the chat data of the selected relatives and friends, and upload it to the server;

[0052] Step 3: The character portrait management module calls the large language model based on historical chat data to generate and update character portraits;

[0053] Step 4: Save the chat records between the user and the virtual friends and relatives through the intelligent agent memory module, and construct the companion chat prompt words based on the chat records;

[0054] Step 5: The generative agent operation module uses the character portrait and the companion chat prompt words to call the large language model to respond to the conversation and obtain chat feedback.

[0055] Therefore, the present invention adopts the above-mentioned emotional companionship platform for elderly people at home based on LLM character shaping, which has the following beneficial effects:

[0056] The present invention mines character portraits and character relationships from the data of daily communication among individuals, families, relatives and friends accumulated in social software such as WeChat, and uses this as the data basis for shaping character portraits of large language model intelligent agents. By shaping virtual characters of relatives and friends of the elderly through LLM model intelligent agents, it can help alleviate and solve the emotional needs of elderly people at home to a certain extent. In addition, since the data source of the present invention is WeChat chat record data, when using the large language model to shape the intelligent agent character portrait, it can more realistically simulate the personality characteristics, discourse style, and character relationships of real people, providing a sense of reality that traditional conversation companion robots cannot provide.

[0057] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 This is the architecture diagram of the emotional companionship platform for elderly people living at home.

[0059] Figure 2 This is the architecture diagram of the intelligent character portrait management module in the emotional companionship platform for elderly people at home.

[0060] Figure 3 This is the message flow diagram of the generative agent module in the emotional companionship platform for elderly people at home.

[0061] Figure 4 The present invention is a flowchart of the method for emotional companionship for elderly people at home.

[0062] Figure 5a A data structure for a virtual character.

[0063] Figure 5b The data structure of the chat record.

[0064] Figure 6 A prompt word template for updating character portraits.

[0065] Figure 7 A prompt word template constructed for chatting. DETAILED DESCRIPTION

[0066] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art make various changes or modifications to the present invention, and these equivalent forms also fall within the scope limited by the claims attached to the application.

[0067] The present invention proposes an emotional companionship platform for elderly people at home based on LLM character shaping, such as Figure 1 As shown, it includes the following modules:

[0068] 1. Character relationship management module

[0069] This module is used to construct and manage a character relationship diagram centered on elderly people at home, thereby providing a character topology structure for forming intelligent virtual characters.

[0070] It includes the following sub-modules:

[0071] (1) Account opening and registration submodule

[0072] This module is used for the elderly to register accounts. Each account represents a virtual family centered on the elderly at home. The virtual family includes but is not limited to blood relations, as well as close friends with whom they communicate frequently.

[0073] (2) Add / delete the Friends and Family submodule

[0074] Used to add / delete a chat companion virtual character. Each created chat companion virtual character is assigned a unique virtual relative or friend identification ID.

[0075] (3) Login Account Submodule

[0076] Registered elderly people can log in to this platform by entering their username and password.

[0077] 2. Social software terminal data collection module

[0078] This module runs on a mobile terminal or PC (operating the PC version of WeChat), collects user chat data, and uploads it to the platform's server. The type and scope of the collected data require explicit authorization from the user. This module is used to collect chat records of selected social software, upload historical chat records in batches to the server, and update chat information in real time.

[0079] It includes the following submodules:

[0080] (1) Chat record authorization submodule

[0081] This module is used to pop up the authorization agreement when the user collects chat records. When the user accepts the agreement, the access authorization of the user's social software chat records is obtained through the historical chat record acquisition interface of the third-party chat software.

[0082] (2) Chat partner selection submodule

[0083] This module is used to read the chat friend list of social software (such as WeChat, QQ), and read the virtual character table of the user account through the API (the family_member table in the pgvector database on the server side, which stores the children of relatives and friends, such as Figure 5aAs shown), check the chat partner of the elderly person at home from the friend list, and check the virtual character from the virtual character table, associate the selected friend with the virtual character, and carry the associated virtual character identification ID when uploading data in the subsequent chat history batch upload submodule.

[0084] (3) Chat history batch upload submodule

[0085] This module is used to upload the chat records between the single-selected or multi-selected chat objects and the elderly at home to the server. During the upload process, a confirmation box pops up to remind the user to agree to upload or refuse. After the chat records are uploaded to the server, they are stored in the intelligent body memory module according to the virtual relative and friend ID, that is, in the Member_memory table. Figure 5b shown.

[0086] (4) Chat information real-time update submodule

[0087] This module is used to set the selected chat object as the monitoring object. According to the customized time (such as 1 hour, 2 hours,...n hours), the newly generated chat information within this period is read regularly and uploaded to the server, and stored in the agent memory module, that is, the Member_memory table. When setting the monitoring object, a confirmation box will pop up to remind the user to agree to the setting or refuse.

[0088] 3. Intelligent agent portrait management module

[0089] This module is implemented based on the intelligent agent memory module. It obtains the latest chat records between the elderly at home and the chat partner through the intelligent agent memory module, and then calls the large language model to generate a character portrait or analyze and update the character portrait according to a preset period.

[0090] This module regularly updates the character portrait of each elderly person at home, and the specific steps include:

[0091] Step 1: Calculate the comprehensive weight according to the custom function weight(importance,last_updated_at) in the Member_memory table of the agent memory module, sort the chat records according to the comprehensive weight, and retrieve the latest chat records of the agent;

[0092] The input parameters of this function are the values ​​of the importance field and the last_updated_at field in the Member_memory table. In the present invention, the value of the importance field is the length of the content field inserted when storing the chat record.

[0093] Weight function calculates the comprehensive weight p weightThe formula is:

[0094] p weight =(Recency*Wrecency+Importance*Wimportance)(1)

[0095] Among them, p is the comprehensive search priority, Wrecency and Wimportance are preset adjustable weight parameters; Importance is the value of the importance field, and Recency is the time correlation, which is calculated by last_updated_at;

[0096] When calculating recency, a decay coefficient r = 0.9 is set, and then the number of days n between the current time now and last_updated_at is calculated. Finally, recency is calculated according to the formula: recency = r n ;

[0097] Step 2: Construct the search results of step 1 and the old character portraits into prompts, such as Figure 6 As shown, the large language model is called through the prompt, and the large language model gives a new character portrait description;

[0098] Step 3: Store the new character portrait description in the persona field of the family_member table, thereby updating the character portrait table to achieve character shaping during companion chat.

[0099] 4. Large language model (cloud service API or local engine) module

[0100] This module uses local deployment or cloud service API, such as ChatGPT or Zhipu API. Choose the specific deployment method according to actual needs. For example, if there is no local computing power, the cloud service API is generally used, and the local engine can use GLM4-8B-Chat.

[0101] 5. Agent Memory Module

[0102] From the above, it can be seen that the present invention uses intelligent agents to create virtual relatives and friends to chat with elderly people at home. The intelligent agent uses the character portraits of relatives and friends (intelligent agents) extracted from the chat information as prompt words, and generates dialogues with specific personality characteristics and language styles of relatives and friends through a large language model.

[0103] The intelligent agent memory module is used to save the chat records between the elderly at home and their virtual relatives and friends, that is, the memory of the intelligent agent virtual character. This memory works in two scenarios. One is to generate and update the virtual character portrait. At this time, the retrieval only considers Recency and Importance, because it is not in the chat context and there is no topic relevance. The other scenario is the chat scenario. At this time, the retrieval of memory has three factors: Recency, Importance and Relevancy. Relevancy is the distance between the text embedding vector of the chat message and the text embedding vector of the memory entry (historical chat record);

[0104] The agent memory module enables the agent to have memory, making the chat content continuous and more obvious.

[0105] The agent memory module is deployed on the server side, which is used to operate the Member_memory table. The Member_memory table is a virtual character memory table used to store chat records, where embedding is a text embedding vector used for priority sorting during retrieval, last_updated_at participates in recency calculation, and importance stores importance.

[0106] The agent memory module can also be used to construct chat prompts. Due to the constraints of the machine processing power of the large language model context window, it is necessary to retrieve the most valuable records from the chat history. Unlike the retrieval of chat records when updating the task portrait mentioned above, when constructing chat prompts, context relevance must be considered. Therefore, three indicators are used for retrieval here: time relevance Recency, topic relevance Relevancy, and importance Importance. These three indicators are weighted to calculate the comprehensive retrieval priority p. The calculation formula for p is as follows:

[0107] p= (Recency*W recency +Relevancy*W relevancy +Importance*W importance ) (2)

[0108] Among them, p is the comprehensive search priority, W recency , W relevancy , W importance is an adjustable weight parameter; Relevancy is the distance between the text embedding vector of the chat message and the text embedding vector of the memory entry (historical chat record);

[0109] Specifically, when searching in a chat scenario, first, a preliminary selection is performed through the vector database according to Relevancy to screen out the chat record data with the smallest distance between the text embedding vector of the current chat message and the text embedding vector of the historical chat record, and the chat record after the preliminary selection is loaded into the memory; secondly, based on the chat record data after the preliminary selection, the values ​​of Recency and Importance are obtained according to the above-mentioned method for determining Recency and Importance, and then the comprehensive retrieval priority p is calculated by the above formula, and the chat record data is sorted according to the value of p, and the chat record with the highest priority is selected for constructing the prompt word.

[0110] Finally, the retrieved chat record and the character portrait field of the chat object corresponding to the chat record are used to construct a prompt word for accompanying the chat. The prompt word template is as follows: Figure 7 shown.

[0111] 6. Generative Agent Operation Module

[0112] This module is used to call the large language model for dialogue response based on the prompts formed by character portraits and memory retrieval results.

[0113] This module supports passive response mode and active initiation mode, and implements it by providing passive response mode API and active initiation mode API.

[0114] First, the user registers an account through the character relationship management module, sets a username and password, and obtains a token;

[0115] Secondly, when the user terminal (such as a companion robot, smart speaker, etc.) calls the passive response mode API, it performs the following steps:

[0116] ①Use token and enter the virtual character ID and chat message of the elderly at home when calling;

[0117] ② The server obtains the character portrait from the persona field of the family_member table based on the virtual character ID;

[0118] ③According to the virtual character ID, the memory record of the virtual character is obtained through the intelligent body memory module. Specifically, according to the input chat message of the elderly at home, the pgvector database embeds the message into a text vector, and uses this vector to search for the nearest vector to obtain the chat record with the most similar text;

[0119] ④ Use character portraits, searched chat records, and chat messages to construct prompt words;

[0120] ⑤Use the constructed prompt words to call the large language model to obtain the chat response of the virtual character;

[0121] Again, if the active initiation mode API is called, it is implemented by client polling, that is, the server provides a polling API, and the client calls this API regularly (the interval can be set) to obtain the conversation content of the virtual character.

[0122] The polling api performs the following steps:

[0123] ①Use token to call the active initiation mode API and enter the preset virtual character ID when calling;

[0124] ②According to the virtual character ID, the memory record of the virtual character is obtained through the intelligent body memory module. At this time, message is empty. The values ​​of the last_updated_at field and the importance field in the Member_memory table are used to calculate the retrieval comprehensive priority p based on formula (2). Based on p, the chat record with the highest priority is obtained;

[0125] ③Select a fixed chat message pre-stored in this module, for example: "What do you want to say to the elderly? You can also say nothing."

[0126] ④According to the virtual character ID, obtain the character portrait from the persona field of the family_member table, and construct the prompt word together with the character portrait, the retrieved chat records, and the fixed chat message;

[0127] ⑤Use prompt words to call the large language model and obtain the chat response of the virtual character.

[0128] Combination Figure 4 Based on the above-mentioned emotional companionship platform for elderly people at home, the present invention also proposes an emotional companionship method for elderly people at home, which comprises the following steps:

[0129] Step 1: The user registers through the character relationship management module and adds virtual relatives and friends;

[0130] Step 2: Use the social software terminal data collection module to obtain the chat data of the selected relatives and friends, and upload it to the server;

[0131] Step 3: The character portrait management module calls the large language model based on historical chat data to generate and update character portraits;

[0132] Step 4: Retrieve the most valuable chat records through the agent running module;

[0133] Step 5: Use character portraits, chat records, and chat messages of the elderly at home to construct prompt words;

[0134] Step 6: The generative agent operation module uses the prompt word to call the large language model to obtain chat feedback.

[0135] Example

[0136] The companion platform based on the method proposed in the present invention has been implemented in a research project of a retirement community in Chengde City. The content of the present invention provides an emotional companionship function as a subsystem of the home-based elderly care platform. The large language model uses the GLM series model or the Zhipu API to collect computer version WeChat data, obtain the chat record data of relatives and friends of elderly users, upload it to the server, and save it to the chat record table through the intelligent body memory module. The elderly chat with virtual relatives and friends through active awakening or passive inquiry. At this time, the generative intelligent body operation module calls the large language model to respond to the dialogue or initiate a dialogue, thereby realizing chatting with the elderly and providing emotional support.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. An emotional companionship platform for elderly people at home based on LLM character shaping, characterized by: It includes character relationship management module, social software terminal data collection module, intelligent character portrait management module, large language model module, intelligent memory module, intelligent operation module and server side; The character relationship management module is used for user registration and building and managing virtual relatives and friends of elderly people at home; The social software terminal data collection module is used to obtain the chat records of the selected social software, upload the historical chat records in batches to the server, and update the chat records regularly; The intelligent agent character portrait management module is used to obtain the latest chat records between the elderly at home and the chat object through the intelligent agent memory module, and then call the large language model to generate a character portrait or analyze and update the character portrait according to a preset period; Large language model module, used to provide large language models through local deployment or cloud services; The agent operation module is used to call the large language model for dialogue response based on the prompts formed by the character portrait and memory retrieval results; The intelligent agent memory module is used to save the chat records between the elderly at home and their virtual relatives and friends, and to construct chat prompts.

2. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 1, characterized in that: The character relationship management module includes: The account registration submodule is used for user account registration, including setting username and password; The add / delete friends and relatives submodule is used to add / delete a chat companion virtual character and assign a unique virtual friend and relative identification ID to each created chat companion virtual character; The login account submodule is used for registered elderly people to log in to this platform by entering their username and password.

3. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 2, characterized in that: The social software terminal data collection module includes: The chat record authorization submodule is used to pop up the authorization agreement when collecting the chat records of the user's social software, and obtain the access authorization of the chat records when the user accepts the agreement; The chat partner selection submodule is used to read the chat friend list of the social software and associate the selected friend with the virtual relatives and friends of the user account; The chat history batch upload submodule is used to upload the chat records between the selected chat object and the elderly at home to the server, and store the chat records into the intelligent body memory module according to the identification ID of the virtual relatives and friends; The chat information real-time update submodule is used to set the selected chat object as the monitoring object, read the newly generated chat information within this period of time according to the customized time, upload it to the server, and store it in the intelligent body memory module.

4. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 3, characterized in that: The server side is provided with a pgvector database, which includes a family_member table and a Member_memory table, wherein the family_member table is a virtual character table, whose persona field is used to store character portraits returned by the large language model, and the Member_memory table is a virtual character memory table, which is used to store chat records between home-based elderly people and virtual relatives and friends.

5. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 4, characterized in that: The specific steps for the agent character portrait management module to regularly update the character portrait include: Step 1: Based on the custom weight function in the Member_memory table, calculate the comprehensive weight according to the values ​​of the importance field and the last_updated_at field, sort the chat records of the agent according to the comprehensive weight, and retrieve the latest chat records; The weight function uses the following formula to calculate the comprehensive weight: p weight =(Recency*Wrecency+Importance*Wimportance) Among them, Importance is the value of the importance field, which is the length of the content field inserted when storing the chat record; Recency is the time correlation, and recency = r n , where n represents the number of days between the current time now and last_updated_at, r is the decay coefficient, r = 0.9; Step 2: The search results of step 1 and the old character portrait are constructed into prompts, and the large language model is called through the prompts. The large language model gives a new character portrait description; Step 3: Store the new character portrait description in the persona field of the family_member table, thereby updating the character portrait table.

6. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 5, characterized in that: The agent memory module constructs the companion chat prompt words by retrieving the most valuable records from the chat history, and the step of retrieving the most valuable records includes: Step 1: Based on the vector database, according to the distance relevancy between the text embedding vector of the current chat message and the text embedding vector of the historical chat record, the chat record data with the smallest relevancy is screened out; Step 2: Based on the chat records filtered in step 1, calculate the comprehensive priority p using the following formula: p=(Recency*W recency +Relevancy*W relevancy +Importance*W importance ) Among them, p is the comprehensive search priority, W recency , W relevancy , W importance is an adjustable weight parameter; Step 3: Sort the chat record data according to the value of p, and select the chat record with the highest priority to construct the prompt word.

7. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 4, characterized in that: The generative agent operation module supports passive response mode and active initiation mode, and is implemented by providing a passive response mode API and an active initiation mode API respectively.

8. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 4, characterized in that: The workflow of the passive response mode API is: S1: Get the token when the user logs in, use the token, and enter the virtual character ID and the chat message of the elderly at home when calling; S2: The server obtains the character portrait from the persona field of the family_member table based on the virtual character ID; S3: According to the virtual character ID, the chat history of the virtual character is obtained through the agent memory module; S4: construct prompt words according to the character portrait, the obtained chat records, and the chat message; S5: Use the constructed prompt words to call the large language model to obtain the chat response of the virtual character.

9. The emotional companionship platform for elderly people at home based on LLM character shaping as claimed in claim 4, characterized in that: The workflow of the active response mode API is: S1: Get the token when the user logs in, use the token, and enter the virtual character ID when calling; S2: According to the virtual character ID, the chat history of the virtual character is obtained through the agent memory module; S3: Select a fixed chat message pre-stored in this module; S4: Obtain a character portrait from the persona field of the family_member table according to the virtual character ID, and construct a prompt word by combining the character portrait, the retrieved chat records, and the fixed chat message; S5: Use the prompt words to call the large language model to obtain the chat response of the virtual character.

10. A method for emotional companionship of elderly people at home based on LLM character shaping, characterized in that: According to the implementation of the home-based elderly emotional companionship platform as claimed in claim 1, it includes the following steps: Step 1: The user registers through the character relationship management module and adds virtual relatives and friends; Step 2: Use the social software terminal data collection module to obtain the chat data of the selected relatives and friends, and upload it to the server; Step 3: The character portrait management module calls the large language model based on historical chat data to generate and update character portraits; Step 4: Save the chat records between the user and the virtual friends and relatives through the intelligent agent memory module, and construct the companion chat prompt words based on the chat records; Step 5: The generative agent operation module uses the character portrait and the companion chat prompt words to call the large language model to respond to the conversation and obtain chat feedback.

Citation Information

Patent Citations

  • Intelligent system for simulating accompanying of relatives and friends

    CN117373621A

  • Interaction system and chat robot for carrying out stylized dialogue based on large language model

    CN118606441A

  • Method for providing chat-bot service and user terminal therefor

    KR102642981B1

Cited By

  • Virtual human stylized interactive long-term emotion accompanying dialogue generation method

    CN121168497A