AI-based character interaction control method, device, equipment, and medium based on near-field recognition

By monitoring the trigger status of the near-field recognition module in real time, parsing the target role identifier and retrieving the role constraint dataset, generating a task context package, and combining it with the role constraint control content generation, the problems of cumbersome role switching and inconsistent interaction in the existing technology are solved, and automatic role switching and consistent interaction are achieved.

CN123067720APending Publication Date: 2026-11-10BEIJING QIBU QIBU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611294993.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

Existing smart terminals are cumbersome to operate when switching roles and are prone to misoperation, resulting in low convenience of role switching and low interaction continuity during the interaction process.

Method used

By monitoring the trigger status of the near-field recognition module in real time, parsing the target role identifier and retrieving the role constraint dataset, generating a task context package, and combining it with the role constraint control content, the scheduling queue is uniformly output and the session context data is updated to achieve automatic role switching.

Benefits of technology

Automatic character switching can be achieved without manual configuration, improving the efficiency and continuity of character-based interaction and ensuring consistency of character settings in the output content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123067720A_ABST
    Figure CN123067720A_ABST
Patent Text Reader

Abstract

This invention relates to the field of artificial intelligence and discloses an AI role interaction control method, apparatus, device, and medium based on near-field recognition. The method includes: real-time monitoring of the triggering state of the near-field recognition module; when a role triggering medium is detected, parsing to obtain the target role identifier and retrieving the corresponding role constraint dataset; acquiring the current interaction's session context data and the current interaction mode identifier, and generating a corresponding task context package; controlling the content generation process based on the role constraint dataset using role constraints, and generating response content that conforms to the target role's settings by combining the generated task context package; and assigning the response content to a unified output scheduling queue, executing the output according to preset priority rules, and updating the current session context data. Through entity-triggered automatic role switching, no manual configuration is required, and role constraints ensure consistency in the output content's persona, effectively improving the switching efficiency and interaction continuity of role-based interactions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to AI character interaction control methods, devices, equipment and media based on near-field recognition. Background Technology

[0002] In the field of AI interaction, existing smart speakers, voice-activated toys, or app voice assistants typically interact with users using a single default persona. Even if a device supports switching between multiple IP roles, the switching usually relies on the user manually selecting and configuring the role in the software interface. This process is cumbersome, prone to errors, and difficult to adapt to usage scenarios where multiple IP roles coexist. Furthermore, when generating interactive content after role switching, issues such as session state breaks and loss of role context can easily occur, affecting the convenience of role switching and the continuity of interaction during AI interaction. Summary of the Invention

[0003] The main objective of this invention is to provide an AI character interaction control method, device, equipment, and medium based on near-field recognition, aiming to solve the problems of low convenience of character switching and low interaction continuity in the prior art.

[0004] The technical solution of the present invention is as follows: The first aspect of this invention provides an AI character interaction control method based on near-field recognition, comprising: The triggering status of the near-field recognition module is monitored in real time. When a character triggering medium is detected, the target character identifier is parsed and obtained. Retrieve the corresponding role constraint dataset based on the target role identifier; Obtain the current interaction's session context data and the current interaction mode identifier, and generate the corresponding task context package based on the session context data and the current interaction mode identifier; Based on the aforementioned role constraint dataset, the content generation process is controlled by role constraints, and response content that conforms to the target role setting is generated in conjunction with the generated task context package. The response content is assigned to a unified output scheduling queue, and the output is executed according to a preset priority rule, while the current session context data is updated.

[0005] A second aspect of the present invention provides an AI character interaction control device based on near-field recognition, comprising: The near-field recognition module is used to monitor the triggering status of the near-field recognition module in real time. When a character triggering medium is detected, the target character identifier is parsed and obtained. The role data reading module is used to retrieve the corresponding role constraint dataset based on the target role identifier; The task construction module is used to obtain the current interaction's session context data and the current interaction mode identifier, and generate a corresponding task context package based on the session context data and the current interaction mode identifier. The constraint response module is used to control the content generation process based on the role constraint dataset and generate response content that conforms to the target role setting in combination with the generation task context package. The execution output module is used to include the response content into a unified output scheduling queue, execute the output according to a preset priority rule, and update the current session context data.

[0006] The data acquisition module is used to acquire current user dialogue information and confirm the target interaction role; The task construction module is used to obtain the corresponding role parameter set according to the target interaction role, and construct a dialogue generation task according to the role parameter set and the user dialogue information; The parameter confirmation module is used to encode the character parameter set into a corresponding character reference embedding vector, and determine the adaptive temperature parameter based on the current session round and the character complexity coefficient. The constraint decoding module is used to decode the dialogue generation task and inject contrastive learning constraints according to the role reference embedding vector and the adaptive temperature parameter during the decoding process to generate at least one candidate response. The response scoring module is used to calculate the scores of each candidate response in a preset dimension and fuse them to obtain the corresponding comprehensive score. The filtering output module is used to directly determine and output the target response from each candidate response based on the scores of each preset dimension and the comprehensive score, or to output the target response after role adaptation adjustment.

[0007] A third aspect of the present invention provides a computer device including at least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which enables the at least one processor to perform the aforementioned AI character interaction control method based on near-field recognition.

[0008] A fourth aspect of the present invention provides a computer-readable storage medium storing computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the aforementioned AI character interaction control method based on near-field recognition.

