A method for identifying unread contacts and saving drafts in desktop chat
By freezing a snapshot of the conversation list in the desktop chat system and delaying the identification of unread contacts, and combining conversation identifiers and message fingerprints for deduplication, merging, and stateful storage, the problem of unstable unread contact identification is solved, and stable and reliable unread contact identification and draft accumulation are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
- Filing Date
- 2026-04-27
- Publication Date
- 2026-07-21
Smart Images

Figure CN122431778A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of human-computer interaction and intelligent information processing technology, and in particular to a method for identifying unread contacts and storing drafts in desktop chat. Background Technology
[0002] In desktop chat assistance systems, the main workflow typically focuses on taking screenshots of the current active conversation, performing optical character recognition, knowledge retrieval, and reply generation to help users efficiently handle the current dialogue. However, in real-world office scenarios, users often have multiple unread contacts simultaneously. If the assistance system only processes the current conversation and cannot reliably discover and retain other unread contacts, a situation arises where "the current issue has been resolved, but other unreads have been missed," resulting in incomplete system coverage and a degraded user experience.
[0003] Therefore, it is necessary to identify and record unread contacts in the chat client's left-hand conversation list simultaneously with or after the current conversation is being processed. However, existing technologies have the following shortcomings and drawbacks in the above scenario:
[0004] 1. The unread list is a dynamic interface, and real-time scanning can easily lead to missed detections. The chat client's left-hand conversation list continuously changes as new messages arrive, conversations are pinned to the top, the window scrolls, or the focus changes. If the system scans the current interface after the main flow has ended, unread contacts that were present at the beginning of the main flow may have shifted in position or even disappeared, resulting in missed detections.
[0005] 2. The main process and unread scanning interfere with each other, affecting system stability. If the system performs unread scanning while simultaneously relying on the current window state during screenshotting, OCR, and response generation, it is easily affected by interface redrawing, window activation, and user operations, resulting in unstable recognition results for both links and difficulty in locating the source of the problem.
[0006] 3. Unread identification results lack stateful accumulation, making it difficult to form a task that can be processed sustainably. Even if many solutions can find unread contacts at a certain moment, they only return a momentary contact list, lacking the draft pool, state transition, and persistence mechanisms required for subsequent processing. As a result, the system cannot transform "finding unreads" into "a task that can be processed later".
[0007] 4. Repeated scanning can easily lead to a backlog of repetitive tasks. The same contact may be identified multiple times in a short period of time. Without a deduplication mechanism for contact identifiers and message fingerprints, the system will repeatedly create duplicate draft records, increasing noise in subsequent processing and reducing task management efficiency.
[0008] 5. Lack of a smooth rollback mechanism when snapshot chain fails. If the system relies solely on frozen screenshots for offline analysis, the opportunity to discover unread items will be lost if the snapshot is empty, recognition fails, or timeout occurs; if it always relies on real-time scanning, it cannot avoid the instability brought about by the dynamic interface.
[0009] Chinese patent CN113300941A discloses a display method for mobile communication application call scenarios. However, it does not take into account the engineering special characteristics of "current main conversation flow and unread scan coexisting" common in desktop chat auxiliary systems, nor does it solve the time-series drift problem of unread contact recognition under dynamic interface, and therefore cannot be applied to desktop chat auxiliary scenarios.
[0010] Therefore, how to provide a method that can both retain a stable observation surface of the unread list at the beginning of the main process, automatically revert to real-time scanning when the snapshot chain fails, and deduplicate the identification results and save them as a sustainable processing draft has become an urgent technical problem to be solved. Summary of the Invention
[0011] In view of this, in order to overcome the shortcomings of the prior art, the present invention aims to provide a method for identifying unread contacts and storing drafts in desktop chat.
[0012] This invention provides a method for identifying unread contacts and storing drafts in desktop chat, the method comprising:
[0013] Step S1: Before the main processing flow of the current session in the target chat window begins, perform a snapshot capture on the session list area of the target chat window to obtain a session list snapshot;
[0014] Step S2: After the current main processing flow is completed, perform unread contact identification based on the session list snapshot to obtain unread contact candidates;
[0015] Step S3: When the identification based on the conversation list snapshot fails or no unread contact candidates are obtained, automatically fall back to performing a real-time unread scan on the target chat window to obtain unread contact candidates;
[0016] Step S4: Based on the session identifier and message fingerprint of the unread contact candidate, merge them into the local draft pool and perform stateful persistent storage.
[0017] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, step S1 specifically includes the following operations executed in sequence: taking a screenshot of the currently active chat window, performing optical character recognition on the screenshot image to extract chat text content, performing a knowledge retrieval operation based on the identified chat text content, and generating reply content based on the retrieval results; during the execution of the current chat main processing flow, no unread contact scanning or identification operation is performed.
[0018] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, step S1 involves taking a snapshot of the conversation list area of the target chat window in the following manner: before the user triggers the main identification process of the current chat window, the visible area of the left conversation list in the bound chat window is captured through the image capture interface, and the capture result is saved as image byte data; the conversation list snapshot is used to record the unread list interface state at the start of the main processing flow.
[0019] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, in step S2, unread contact identification is performed based on the conversation list snapshot in the following manner: after the current main processing flow is completed, a pre-saved conversation list snapshot is read, image recognition processing is performed on the conversation list snapshot, and unread contact information including at least the contact display name, latest message preview, unread prompt information, and the horizontal and vertical coordinate ratios used to locate the position of the contact list are extracted from the recognition result, wherein the horizontal and vertical coordinate ratios are normalized relative position coordinates.
[0020] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, step S3 automatically reverts to performing real-time unread scanning on the target chat window as follows: Firstly, the interface automation control tree is used to perform control-level traversal of the left-side conversation list of the current chat window, identifying conversation items with unread markers and extracting contact information; when the interface automation control tree identifies that no valid contact has been returned within a preset timeout period, the identification timeout occurs, the returned result is empty, or the identification result does not meet the preset integrity conditions, it automatically reverts to a conversation list identification method based on a visual model, performing visual model analysis on the real-time image of the current conversation list area to identify unread contact information.
[0021] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, the specific method for merging unread contact candidates into the local draft pool based on the session identifier and message fingerprint is as follows:
[0022] Perform normalization preprocessing on the identified contact display name, which includes at least removing leading and trailing whitespace characters, unifying the case of uppercase and lowercase characters, and removing invisible control characters;
[0023] The normalized contact display name is used as the stable session identifier for the contact; the normalized contact display name is concatenated with the latest message preview, and a hash operation is performed on the concatenated string, with the hash value used as the message fingerprint of the message context to be processed;
[0024] Before writing unread contact candidates to the draft pool, first check if there is an existing draft with the same session identifier in the draft pool. If there is, and the message fingerprint is consistent, then only update the latest message preview, unread notification information, or location coordinate ratio in the existing draft. If there is no existing draft or the fingerprint is inconsistent, then create a new contact draft record.
[0025] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, in step S4, the newly created contact draft record includes the following field information: contact display name, latest message preview, message fingerprint, horizontal and vertical coordinate ratio for locating the position of the contact list, detection timestamp, and draft status. The draft status is initialized to a pending state when it is created, and the detection timestamp is used to record the time when the unread contact is first identified.
[0026] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, the specific method for stateful persistent storage in step S4 is as follows: the contact drafts are divided into four states: pending state, processing state, blocked state, and processing failed state; when an unread contact is first identified and written into the draft pool, its draft state is marked as pending state; when the subsequent processing flow of the contact draft begins, the state of the draft is changed from pending state to processing state; when it is determined according to the preset strategy that the contact draft is not allowed to continue processing, the state of the draft is changed to blocked state; when an abnormality or failure occurs in the identification or processing of the contact draft, the state of the draft is changed to processing failed state, and retry processing of the contact draft in the state is allowed.
[0027] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, in step S4, when performing state-based persistent storage, all contact drafts and their corresponding state information in the draft pool are serialized into a structured data format and written into a state file in the local file system.
[0028] Optionally, in the desktop chat unread contact identification and draft accumulation method of the present invention, the persistence operation in step S4 is a synchronous write operation, which ensures that the status file is updated in a timely manner every time the draft pool changes. When the system starts, the interface is refreshed, or the user reopens the contact task list, the contact draft data is read from the local status file and deserialized to restore the draft pool state of the last run.
[0029] The desktop chat unread contact identification and draft accumulation method of the present invention has the following beneficial technical effects:
[0030] I. Significantly reduces the risk of missed readings due to dynamic interfaces.
[0031] It effectively avoids the problem of unread list drifting caused by session scrolling, pinning changes, new message arrivals or focus switching during the main process execution, and significantly reduces the risk of missing unread contacts.
[0032] II. Decoupling the timing of unread scan from the current session's main flow.
[0033] This avoids recognition instability caused by competition for the same real-time interface state, thereby improving the independent stability and overall reliability of the main process and the unread discovery links.
[0034] Third, it has the ability to smoothly roll back when the snapshot chain fails.
[0035] This ensures that even if the snapshot chain fails, the ability to discover unread items remains, avoiding the drawback of losing discovery opportunities due to a single path failure.
[0036] IV. Effectively suppress the accumulation of duplicate drafts
[0037] It avoids the same contact being repeatedly entered into the pool due to repeated scanning, and can accurately identify the draft update needs in the context of new messages, effectively reducing task management noise.
[0038] V. Achieve stateful storage and sustainable processing of unread discovery results
[0039] Even after the interface is refreshed, the program is restarted, or there is a manual interruption, the draft pool can still be restored to continue to complete unprocessed tasks, thus establishing a stable front-end intermediate layer for subsequent processing of contacts one by one. Attached Figure Description
[0040] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart illustrating the desktop chat unread contact identification and draft accumulation method according to an exemplary embodiment 1 of the present invention;
[0042] Figure 2This is a flowchart illustrating the automatic rollback of the desktop chat unread contact identification and draft accumulation method according to Exemplary Embodiment 1 of the present invention to perform real-time unread scanning on the target chat window;
[0043] Figure 3 This is a schematic diagram illustrating the process of merging unread contact candidates into a local draft pool in the desktop chat unread contact identification and draft accumulation method according to exemplary embodiment 1 of the present invention. Detailed Implementation
[0044] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0045] It should be noted that, in the absence of conflict, the following embodiments and features can be combined with each other; and, based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0046] It should be noted that various aspects of embodiments within the scope of the appended claims are described below. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this disclosure, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or method can be implemented using structures and / or functionalities other than one or more of the aspects set forth herein.
[0047] Example 1
[0048] Exemplary embodiment 1 of the present invention provides a method for identifying unread contacts and storing drafts in desktop chat. Figure 1 This is a flowchart illustrating the desktop chat unread contact identification and draft accumulation method according to Exemplary Embodiment 1 of the present invention, as follows: Figure 1 As shown, in this embodiment, the method of the present invention is implemented in the following manner:
[0049] Step S1: Before the main processing flow of the current session in the target chat window begins, perform a snapshot capture on the session list area of the target chat window to obtain a session list snapshot.
[0050] In this embodiment, the current main processing flow specifically includes the following operations executed in sequence: taking a screenshot of the currently active chat window, performing optical character recognition on the screenshot image to extract the chat text content, performing a knowledge retrieval operation based on the recognized chat text content, and generating reply content based on the retrieval results; during the execution of the current main processing flow, no unread contact scanning or recognition operations are performed.
[0051] In this embodiment, a snapshot of the conversation list area of the target chat window is captured in the following manner: before the user triggers the main recognition process of the current chat window, the visible area of the left conversation list in the bound chat window is captured through the image capture interface, and the capture result is saved as image byte data; this conversation list snapshot is used to record the unread list interface state at the start of the main processing flow.
[0052] Step S2: After the current session main processing flow is completed, perform unread contact identification based on the session list snapshot to obtain unread contact candidates.
[0053] In this embodiment, unread contact identification is performed based on the conversation list snapshot in the following manner: After the current main processing flow is completed, a pre-saved conversation list snapshot is read, image recognition processing is performed on the conversation list snapshot, and unread contact information, including at least the contact display name, latest message preview, unread prompt information, and the horizontal and vertical coordinate ratios used to locate the position of the contact list, is extracted from the recognition result. The horizontal and vertical coordinate ratios are normalized relative position coordinates.
[0054] Step S3: When identification based on the conversation list snapshot fails or no unread contact candidates are obtained, automatically fall back to performing a real-time unread scan on the target chat window to obtain unread contact candidates.
[0055] Figure 2 This is a schematic diagram illustrating the process of automatically reverting to performing a real-time unread scan of the target chat window in the desktop chat unread contact identification and draft accumulation method according to exemplary embodiment 1 of the present invention. Figure 2 As shown, in this embodiment, the automatic fallback is performed as follows: The target chat window is scanned for unread messages in real-time using the interface automation control tree. This firstly, the left-side conversation list of the current chat window is traversed at the control level to identify conversation items marked as unread and extract contact information. If the interface automation control tree identifies that no valid contact has been returned within a preset timeout period, the identification timeout occurs, the returned result is empty, or the identification result does not meet the preset integrity conditions, the automatic fallback is to a visual model-based conversation list identification method. Visual model analysis is then performed on the real-time image of the current conversation list area to identify unread contact information.
[0056] Step S4: Based on the session identifier and message fingerprint of the unread contact candidate, merge them into the local draft pool and perform stateful persistent storage.
[0057] Figure 3 This is a schematic diagram illustrating the process of merging unread contact candidates into a local draft pool according to the desktop chat unread contact identification and draft accumulation method of exemplary embodiment 1 of the present invention. Figure 3 As shown in this embodiment, the specific method for merging unread contact candidates into the local draft pool based on their session identifiers and message fingerprints is as follows:
[0058] The identified contact display name undergoes normalization preprocessing, which includes at least removing leading and trailing whitespace, standardizing case, and removing invisible control characters. The normalized contact display name is then used as the stable session identifier for that contact. The normalized contact display name is concatenated with the latest message preview, and a hash operation is performed on the concatenated string. The hash value is used as the message fingerprint of the message context to be processed. Before writing unread contact candidates to the draft pool, it is first checked whether an existing draft with the same session identifier already exists in the draft pool. If it exists and the message fingerprint is consistent, only the latest message preview, unread notification information, or position coordinate ratio in the existing draft are updated. If it does not exist or the fingerprint is inconsistent, a new contact draft record is created.
[0059] In this embodiment, the newly created contact draft record includes the following fields: contact display name, latest message preview, message fingerprint, horizontal and vertical coordinate ratios for locating the position in the contact list, detection timestamp, and draft status. The draft status is initialized to a pending state upon creation, and the detection timestamp is used to record the time when the unread contact is first identified.
[0060] As an optional example, in this embodiment, the specific method for stateful persistent storage is as follows: Contact drafts are divided into four states: pending, processing, blocked, and processing failed. When an unread contact is first identified and written to the draft pool, its draft state is marked as pending. When subsequent processing of the contact draft begins, the draft state is changed from pending to processing. When a preset policy determines that further processing of the contact draft is not allowed, the draft state is changed to blocked. When an abnormality or failure occurs in the identification or processing of the contact draft, the draft state is changed to processing failed, and retry processing of the contact draft in this state is allowed.
[0061] It should be noted that, in this embodiment, when performing stateful persistent storage, all contact drafts and their corresponding state information in the draft pool are serialized into a structured data format and written to a state file in the local file system.
[0062] The persistence operation in this embodiment is a synchronous write operation, which ensures that the state file is updated in a timely manner every time the draft pool changes. When the system starts, the interface is refreshed, or the user reopens the contact task list, the contact draft data is read from the local state file and deserialized to restore the draft pool state of the last run.
[0063] Example 2
[0064] Exemplary embodiment 2 of the present invention provides a method for identifying unread contacts and storing drafts in desktop chat. In this embodiment, a snapshot of the conversation list on the left side of the chat client is captured before the main identification process begins, and unread contact analysis is performed based on the snapshot after the main process is completed. When the frozen snapshot is empty, the analysis fails, the identification times out, or no unread contact is identified, the process automatically reverts to the real-time unread scan of the current chat window. Subsequently, the identified contact information is merged into the local draft pool according to the contact identifier and message fingerprint, and the contact drafts are persisted in a state machine manner for subsequent processing.
[0065] Specifically, the method in this embodiment is implemented according to the following steps:
[0066] Step 1: Freeze the session list snapshot before the main process.
[0067] Before the user triggers the main recognition process of the current chat window, a snapshot is taken of the conversation list area on the left side of the target chat window. This snapshot does not depend on the real-time interface after the main process ends, but records the state of the unread list interface at the start of the main process. This snapshot can be saved as image byte data for direct reuse in subsequent latency analysis.
[0068] Step 2: Execute the current session master identification process.
[0069] Based on the bound chat window, the system performs screenshotting, OCR recognition, knowledge retrieval, and response generation for the current active session. During the main process, the system does not immediately interrupt the main process to iterate through other unread contacts, but instead retains a snapshot of the session list frozen in step one.
[0070] Step 3: Delayed execution of unread analysis after the main process
[0071] After the main flow of the current session is completed, read the session list snapshot saved in step one; extract the unread contact name, the latest message preview, and the coordinate ratio information required for subsequent click positioning based on the snapshot; delay analysis separates the unread discovery from the current session OCR link time sequence, reducing the impact of interface changes during the main flow on the unread scan results.
[0072] Step 4: Real-time rollback scan after snapshot expiration
[0073] When a frozen snapshot does not exist, snapshot-based recognition fails, times out, or no unread contacts are identified, the system automatically reverts to performing a real-time unread scan on the current chat window. Real-time scanning prioritizes using the interface's automated control tree to identify unread conversation items. When control recognition times out, yields no results, or does not meet the conditions, the system reverts to identifying unread lists based on a visual model. This revert chain balances the stability of the snapshot chain with the fallback capability of the real-time chain.
[0074] Step 5: Contact Candidate Normalization and Deduplication Merging
[0075] For each identified unread contact, construct a candidate contact object that includes at least the contact's display name, latest message preview, unread notification, click coordinate ratio, and detection time. Generate a stable session identifier based on the contact's display name, and generate a message fingerprint based on the contact's display name and latest message preview. If a draft with the same session identifier and message fingerprint already exists in the draft pool, only update the latest message, unread notification, or click coordinate information, and do not create a new draft. If the session identifier does not exist, or the message fingerprint changes, create a new draft to be processed.
[0076] Step Six: Draft Status Accumulation and Persistence
[0077] The merged contact drafts are managed with states such as pending, processing, blocked, and processing failed; the draft pool is persisted to a local state file so that it can be used again when the interface is refreshed, the program is restarted, or manual processing is performed later; the drafts are displayed in the interface as a list of contact tasks to be processed one by one.
[0078] Through the above steps, this embodiment forms a complete control chain of "freezing snapshots before the main process, delaying analysis after the main process, real-time scanning to roll back from snapshot failure, and deduplicating and retrieving drafts of results", transforming the originally instantaneous and easily drifting unread discovery action into a contact draft task that can be reviewed, retried, and continuously processed.
[0079] Example 3
[0080] Exemplary embodiment 3 of the present invention provides a method for identifying unread contacts and storing drafts in desktop chat. This embodiment implements the method of the present invention in the following manner:
[0081] Step 1: Freeze the session list snapshot before the main process begins.
[0082] When the user clicks "Start Recognition" to process the current chat window, it doesn't immediately scan other unread contacts. Instead, it first captures the left-hand conversation list area from the bound chat window and saves it as a snapshot of image bytes in memory. This snapshot corresponds to the unread list state at the start of the main process, not the real-time interface after the main process ends. Its purpose is to preserve unread clues at the start of the main process, avoiding missed recognition due to interface scrolling, reflow, or focus changes after the main process ends.
[0083] Step 2: Prioritize completing the main flow of the current session.
[0084] After the snapshot is frozen, the main process continues to execute on the currently active chat window, including window screenshotting, OCR recognition, knowledge retrieval, and reply generation. Since the discovery of other unread contacts has been transferred to the frozen snapshot, the main process is unaffected by the unread scanning action, maintaining the stability of the current recognition chain. This embodiment decouples unread scanning from current session recognition through a "freeze first, analyze later" approach, avoiding mutual contamination between the two chains.
[0085] Step 3: Snapshot Delay Analysis After Main Process Completion
[0086] Once the main process is complete, the previously frozen snapshot of the conversation list is read, and unread contacts are identified from the snapshot. Because the snapshot is detached from the current live window, latency analysis can be performed without being affected by subsequent window scrolling, conversation reordering, or focus changes. In practical applications, the snapshot identification results should include at least: the contact's display name, a preview of the latest message, whether there is an unread notification, and the horizontal and vertical coordinates representing the contact's position in the contact list. The coordinates do not need to be absolute pixel values; they only need to be relative to the chat window size.
[0087] Step 4: Automatically roll back to real-time scanning when the snapshot chain fails.
[0088] If the snapshot is empty, the snapshot recognition call fails, the snapshot recognition times out, or although the snapshot analysis is successful but no other unread contacts are identified, a real-time unread scan is automatically initiated. The real-time scan prioritizes identifying unread items in the conversation list on the left side of the current chat window using the interface's automated control tree. If the control tree scan does not return valid contacts within a preset time, or if the returned result is empty, it then reverts to performing visual model recognition on the current conversation list image. This two-layer fallback structure reduces temporal drift by freezing snapshots while retaining the ability to discover unread messages even when the snapshot chain fails.
[0089] Step 5: Construct stable identifiers and message fingerprints for contacts.
[0090] For each identified unread contact, the contact's display name and the latest message preview are first normalized to eliminate noise such as whitespace differences and capitalization differences. Then, a stable session identifier is generated based on the contact's display name, and a message fingerprint is generated based on both the contact's display name and the latest message preview. The session identifier is used to identify the contact session, and the message fingerprint is used to identify the context of the message to be processed. The combination of these two methods avoids duplicate entries into the pool and prevents the misuse of old drafts when a contact sends a new message.
[0091] Step 6: Perform deduplication and merging according to the dual-identifier rule.
[0092] Before writing a contact candidate to the draft pool, the system checks if a draft with the same session identifier already exists in the pool. If the same session identifier and message fingerprint exist, it means that the contact and the message to be processed have not fundamentally changed. In this case, only the latest message, unread notification, or click coordinate information is updated, and the draft is not recreated. If the same session identifier does not exist, or if the same session identifier exists but the message fingerprint is different, it means that a new contact task or a new message context has appeared. In this case, a new draft to be processed is created. The new draft must at least include the contact display name, the latest message preview, the message fingerprint, the location ratio information, and the detection time. The merging mechanism in this embodiment transforms "unread contact discovery" from a one-time scan output into a maintainable task pool maintenance action.
[0093] Step 7: Draft State Transition and Local Persistence
[0094] Contact drafts are categorized into at least the following states: pending, processing, blocked, and failed. An unread contact enters the pending state upon first identification; it enters the processing state when it proceeds to the next stage of the process; it enters the blocked state if the policy determines that further processing is not allowed; and it enters the failed state if identification or processing fails. To ensure that contact tasks can be resumed after interface refreshes, program restarts, or manual interruptions, the draft state is persisted to a local state file. In this way, unread contacts are no longer a volatile, transient list, but a sustainably maintainable set of tasks.
[0095] The desktop chat unread contact identification and draft accumulation method of this invention has the following beneficial technical effects:
[0096] I. Significantly reduces the risk of missed readings due to dynamic interfaces.
[0097] By freezing a snapshot of the conversation list area before the main processing flow of the current conversation in the target chat window begins, the observation time of unread contacts is brought forward to the moment the main flow starts, rather than relying on the real-time interface state after the main flow ends. This effectively avoids the problem of unread list drifting caused by conversation scrolling, changes in pinning, arrival of new messages, or focus switching during the execution of the main flow, and significantly reduces the risk of missing the identification of unread contacts.
[0098] II. Decoupling the timing of unread scan from the current session's main flow.
[0099] Unread contact analysis is delayed until after the main session flow is completed, ensuring that operations such as screenshotting, optical character recognition, knowledge retrieval, and reply generation in the main flow are not interfered with by the unread scanning action. The two processing links are completely separated in time, avoiding recognition instability caused by competition for the same real-time interface state, thereby improving the independent stability and overall reliability of the main flow and unread detection links.
[0100] Third, it has the ability to smoothly roll back when the snapshot chain fails.
[0101] When the snapshot chain is missing, recognition fails, times out, or no unread contacts are identified, it can automatically revert to real-time unread scan. In real-time scanning, a two-layer fallback structure is further adopted, prioritizing the interface automation control tree and using the visual model as a fallback, to ensure that even if the snapshot chain fails, the ability to discover unread contacts is still available, avoiding the defect of losing the discovery opportunity due to a single path failure.
[0102] IV. Effectively suppress the accumulation of duplicate drafts
[0103] A stable session identifier is generated based on the contact's display name, and a message fingerprint is generated based on the contact's display name and the latest message preview, forming a dual-identifier deduplication mechanism. When a draft with the same session identifier and identical message fingerprint already exists in the draft pool, only the relevant information is updated without creating a new draft; a new draft record is only created when the session identifier does not exist or the message fingerprint changes. This avoids the same contact being repeatedly entered into the pool due to repeated scanning, accurately identifies draft update needs in new message scenarios, and effectively reduces task management noise.
[0104] V. Achieve stateful storage and sustainable processing of unread discovery results
[0105] Unread contact candidates are deduplicated and merged, then managed with states such as pending, processing, blocked, and failed. The draft pool is persisted to a local state file. This transforms unread contacts from a volatile, transient scan result into a retrievable, retryable, and sustainably maintainable collection of contact tasks. Even after interface refresh, program restart, or manual interruption, the draft pool state can be restored to continue completing unprocessed tasks, establishing a stable front-end intermediate layer for subsequent contact processing.
[0106] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0107] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for identifying unread contacts and storing drafts in desktop chat, characterized in that, The method includes: Step S1: Before the main processing flow of the current session in the target chat window begins, perform a snapshot capture on the session list area of the target chat window to obtain a session list snapshot; Step S2: After the current main processing flow is completed, perform unread contact identification based on the session list snapshot to obtain unread contact candidates; Step S3: When the identification based on the conversation list snapshot fails or no unread contact candidates are obtained, automatically fall back to performing a real-time unread scan on the target chat window to obtain unread contact candidates; Step S4: Based on the session identifier and message fingerprint of the unread contact candidate, merge them into the local draft pool and perform stateful persistent storage.
2. The method for identifying unread contacts and storing drafts in desktop chat according to claim 1, characterized in that, In step S1, the current main processing flow specifically includes the following operations executed in sequence: taking a screenshot of the currently active chat window, performing optical character recognition on the screenshot image to extract the chat text content, performing a knowledge retrieval operation based on the recognized chat text content, and generating reply content based on the retrieval results; during the execution of the current main processing flow, no unread contact scanning or recognition operations are performed.
3. The method for identifying unread contacts and storing drafts in desktop chat according to claim 1, characterized in that, In step S1, a snapshot of the conversation list area of the target chat window is captured in the following manner: before the user triggers the main recognition process of the current chat window, the visible area of the left conversation list in the bound chat window is captured through the image capture interface, and the capture result is saved as image byte data; this conversation list snapshot is used to record the unread list interface state at the start of the main processing flow.
4. The method for identifying unread contacts and storing drafts in desktop chat according to claim 1, characterized in that, In step S2, unread contact identification is performed based on the conversation list snapshot in the following manner: After the current main processing flow is completed, the pre-saved conversation list snapshot is read, image recognition processing is performed on the conversation list snapshot, and unread contact information, including at least the contact display name, latest message preview, unread prompt information, and the horizontal and vertical coordinate ratios used to locate the position of the contact list, is extracted from the recognition result. The horizontal and vertical coordinate ratios are normalized relative position coordinates.
5. The method for identifying unread contacts and storing drafts in desktop chat according to claim 1, characterized in that, In step S3, the system automatically reverts to performing a real-time unread scan of the target chat window as follows: First, it performs a control-level traversal of the left-hand conversation list of the current chat window through the interface automation control tree to identify conversation items marked as unread and extract contact information; when the interface automation control tree identifies that no valid contact has been returned within the preset timeout period, the identification timeout occurs, the returned result is empty, or the identification result does not meet the preset integrity conditions, it automatically reverts to a conversation list identification method based on a visual model, performs visual model analysis on the real-time image of the current conversation list area, and identifies the unread contact information.
6. The method for identifying unread contacts and storing drafts in desktop chat according to claim 1, characterized in that, In step S4, the specific method for merging unread contact candidates into the local draft pool based on their session identifiers and message fingerprints is as follows: Perform normalization preprocessing on the identified contact display name, which includes at least removing leading and trailing whitespace characters, unifying the case of uppercase and lowercase characters, and removing invisible control characters; The normalized contact display name is used as the stable session identifier for the contact; the normalized contact display name is concatenated with the latest message preview, and a hash operation is performed on the concatenated string, with the hash value used as the message fingerprint of the message context to be processed; Before writing unread contact candidates to the draft pool, first check if there is an existing draft with the same session identifier in the draft pool. If there is, and the message fingerprint is consistent, then only update the latest message preview, unread notification information, or location coordinate ratio in the existing draft. If there is no existing draft or the fingerprint is inconsistent, then create a new contact draft record.
7. The desktop chat unread contact identification and draft accumulation method according to claim 6, characterized in that, In step S4, the newly created contact draft record contains the following fields: contact display name, latest message preview, message fingerprint, horizontal and vertical coordinate ratios used to locate the position in the contact list, detection timestamp, and draft status. The draft status is initialized to a pending state upon creation, and the detection timestamp is used to record the time when the unread contact is first identified.
8. The method for identifying unread contacts and storing drafts in desktop chat according to claim 1, characterized in that, In step S4, the specific method for performing stateful persistent storage is as follows: the contact drafts are divided into four states: pending, processing, intercepted, and processing failed; when an unread contact is first identified and written to the draft pool, its draft state is marked as pending. When the subsequent processing flow for the contact draft begins, the status of the draft is changed from pending to processing; when the preset policy determines that the contact draft is not allowed to continue processing, the status of the draft is changed to blocked; when an abnormality or failure occurs in the identification or processing of the contact draft, the status of the draft is changed to processing failed, and retry processing of the contact draft in this state is allowed.
9. The method for identifying unread contacts and storing drafts in desktop chat according to claim 8, characterized in that, In step S4, during stateful persistent storage, all contact drafts and their corresponding state information in the draft pool are serialized into a structured data format and written to a state file in the local file system.
10. The desktop chat unread contact identification and draft accumulation method according to claim 9, characterized in that, In step S4, the persistence operation is a synchronous write operation, which ensures that the state file is updated in a timely manner every time the draft pool changes. When the system starts, the interface is refreshed, or the user reopens the contact task list, the contact draft data is read from the local state file and deserialized to restore the draft pool state of the last run.
Citation Information
Patent Citations
Display method, display device, related equipment and readable storage medium
CN113300941A