[0009] Beneficial Effects: This invention discloses an AI role interaction control method, device, equipment, and medium based on near-field recognition. Compared to existing technologies, this invention monitors the triggering state of the near-field recognition module in real time. When a role triggering medium is detected, the target role identifier is parsed and the corresponding role constraint dataset is retrieved. The current interaction's session context data and current interaction mode identifier are obtained, and a corresponding task context package is generated. Based on the role constraint dataset, role constraint control is applied to the content generation process, and response content conforming to the target role's settings is generated by combining the generated task context package. The response content is then placed into a unified output scheduling queue, executed according to preset priority rules, and the current session context data is updated. Through entity-triggered automatic role switching, no manual configuration is required. Furthermore, role constraints ensure consistency in the output content's persona, effectively improving the switching efficiency and interaction continuity of role-based interactions. Attached Figure Description

[0010] To more clearly illustrate the solutions in this invention, the accompanying drawings used in the description of the embodiments of this invention will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0011] Figure 1 A schematic diagram of an application environment for the AI ​​role interaction control method based on near-field recognition provided in an embodiment of the present invention; Figure 2 A flowchart of an AI character interaction control method based on near-field recognition provided in an embodiment of the present invention; Figure 3 A schematic diagram of the functional modules of the AI ​​character interaction control device based on near-field recognition provided in an embodiment of the present invention; Figure 4 A schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0012] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention is further described in detail below. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. The embodiments of the invention are described below in conjunction with the accompanying drawings.

[0013] The AI ​​character interaction control method based on near-field recognition provided in this invention can be applied to, for example... Figure 1The illustrated intelligent agent interaction scenario with integrated smart hardware includes a terminal device 101, smart hardware 102, a network 103, and a server 104. The network 103 serves as a medium for providing a communication link between the terminal device 101, smart hardware 102, and server 104. The network 103 can include various connection types, such as wired and / or wireless communication links (e.g., Bluetooth, Wi-Fi, NFC, etc.).

[0014] Users can use terminal device 101 and smart hardware 102 to interact with server 104 via network 103 to receive or send messages, etc. Terminal device 101 may have a client installed that supports virtual scenarios. For example, when the virtual scenario is pet companionship, the client could be a virtual pet application. Users can log in to the client to view, edit, or control the interactions of the bound smart agent in the virtual scenario (this is just an example). Terminal device 101 can be various electronic devices with a display screen and web browsing support, including but not limited to smartphones, tablets, and desktop computers.

[0015] The smart hardware 102 can be used with different toy carriers such as plush toys, desktop ornaments, and toy pendants. Character tags are set inside the toy carriers. The smart hardware 102 integrates a main control chip, microphone, speaker, near-field recognition module, communication module, and state cache module. It can sense physical identifiers such as character triggering medium and plot triggering medium through the near-field recognition module, automatically triggering corresponding interactive state changes, and completing seamless switching operations for character recognition, resource switching, and conversation migration, realizing a convenient interactive process of switching between multiple characters.

[0016] Server 104 can be a server providing various services, such as a backend server supporting the content browsed by users using terminal device 101 and smart hardware 102 (for example only). The backend server can analyze and process received user requests and other data, and feed the processing results back to the user through terminal device 101 and smart hardware 102. Server 104 can be a cloud server, a distributed system server, or a server integrated with blockchain.

[0017] It should be understood that the number of terminal devices 101, smart hardware 102, networks 103, and servers 104 mentioned above is merely illustrative. Depending on the implementation needs, there can be any number of terminal devices 101, smart hardware 102, networks 103, and servers 104. For example, a single user can correspond to one terminal device 101 and one smart hardware 102, and multiple users can achieve interactive linkage between target intelligent agents through the network.

[0018] like Figure 2As shown, the AI ​​character interaction control method based on near-field recognition provided in this embodiment of the invention specifically includes the following steps: S201. Real-time monitoring of the trigger status of the near-field recognition module. When a character trigger medium is detected, the target character identifier is parsed and obtained.

[0019] In this embodiment, the near-field identification module in the smart hardware 102 continuously operates in a low-power monitoring state, scanning and identifying surrounding physical triggering media. These triggering media are physical carriers containing unique identity information for a role, including NFC cards, RFID tags, Bluetooth near-field identifiers, magnetically encoded devices, etc., which store role identifiers, resource version numbers, permission verification codes, and optional configuration fields. When a role triggering medium enters the recognition range of the near-field identification module, an identification event is triggered. At this time, the near-field identification module reads the encoded information stored in the medium, and after decoding, integrity verification, and legality verification, parses it to obtain a unique target role identifier.

[0020] For example, a user can bring an NFC card with the image of a fairy tale IP character close to a smart plush toy with a built-in NFC recognition module. After the near-field recognition module detects a valid NFC signal, it reads the character ID, resource version number, and permission verification code stored in the card. After verification, it parses the data to obtain the target character identifier corresponding to the fairy tale IP character.

[0021] This embodiment triggers role switching through near-field automatic recognition, eliminating the need for users to manually select roles on the software interface. This simplifies the role switching process, reduces the probability of misoperation, and enhances the immersive experience of role-based interaction.

[0022] Furthermore, users can input interactive content in various ways to trigger interactions with the target character, such as character-triggered input, plot-triggered input, user voice input, user text input, and user-triggered action input. At the same time, corresponding input priorities are assigned to different types of input, with character-triggered input and plot-triggered input having higher priority than user voice input, user voice input having higher priority than mobile text input, and mobile text input having higher priority than background synchronous events.

[0023] If multiple inputs arrive concurrently within a preset time window, high-priority inputs are processed first, while low-priority inputs are queued, merged, or discarded. When a high-priority input causes a change in role or interaction mode, low-priority events that have not yet been executed in the old mode are automatically invalidated to avoid invalid events consuming system resources.

[0024] S202. Retrieve the corresponding role constraint dataset based on the target role identifier.

[0025] In this embodiment, after near-field recognition, the target role identifier is used as the index key to retrieve the role constraint dataset corresponding to that role from the role resource library. This role constraint dataset is used to constrain and verify the output results throughout the content generation process, ensuring that the AI's expression style, knowledge scope, and identity setting remain consistent with the target role during the interaction. Specifically, it can include role identity identifiers, title sets, catchphrase sets, tone intensity ranges, sentence length ranges, vocabulary preference tags, disabled expression dictionaries, knowledge domain whitelists, knowledge domain blacklists, topic priority tables, and voice broadcast parameters, etc., to ensure that the expression style and identity setting remain consistent with the target role during the interaction.

[0026] For example, when the parsed target character identifier corresponds to the "Fairy Tale Guide" character, the constraint dataset corresponding to that character is retrieved. This dataset contains core information such as the character's identity, common titles, tone style, applicable knowledge scope, and prohibited expression rules, which are used for subsequent content generation control.

[0027] This embodiment achieves synchronous loading of character switching and character setting constraints through a one-to-one mapping between character identifiers and constraint datasets. This ensures that the output content immediately adapts to the new character settings after a character switch, avoiding character setting confusion. S203. Obtain the current interaction's session context data and the current interaction mode identifier, and generate a corresponding task context package based on the session context data and the current interaction mode identifier.

[0028] In this embodiment, session context data is used to record the state information of historical interactions, ensuring the logical continuity of multi-turn dialogues. Interaction mode identifiers are used to mark the current interaction mode, including general chat mode, emotional companionship mode, storytelling mode, and music playback / generation mode, etc. The currently stored session context data and the currently active interaction mode identifier are obtained, and these two types of data are structurally integrated and formatted to generate a unified-format task context package, which serves as the input basis for subsequent content generation. For example, the most recent multi-turn dialogue records between the current user and the smart hardware are retrieved, and the current general chat mode is confirmed. The multi-turn dialogue records and the general chat mode identifier are integrated and encapsulated into a standardized task context package, which is then passed to the subsequent content generation stage.

[0029] This embodiment encapsulates session state and mode state through a unified task context package, providing a standardized input basis for subsequent content generation and ensuring the continuity and mode adaptability of multi-round interactions.

[0030] S204. Based on the role constraint dataset, perform role constraint control on the content generation process, and combine the generation task context package to generate response content that conforms to the target role setting.

[0031] In this embodiment, the role constraint dataset serves as the control boundary for content generation. Role constraint control is implemented throughout the entire content generation process. By combining conversational information, pattern information, and user input from the task context package, corresponding generation tasks are executed to generate response content that conforms to dialogue logic and strictly adheres to the target character's persona. For example, for the "Fairy Tale Guide" character, when generating dialogue responses, the character's identity, tone, and knowledge scope are consistently used as role constraints to generate child-friendly responses that fit the Fairy Tale Guide's persona, avoiding expressions and content that exceed the character's established boundaries. This embodiment effectively avoids the problem of AI-generated content deviating from the character's persona through end-to-end role constraint control, ensuring consistency and immersion in the role-based interaction.

[0032] S205. The response content is added to a unified output scheduling queue, output is performed according to a preset priority rule, and the current session context data is updated. In this embodiment, a pre-set unified output scheduling queue serves as the unified management entry point for all output content. The response content generated in this round of interaction first enters the scheduling queue for queuing management. All content to be output in the queue is sorted and arranged according to the preset priority rules. After determining the output timing based on the current output occupancy status of the device, the content is output.

[0033] After the output is completed, the current session context data will also be updated for the next round of interaction. Specifically, the character state, mode state, plot progress, user preference changes, and error logs of this interaction can be recorded synchronously for context calls and user profile updates in the next round of interaction. User preferences can also be updated periodically based on the accumulated interaction records, thereby optimizing the personalization of subsequent content generation.

[0034] For example, after the generated role-based chat reply enters the scheduling queue, it is determined that the current speaker is idle and there are no higher-priority events in the queue. Therefore, the response content is immediately broadcast through the smart hardware's speaker, and the current round of dialogue is updated in the session context. This embodiment achieves centralized management of various output contents through a unified output scheduling queue, avoiding conflicts and chaos caused by the simultaneous output of multiple types of content, while updating the session context in real time to ensure the continuity of state in multi-round interactions.

[0035] In the above embodiments, this invention discloses an AI role interaction control method based on near-field recognition. By monitoring the triggering state of the near-field recognition module in real time, when a role triggering medium is detected, the method parses the target role identifier and retrieves the corresponding role constraint dataset; it obtains the current interaction's session context data and the current interaction mode identifier, and generates a corresponding task context package; it controls the content generation process based on the role constraint dataset, and generates response content that conforms to the target role's settings by combining the generated task context package; it assigns the response content to a unified output scheduling queue, executes the output according to preset priority rules, and updates the current session context data. Through entity-triggered automatic role switching, no manual configuration is required, and role constraints ensure the consistency of the output content's persona, effectively improving the switching efficiency and interaction continuity of role-based interactions.

[0036] In one embodiment, step S203 includes: Obtain the current interaction's session context data, parse and extract historical interaction records and key status fields across rounds; Confirm whether the length of the current dialogue history exceeds a preset length threshold. If it exceeds the preset length threshold, perform truncation processing on the historical interaction record, retain the original dialogue fragment of the most recent preset number of rounds, and combine it with the cross-round key state field to generate the corresponding structured session state data. Obtain the current interaction mode identifier and retrieve the corresponding mode operation control parameters. Integrate and encapsulate the structured session state data with the mode operation control parameters to generate the corresponding generation task context package.

[0037] In this embodiment, when generating the task context package, after obtaining the session context data of the current interaction, the original session context data is first parsed and split into round-by-round historical interaction records and cross-round key state fields. Among them, the cross-round key state fields refer to the core state information that runs through multiple rounds of interaction and plays a decisive role in the interaction state, including the current role identifier, the current plot node, the user's long-term preference tags, resource permission markers, network status markers, etc. This type of information does not need to be repeatedly stored with each round of dialogue.

[0038] The total length of the current original dialogue history is then calculated and compared with a preset length threshold. If the dialogue history length does not exceed the threshold, all original interaction records are retained. If it exceeds the threshold, the historical interaction records are truncated, retaining only the original dialogue fragment from the most recent preset round, discarding earlier original dialogue content, while fully preserving all key state fields across rounds. By truncating the original dialogue and retaining core state fields, the total context length is controlled, the computational power consumption for generation is reduced, and the continuity and integrity of the interaction are preserved to the greatest extent.

[0039] After completing the session state processing, the current interaction mode identifier is obtained, and the corresponding mode operation control parameters are retrieved, such as the plot progression rules in story mode and the on-demand response rules in music mode. Finally, the structured session state data and mode operation control parameters are integrated and encapsulated according to a preset unified format to generate a standardized generation task context package, which can be directly used as input for subsequent content generation stages.

[0040] This embodiment combines dialogue history truncation with core state retention, which effectively controls the context length, reduces the computational overhead and response latency of content generation, and ensures that the core interactive state is not lost through cross-round key state fields, thus ensuring a balance between generation efficiency and session continuity.

[0041] In one embodiment, step S204 includes: Based on the role constraint dataset, a constraint hint is generated, and the constraint hint and the task context package are input into a preset content generation model to obtain candidate response content. The candidate response content is sequentially subjected to disabled expression verification, topic boundary verification, tone offset scoring, and knowledge domain matching scoring; When all the verification results and scoring results meet the corresponding preset consistency thresholds, the candidate response content is determined as the response content that conforms to the target role setting.

[0042] In this embodiment, role constraint control is implemented through a two-layer constraint mechanism of pre-generation guidance and post-validation. First, in the pre-generation stage, the core information in the role constraint dataset, such as character positioning, tone style, address rules, and topic preferences, is converted into natural language generation constraint prompts. These prompts, along with the generation task context package, are input into the content generation model to guide the model in generating candidate response content that initially conforms to the role settings.

[0043] In the post-generation stage, a rule engine performs multi-dimensional consistency checks on the candidate response content. These checks include: prohibited expression verification, which matches the candidate content against a dictionary of prohibited expressions in the role constraint dataset to detect the presence of forbidden words and expressions; topic boundary verification, which combines knowledge domain whitelists and blacklists to determine if the candidate content's topics exceed the allowed topic range for the role; tone deviation scoring, which quantifies the tone style of the candidate content based on tone intensity range, sentence length range, and vocabulary preferences in the role constraints to assess its deviation from the role's settings; and knowledge domain matching scoring, which determines whether the knowledge domain of the candidate content matches the role's knowledge domain settings. Only when all four checks pass and each score reaches its corresponding preset consistency threshold is the candidate response content deemed qualified and enters the output stage as the final response content. If any threshold is not met, the generation process is retried.

[0044] This embodiment employs a constraint mechanism that combines pre-processing guidance with post-processing multi-verification to ensure the consistency of content roles from both the generation source and the output gate. This significantly reduces the probability of AI output deviating from the character's persona and improves the stability and compliance of role-based interactions.

[0045] In one embodiment, prior to step S203, the method further includes: When a mode switching trigger signal is detected, extract the trigger source credibility, current mode occupancy status, character matching results, and story node lock status; The mode switching score is calculated based on the credibility of the trigger source, the current mode occupancy status, the character matching result, and the story node locking status. When the mode switching score is higher than a preset threshold, save a snapshot of the current interaction state and perform an interaction mode switch, and update the current interaction mode identifier based on the switched interaction mode.

[0046] In this embodiment, users can switch modes as needed during interaction. Mode switching trigger signals can originate from various sources, including plot trigger medium recognition, character trigger medium recognition, user voice commands with mode tags, mode commands issued by the mobile device, and preset event completion markers. Real-time monitoring of various trigger signals is performed. When a valid mode switching trigger signal is detected, several core parameters for mode switching judgment are extracted, including trigger source credibility, current mode occupancy status, character matching result, and plot node locking status. Trigger source credibility characterizes the reliability of the trigger signal; for example, physical medium triggers have higher credibility than voice command triggers. Current mode occupancy status indicates whether the current mode is executing an uninterruptible task. Character matching result indicates whether the target mode is compatible with the current character. Plot node locking status indicates whether the current state is at a critical plot node that cannot be skipped.

[0047] Then, the parameters are weighted according to the preset weight allocation to obtain a comprehensive mode switching score. The score is compared with a preset threshold. If the score is lower than the threshold, it is determined that the current mode is not suitable for switching, so the trigger signal is ignored and the current interaction mode is maintained. If the score is higher than the threshold, it is determined that the mode switching is allowed.

[0048] Before switching, a snapshot of the current interaction state is saved. This snapshot contains core state information such as the current character identifier, mode identifier, conversation summary, story progress, audio playback position, and pending events, for later state rollback or restoration. Furthermore, during the switching process, the matching between the target interaction mode and the current character identifier, as well as the authorization status of the resources corresponding to the target mode, are verified. Only when the character identifier matches and resource authorization is approved is the new mode allowed to take over the output chain, completing the mode switch. If the character identifier does not match or the resource is not authorized, the switching request is rejected, or a degraded mode with limited functionality is entered.

[0049] This embodiment determines the timing of mode switching through multi-dimensional scoring, combined with state snapshot saving and switching permission verification. This not only ensures the accuracy of mode switching and avoids accidental switching, but also effectively prevents state loss and role conflicts during the switching process, thereby improving the continuity and stability of multi-mode interaction.

[0050] In this embodiment, when a plot-triggered medium is detected, the method further includes: The plot triggering medium is parsed to obtain the plot identifier, chapter information and branching rules stored in the plot triggering medium, which serve as the corresponding plot constraints; Switch the current interaction mode to the narrative mode, and construct the current narrative node context through the narrative state machine and write the narrative constraints. The plot constraints corresponding to the current plot node context are merged with the character constraint dataset, and the content generation process is constrained and controlled based on the merged constraint data.

[0051] In this embodiment, users can also initiate convenient and efficient story switching operations through physical story triggering media. The story triggering media is a physical carrier that contains unique story identifiers and progress information, such as story cards, badges, base modules, toy accessories, and other physical accessories with unique identifiers. When the near-field recognition module detects the story triggering media, it reads and parses the story identifier, chapter number, branch rules, and entry conditions stored within the media, thereby forming story constraints.

[0052] At this point, the current interaction mode is automatically switched to the narrative mode, and the entire narrative flow is managed through a narrative state machine. This state machine is used to manage chapter progression, branch selection, progress saving, and progress rewinding. Based on the parsed narrative information, the corresponding narrative node is located, and the context of the current narrative node is constructed. At the same time, the set of allowed dialogues, optional branch conditions, and the set of topics that are prohibited from deviating from the narrative corresponding to that node are written into the narrative mode constraint table as exclusive constraints for the narrative mode.

[0053] In the content generation stage, the plot constraints and character constraints datasets are merged to form dual constraints. The plot constraints ensure that the interactive content always revolves around the current plot node and does not deviate from the main plot; the character constraints ensure that the dialogue and expressions in the plot always conform to the character's personality setting. When generating response content, the content generation process is constrained based on the merged constraint data. For example, it first determines whether to use preset dialogue, semi-structured dialogue generation, or restricted free generation based on the current plot node, and then combines the character constraints to complete the final content generation.

[0054] For example, when a user inserts the story badge corresponding to Chapter 1 of the "Forest Adventure" into the smart toy's base, near-field recognition switches to story mode, locating the story node of Chapter 1 of the Forest Adventure. In subsequent interactions, the user progresses the adventure story according to the plot while maintaining the current character's tone and identity in dialogue. This embodiment triggers the story mode switch through a physical medium, combined with story state machine management and a dual constraint mechanism, achieving consistency between plot progression and character design. This ensures both immersive and continuous story interaction while avoiding deviations in character design during the storyline.

[0055] In one embodiment, step S205 includes: The response content is encapsulated into corresponding output events according to event type and then placed into a unified output scheduling queue. The event types include character switching events, mode switching events, plot progression events, audio playback events, and ordinary chat events. All events to be output in the unified output scheduling queue are sorted according to the preset event priority, and the output timing of each event to be output is determined according to the sorting result and the corresponding output is executed.

[0056] In this embodiment, the response content is encapsulated into corresponding output events according to event type. Each output event includes information such as event type, role identifier, mode identifier, priority, output modality, timeliness flag, and interruptibility flag. Specific event types include role switching events, mode switching events, plot progression events, audio playback events, and ordinary chat events. After each response generates reply content, the encapsulated output events are added to a unified output scheduling queue, where they are centrally orchestrated and managed by the unified scheduling module.

[0057] When sorting and outputting events, the preset event priority rules are as follows: character switching events have higher priority than mode switching events, mode switching events have higher priority than story progression events, story progression events have higher priority than audio playback events, and audio playback events have higher priority than regular chat events. All events in the queue are sorted according to this priority rule, meaning higher-priority events have priority for output, or the output of lower-priority events can be interrupted. Based on the sorting results, the output timing for each event to be output is determined and the corresponding output is executed, ensuring that higher-priority events can be output as early as possible.

[0058] Preferably, when determining the output timing, the current speaker occupancy status, resource cache hit status, and network status can be further combined for a comprehensive judgment to decide whether to execute immediate output, delayed output, queued output, or interrupted rollback output. For example, when a high-priority role switching event arrives, if low-priority ordinary chat content is currently being played and that chat content is marked as interruptible, the current output is immediately interrupted, and the playback of the role switching event is executed first; if the current event is not interruptible, the high-priority event is executed only after the current event is completed.

[0059] This embodiment achieves unified and orderly management of various output contents such as role switching, mode switching, plot, audio, and chat through event-based encapsulation and hierarchical priority scheduling. It effectively avoids output conflicts when multiple content links are running concurrently and improves the coordination and smoothness of multi-mode interaction.

[0060] In one embodiment, the method further includes: Real-time monitoring of network status to determine whether the network is currently online, in a weak network state, or offline; When the network status is weak and the cloud response time exceeds a preset threshold, or when the network status is offline, the local cached character parameters, plot node data and cached audio resources are called to perform local interactive output. Once the network status returns to online, cloud content completion is performed based on the request identifier, role identifier, and timestamp in the local interaction record, and the subsequent interaction status is updated according to the completion result.

[0061] In this embodiment, adaptive interaction processing is also performed based on network status during the interaction process. Specifically, the network status is detected in real time and classified into online, weak network, or offline status according to indicators such as network latency, packet loss rate, and number of consecutive failures, and changes in network status are monitored in real time. The smart hardware locally pre-caches character parameters that have been called within the most recent preset time window, the status of the most recent preset number of plot nodes, and frequently used or popular audio resources to ensure basic interaction capabilities even in poor network environments.

[0062] When a weak network is detected, and the estimated response time from the cloud exceeds a preset latency threshold, or when the network is offline, the system automatically switches to local priority mode. In this mode, locally cached resources are used to perform locally executable operations such as role recognition and mode switching, and pre-set waiting messages, cached dialogue, or cached audio are output to ensure uninterrupted basic interaction and prevent prolonged periods of unresponsiveness.

[0063] Once the network is back online, the cloud completion process is automatically executed. At this time, the request identifier, character identifier, mode identifier, and timestamp are extracted from the local interaction record, and a completion request is sent to the cloud. If the cloud completion result corresponds to the same interaction event as the local output content, only the completed content is used to update the subsequent session state, and the completed segment is not replayed. If the character version or plot node has changed during completion, only the core state fields are synchronized, and the expired completion results are discarded to avoid state chaos.

[0064] This embodiment effectively improves the continuity of interaction in weak network and network outage scenarios through network state division and local cloud collaboration mechanism, avoiding interaction interruption caused by network fluctuations. At the same time, through precise cloud completion logic, it ensures the consistency of the state after the network is restored, taking into account both offline availability and the integrity of online experience.

[0065] In one embodiment, the method further includes a resource authorization verification step, specifically including: Perform resource authorization verification based on the target character identifier. The verification content includes the character's available scope, the scope of plot resource access, the scope of audio resource access, and the user account permissions. When the authorization verification passes, the corresponding role constraint dataset and associated resources are retrieved; when the authorization verification fails, the corresponding role resources are not loaded and a prompt message is output.

[0066] In this embodiment, to adapt to application scenarios involving multiple copyright holders, access control is used to distinguish the resource access boundaries between self-created IPs and authorized IPs, and to manage the mapping relationships between different accounts, devices, and role resources. Before loading role resources, multi-dimensional resource authorization verification is performed based on the target role identifier, including the available scope of the role on the current account and device, the available scope of corresponding story resources and song resources, and the permission level of the current user account.

[0067] If the authorization verification passes, the corresponding role constraint dataset and various associated resources are loaded normally. If the verification fails, such as due to expired authorization, unauthorized device, or insufficient account permissions, the corresponding resources for that role will be refused to be loaded, and a message indicating insufficient permissions will be displayed to the user. This pre-implemented resource authorization verification mechanism strictly defines the boundaries of resource calls from different IPs, effectively avoiding compliance risks associated with the mixed use of copyrighted resources and ensuring copyright security in multi-IP collaboration scenarios.

[0068] It should be noted that there is no necessary order between the above steps. Those skilled in the art will understand from the description of the embodiments of the present invention that the above steps may have different execution orders in different embodiments, that is, they may be executed in parallel or in turn, etc.

[0069] Further reference Figure 3 As a response to the above Figure 2 The present invention provides an embodiment of an AI character interaction control device based on near-field recognition, which implements the method shown. Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0070] like Figure 3 As shown, the AI ​​character interaction control device 30 based on near-field recognition described in this embodiment includes: The near-field recognition module 301 is used to monitor the triggering status of the near-field recognition module in real time. When a character triggering medium is detected, the target character identifier is parsed and obtained. The role data reading module 302 is used to retrieve the corresponding role constraint dataset based on the target role identifier; The task construction module 303 is used to obtain the current interaction's session context data and the current interaction mode identifier, and generate a corresponding task context package based on the session context data and the current interaction mode identifier. The constraint response module 304 is used to control the content generation process based on the role constraint dataset and generate response content that conforms to the target role setting in combination with the generation task context package. The execution output module 305 is used to include the response content into a unified output scheduling queue, execute the output according to a preset priority rule, and update the current session context data.

[0071] The module referred to in this invention is a series of computer program instruction segments that can perform specific functions. It is more suitable than a program for describing the execution process of AI character interaction control based on near-field recognition. For specific implementation methods of each module, please refer to the corresponding method embodiments above, which will not be repeated here.

[0072] In one embodiment, the task construction module 303 includes: The context acquisition unit is used to acquire the session context data of the current interaction, parse and extract the historical interaction records and key status fields across rounds; The conversation truncation unit is used to confirm whether the length of the current conversation history exceeds a preset length threshold. If it exceeds the preset length threshold, the historical interaction record is truncated, the original conversation fragment of the most recent preset number of rounds is retained, and the corresponding structured conversation state data is generated by combining the cross-round key state fields. The task generation correspondence is used to obtain the current interaction mode identifier and retrieve the corresponding mode operation control parameters, integrate and encapsulate the structured session state data with the mode operation control parameters, and generate the corresponding task generation context package.

[0073] In one embodiment, the constraint response module 304 includes: The response generation unit is used to construct a constraint hint based on the role constraint dataset, and input the constraint hint and the task context package into a preset content generation model to obtain candidate response content. The verification and scoring unit is used to sequentially perform disabled expression verification, topic boundary verification, tone offset scoring, and knowledge domain matching scoring on the candidate response content. The content determination unit is used to determine the candidate response content as the response content that conforms to the target role setting when all the verification results and scoring results meet the corresponding preset consistency thresholds.

[0074] In one embodiment, the device 30 further includes: The module switching detection module is used to extract the credibility of the trigger source, the current mode occupancy status, the character matching result, and the story node locking status when a mode switching trigger signal is detected. The mode score calculation module is used to calculate the mode switching score based on the credibility of the trigger source, the current mode occupancy status, the character matching result, and the story node locking status. The mode switching module is used to save a snapshot of the current interaction state and perform an interaction mode switch when the mode switching score is higher than a preset threshold, and update the current interaction mode identifier based on the switched interaction mode.

[0075] In one embodiment, the device 30 further includes: The plot analysis module is used to analyze the plot triggering medium when a plot triggering medium is detected, and obtain the plot identifier, chapter information and branching rules stored in the plot triggering medium as corresponding plot constraints; The plot constraint module is used to switch the current interaction mode to the plot performance mode, and to construct the current plot node context through the plot state machine and write it into the plot constraint; The plot control module is used to merge the plot constraints corresponding to the current plot node context with the character constraint dataset, and to control the content generation process based on the merged constraint data.

[0076] In one embodiment, the execution output module 305 includes: The response content is encapsulated into corresponding output events according to event type and then placed into a unified output scheduling queue. The event types include character switching events, mode switching events, plot progression events, audio playback events, and ordinary chat events. All events to be output in the unified output scheduling queue are sorted according to the preset event priority, and the output timing of each event to be output is determined according to the sorting result and the corresponding output is executed.

[0077] In one embodiment, the device 30 further includes: The network detection module is used to detect the network status in real time and confirm whether the network is currently online, in a weak network state, or offline. The local interaction module is used to call the character parameters, plot node data and cached audio resources in the local cache to perform local interaction output when the network status is weak and the cloud response time exceeds a preset threshold, or when the network status is offline. The network recovery module is used to perform cloud content completion based on the request identifier, role identifier and timestamp in the local interaction record after the network status is restored to online status, and update the subsequent interaction status according to the completion result.

[0078] In the above embodiments, this invention discloses an AI role interaction control device based on near-field recognition. By monitoring the triggering state of the near-field recognition module in real time, when a role triggering medium is detected, the device parses the target role identifier and retrieves the corresponding role constraint dataset; it obtains the current interaction's session context data and the current interaction mode identifier, and generates a corresponding task context package; it controls the content generation process based on the role constraint dataset, and generates response content that conforms to the target role's settings by combining the generated task context package; it assigns the response content to a unified output scheduling queue, executes the output according to preset priority rules, and updates the current session context data. Through entity-triggered automatic role switching, no manual configuration is required, and role constraints ensure consistency in the output content's persona, effectively improving the switching efficiency and interaction continuity of role-based interactions.

[0079] Specific limitations regarding the AI ​​character interaction control device based on near-field recognition can be found in the limitations of the AI ​​character interaction control method based on near-field recognition mentioned above, and will not be repeated here. Each module in the aforementioned AI character interaction control device based on near-field recognition can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0080] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0081] Another embodiment of the present invention provides a computer device, such as... Figure 4 As shown, computer device 40 includes: One or more processors 401 and memory 402, Figure 4 The following section uses a processor 401 as an example. The processor 401 and the memory 402 can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.

[0082] The processor 401 is used to perform various control logics of the computer device 40. It can be any conventional processor, microprocessor, state machine, general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), microcontroller, ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components.

[0083] The memory 402, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions corresponding to the AI ​​role interaction control method based on near-field recognition in the embodiments of the present invention. The processor 401 executes various functional applications and data processing of the computer device 40 by running the non-volatile software programs, instructions, and units stored in the memory 402, thereby implementing the AI ​​role interaction control method based on near-field recognition in the above method embodiments.

[0084] Another embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by one or more processors, perform the steps of the AI ​​character interaction control method based on near-field recognition in any of the above method embodiments.

[0085] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0086] Based on the above description of the embodiments, those skilled in the art will understand that the methods described in the embodiments can be implemented using software plus necessary general-purpose hardware platforms. Of course, they can also be implemented using hardware, but in many cases, the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0087] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.). The computer program can be stored in a non-volatile, computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The storage medium can be a memory, magnetic disk, floppy disk, flash memory, optical storage, etc.

[0088] It should be noted that any AI models, software tools, or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application has been authorized (with the knowledge and consent) by the relevant parties or has been fully authorized by all parties, and the executing entity may obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.

[0089] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. An AI character interaction control method based on near-field recognition, characterized in that, include: The triggering status of the near-field recognition module is monitored in real time. When a character triggering medium is detected, the target character identifier is parsed and obtained. Retrieve the corresponding role constraint dataset based on the target role identifier; Obtain the current interaction's session context data and the current interaction mode identifier, and generate the corresponding task context package based on the session context data and the current interaction mode identifier; Based on the aforementioned role constraint dataset, the content generation process is controlled by role constraints, and response content that conforms to the target role setting is generated in conjunction with the generated task context package. The response content is assigned to a unified output scheduling queue, output according to a preset priority rule, and the current session context data is updated.

2. The AI ​​character interaction control method based on near-field recognition according to claim 1, characterized in that, The step of obtaining the current interaction's session context data and the current interaction mode identifier, and generating a corresponding task context package based on the session context data and the current interaction mode identifier, includes: Obtain the current interaction's session context data, parse and extract historical interaction records and key status fields across rounds; Confirm whether the length of the current dialogue history exceeds a preset length threshold. If it exceeds the preset length threshold, perform truncation processing on the historical interaction record, retain the original dialogue fragment of the most recent preset number of rounds, and combine it with the cross-round key state field to generate the corresponding structured session state data. Obtain the current interaction mode identifier and retrieve the corresponding mode operation control parameters. Integrate and encapsulate the structured session state data with the mode operation control parameters to generate the corresponding generation task context package.

3. The AI ​​character interaction control method based on near-field recognition according to claim 1, characterized in that, The step of controlling the content generation process based on the role constraint dataset and generating response content that conforms to the target role settings, combined with the generation task context package, includes: Based on the role constraint dataset, a constraint hint is generated, and the constraint hint and the task context package are input into a preset content generation model to obtain candidate response content. The candidate response content is sequentially subjected to disabled expression verification, topic boundary verification, tone offset scoring, and knowledge domain matching scoring; When all the verification results and scoring results meet the corresponding preset consistency thresholds, the candidate response content is determined as the response content that conforms to the target role setting.

4. The AI ​​character interaction control method based on near-field recognition according to claim 1, characterized in that, Before obtaining the current interaction's session context data and the current interaction mode identifier, and generating the corresponding task context package based on the session context data and the current interaction mode identifier, the method further includes: When a mode switching trigger signal is detected, extract the trigger source credibility, current mode occupancy status, character matching results, and story node lock status; The mode switching score is calculated based on the credibility of the trigger source, the current mode occupancy status, the character matching result, and the story node locking status. When the mode switching score is higher than a preset threshold, save a snapshot of the current interaction state and perform an interaction mode switch, and update the current interaction mode identifier based on the switched interaction mode.

5. The AI ​​character interaction control method based on near-field recognition according to claim 1, characterized in that, When a plot-triggered medium is detected, the method further includes: The plot triggering medium is parsed to obtain the plot identifier, chapter information and branching rules stored in the plot triggering medium, which serve as the corresponding plot constraints; Switch the current interaction mode to the narrative mode, and construct the current narrative node context through the narrative state machine and write the narrative constraints therein; The plot constraints corresponding to the current plot node context are merged with the character constraint dataset, and the content generation process is constrained and controlled based on the merged constraint data.

6. The AI ​​character interaction control method based on near-field recognition according to claim 1, characterized in that, The step of including the response content in a unified output scheduling queue, executing the output according to a preset priority rule, and updating the current session context data includes: The response content is encapsulated into corresponding output events according to event type and then placed into a unified output scheduling queue. The event types include character switching events, mode switching events, plot progression events, audio playback events, and ordinary chat events. All events to be output in the unified output scheduling queue are sorted according to the preset event priority, and the output timing of each event to be output is determined according to the sorting result and the corresponding output is executed.

7. The AI ​​character interaction control method based on near-field recognition according to claim 1, characterized in that, The method further includes: Real-time monitoring of network status to determine whether the network is currently online, in a weak network state, or offline; When the network status is weak and the cloud response time exceeds a preset threshold, or when the network status is offline, the local cached character parameters, plot node data and cached audio resources are called to perform local interactive output. Once the network status returns to online, cloud content completion is performed based on the request identifier, role identifier, and timestamp in the local interaction record, and the subsequent interaction status is updated according to the completion result.

8. An AI character interaction control device based on near-field recognition, characterized in that, include: The near-field recognition module is used to monitor the triggering status of the near-field recognition module in real time. When a character triggering medium is detected, the target character identifier is parsed and obtained. The role data reading module is used to retrieve the corresponding role constraint dataset based on the target role identifier; The task construction module is used to obtain the current interaction's session context data and the current interaction mode identifier, and generate a corresponding task context package based on the session context data and the current interaction mode identifier. The constraint response module is used to control the content generation process based on the role constraint dataset and generate response content that conforms to the target role setting in combination with the generation task context package. The execution output module is used to include the response content into a unified output scheduling queue, execute the output according to a preset priority rule, and update the current session context data.

9. A computer device, characterized in that, Includes at least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the AI ​​character interaction control method based on near-field recognition as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, cause the one or more processors to perform the AI ​​character interaction control method based on near-field recognition as described in any one of claims 1-7.