An AI-assisted quality control marking and real-time correction method, device and equipment based on a rich text editor and a storage medium

CN122930352APending Publication Date: 2026-10-16HANGZHOU JIECHUANGRUI MEDICAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611144801.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0013]针对现有技术中存在的上述缺陷,本发明的目的在于提供一种基于富文本编辑器的AI辅助质控标记与实时修正方法、装置、设备及存储介质,以解决现有富文本编辑器缺乏AI质控机制、质控反馈滞后、问题标记与编辑器分离无法实时同步等技术问题,实现病历文书的即时质控与智能修正

Benefits of technology

1、实时质控即时反馈:通过防抖监听和流式AI检测,医生输入停顿后自动触发质控,问题发现即时反馈,降低修正成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122930352A_ABST
    Figure CN122930352A_ABST
Patent Text Reader

Abstract

The application discloses an AI-assisted quality control marking and real-time correction method and device based on a rich text editor, equipment and a storage medium, and the method comprises the following steps: registering anti-shake monitoring, triggering AI quality control detection after the user input pause; extracting the change range and obtaining a problem list through AI service; defining a problem anchor point carrying metadata in a document model; adding the problem anchor point in an editor transaction framework and synchronously rendering visual marking; binding a hovering prompt and a click operation panel, one-key correction and replacement of problem text and clearing of the anchor point; incremental updating only detects the changed paragraph, and the new and old problem anchor points are combined; and when exporting, the problem anchor points are selected to be filtered or retained according to a mode. The application realizes real-time quality control and intelligent correction of medical records, instant feedback of problem discovery, greatly reduces correction cost, and can be adapted to various mainstream rich text editors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of Web rich text editing and medical information technology, and in particular to an AI-assisted quality control marking and real-time correction method, apparatus, device and storage medium based on a rich text editor. Background Technology

[0002] With the deepening development of medical informatization, electronic medical record systems have been widely deployed in medical institutions at all levels. The quality of medical records is directly related to medical safety, medical insurance settlement, and the accuracy of research data. However, when doctors write medical records, due to busy work and large amounts of information, problems such as logical contradictions (e.g., "patient denies history of hypertension" versus "past medical history: hypertension for 10 years"), missing information, and non-standard terminology are prone to occur. Traditional medical record quality control relies on manual review, which is inefficient and lagging. Existing technical solutions have the following technical defects: 1. All mainstream rich text editors lack native features and AI quality control mechanisms: While existing mainstream rich text editors each have their own technical architecture, none of them integrate AI quality control or logical verification mechanisms. Quill uses a Delta linear operation sequence plus a Parchment attribute system, and natively only provides basic formats (bold / italic / underline), without integrating AI quality control or logical verification mechanisms; while Quill's Attributor or Embedblot are scalable, the official implementation of a combined solution of "real-time AI streaming detection + Delta incremental updates + in-line issue anchors + one-click correction suggestions" has not been disclosed.

[0003] Tiptap is based on ProseMirror's schema-strict JSON document model, and all extensions must be combined through extensions. The official website does not provide an AI quality control or logical verification mechanism. Although ProseMirror's Decoration or Mark system can visually mark, the official website has not disclosed a combined implementation scheme of "real-time AI streaming detection + incremental update + in-line issue anchors + one-click correction suggestions".

[0004] wangEditor-next is based on the Slate data model and only provides basic text editing functions natively, without integrating AI quality control or logical verification mechanisms. Although Slate's Decoration or Mark system can visually mark text, the official implementation of a combined solution of "real-time AI streaming detection + incremental updates + in-line problem anchors + one-click correction suggestions" has not been disclosed.

[0005] CKEditor 5 adopts a Model-View-Controller plus command pattern plus schema context system. All changes must be written through Model transactions. Direct manipulation of the DOM will be rolled back in the next synchronization. The official version does not provide AI quality control or logic verification mechanism. Although the Marker or Highlight plugin of CKEditor 5 can visually mark, the combined implementation scheme of "real-time AI streaming detection + Writer transaction update + inline problem anchors + one-click correction suggestions" has not been disclosed.

[0006] TinyMCE is based on ContentEditable, DOMParser, and Schema validation mechanisms. It natively only provides basic text editing functions and does not integrate AI quality control or logical validation mechanisms. Although TinyMCE's content_css or format can be visually marked, the official implementation scheme of "real-time AI streaming detection + incremental update + inline problem anchors + one-click correction suggestions" has not been disclosed. In addition, TinyMCE's undoManager.transact() controls the undo stack. Directly manipulating the DOM will be regarded as "external tampering", and the quality control mark will be lost on the next undo.

[0007] 2. The existing medical record quality control system uses a "batch review after submission" model, resulting in significant feedback delays. Existing medical record quality control systems mostly adopt a "batch review after submission" model. Doctors submit their written records in a unified manner, and the quality control department conducts offline checks. However, feedback on problems is delayed for several hours or even days, making it impossible to make timely corrections. Doctors may forget the original writing logic while waiting for feedback, resulting in high correction costs.

[0008] 3. The quality control results display is separated from the editor, resulting in inaccurate positioning: Some systems use a separate sidebar to display quality control results, but the problem location is not accurate. Doctors need to manually search in long articles, which is inefficient. Doctors also need to switch focus repeatedly between the problem list in the sidebar and the main text in the editor, making it impossible to intuitively locate the problem in the editing context.

[0009] 4. AI quality control highlighting is separated from the editor, causing position drift after editing: Existing AI quality control systems mostly rely on backend NLP services, which highlight issues on the front end after returning a list of problems. However, the highlighting is separate from the editor, and the highlight position drifts after editing, making it impossible to synchronize in real time. When doctors modify text, the original problem markers do not automatically move with the text, resulting in misaligned or invalid markers.

[0010] 5. The official extension capabilities of various editors are not being fully utilized: While the aforementioned editors' extension mechanisms theoretically support the marking of custom content, none of them have officially released a complete combination implementation scheme from "real-time AI detection" to "problem anchor marking" to "one-click correction." Developers need to explore the combination and use of each editor's unique API on their own, which has a high technical threshold and high implementation cost.

[0011] 6. Special restrictions on custom attributes in TinyMCE's schema: TinyMCE's schema imposes strict restrictions on custom attributes, filtering out custom attributes not declared in the schema by default, which presents unique technical challenges for the persistence of metadata for problem anchors.

[0012] Therefore, there is an urgent need for a technical solution that can achieve real-time quality control of medical records based on mainstream rich text editors and through a unified AI-assisted quality control marking and real-time correction mechanism. Summary of the Invention

[0013] To address the aforementioned deficiencies in existing technologies, the present invention aims to provide an AI-assisted quality control marking and real-time correction method, apparatus, device, and storage medium based on a rich text editor. This addresses the technical problems of existing rich text editors, such as the lack of AI quality control mechanisms, delayed quality control feedback, and the separation of problem marking from the editor, which prevents real-time synchronization. The goal is to achieve real-time quality control and intelligent correction of medical records.

[0014] To achieve the above objectives, the present invention provides the following technical solution: According to a first aspect of the present invention, an AI-assisted quality control marking and real-time correction method based on a rich text editor is provided, comprising the following steps: S1. Register a debouncing listener in the rich text editor. When the user's input pauses for a preset delay, trigger the AI ​​quality control detection process. S2. Extract the scope of content changes in the document, and obtain a list of issues through AI quality control services. Each issue in the issue list shall include at least the issue type, confidence level, issue description, suggested correction text, and the start and end positions of the issue in the document. S3. Define custom issue anchors in the document model of the rich text editor. The issue anchors carry the following metadata attributes: unique issue identifier, issue type, confidence level, issue description, and suggested correction text. S4. Within the editor's transaction framework, add question anchors to the text range corresponding to each question in the question list, and synchronously display visual markers through the editor's view rendering mechanism. S5. Bind interactive events to the problem marker: display the problem description and suggested correction text when hovering, and bring up the operation panel for the user to choose the handling method when clicking; when the user chooses to accept the suggestion, replace the problem text with the suggested correction text in the editor's transaction framework, and clear the corresponding problem anchor. S6. In subsequent AI quality control testing, compare the differences before and after the document changes, extract the changed nodes or paragraphs, send only the changed parts and their context to the AI ​​quality control service, and then update them in batches after merging the newly returned issues with the old issue anchors retained in the unchanged areas. S7. When exporting documents, selectively retain or filter problem anchors based on the export mode: filter problem anchors when exporting in normal editing mode and output a clean document; retain problem anchors and processing records when exporting in quality control review mode.

[0015] In some implementations, the rich text editor is the CKEditor 5 editor; The anti-shake monitoring is implemented by registering a QcPlugin and listening to the editor.model.document.on('change:data') event; The scope of changes is extracted using editor.model.document.differ.getChanges(); The aforementioned problem anchor is achieved by registering a custom Marker type qc-marker in CKEditor 5 Schema; The addition of the issue anchor point is implemented within the Writer transaction using writer.addMarker(), and the visual rendering is implemented using editor.conversion.for('editingDowncast').markerToHighlight(). The interactive event is bound via editor.conversion.for('editingDowncast').markerToElement(), and the one-click correction is implemented through the custom command AcceptQcCommand. The incremental update is achieved by comparing with difference.getChanges(); The clean export is achieved by using editor.data.stringify() in conjunction with the downcast converter to filter the qc-marker.

[0016] In some implementations, the rich text editor is the Quill editor; The anti-shake monitoring is implemented by registering a QcModule and listening for the text-change event; The scope of the change is extracted by comparing the old and new Delta values. The problem anchor is achieved by registering a custom Attributor QcAnchor in the Parchment system; The addition of the problem anchor point is achieved by constructing Delta and calling quill.updateContents() to add the qc-anchor attribute; the visual rendering is achieved by registering a custom Blot QcMark. The interactive event is implemented by parsing data-qc-info, and the one-click correction is implemented by constructing the retain / delete / insert operation of Delta; The incremental update is implemented using the Delta difference algorithm; The clean export is achieved by registering filtering rules using addMatcher.

[0017] In some implementations, the rich text editor is the TinyMCE editor; The anti-shake monitoring is implemented by registering a QcPlugin and listening to the input event; The change range is obtained by using editor.selection.getRng() to get the current selection range, and then using editor.dom.getParent() to locate the paragraph node and extract the paragraph text. The aforementioned problem anchor is achieved by declaring allowed custom attributes of the span in the TinyMCE initialization parameter extended_valid_elements, thereby bypassing the default schema's interception of custom attributes; The process of adding issue anchors involves wrapping the operation with `editor.undoManager.transact()`, adding formatting with `editor.formatter.apply()`, and writing data-* attributes with `editor.dom.setAttribs()` to achieve visual rendering. The interactive event is implemented by parsing data-qc-info through editor.on('click'), and the one-click correction is implemented through editor.execCommand('mceInsertContent'). The incremental update is achieved by comparing the DOM before and after the change using editor.on('input'); The clean export is achieved by iterating through and removing data-* attributes using editor.dom.select().

[0018] In some implementations, the rich text editor is the Tipta editor; The anti-shake monitoring is implemented by registering a QcExtension and listening to the editor.on('update') event; The scope of the change is achieved by caching the previous document version in the Plugin state, comparing the differences between the nodes in the old and new document trees in the update callback, and extracting the positions of the nodes that have changed. The problem anchor is implemented by defining a custom Mark qc-anchor in the ProseMirror Schema; The addition of the issue anchor point is achieved by constructing a Transaction and calling tr.addMark() to add the qc-anchorMark, and the visual rendering is achieved by registering the DecorationPlugin through addProseMirrorPlugins(). The one-click correction is implemented using editor.chain().deleteRange().insertContent().unsetMark(); The incremental update is achieved by caching document versions in the plugin state and comparing node differences. The clean export is achieved by using getHTML() in conjunction with parseOptions to filter the qc-anchor Mark.

[0019] In some implementations, the rich text editor is the wangEditor-next editor; The anti-shake monitoring is implemented by registering an onChange anti-shake listener; The scope of the change is obtained by extracting the text of the changed paragraph and its context. The problem anchor is implemented by defining a custom mark qc-anchor in the Slate model; The visual rendering is achieved by registering the renderQcAnchor rendering function; The one-click correction is achieved through Transforms.insertText() and Transforms.unsetNodes(); The incremental update is achieved by comparing the old and new Slate document trees to extract the path of the changed node; The clean export is achieved using getHtml({ excludeMarks: ['qc-anchor']}).

[0020] In some implementations, in step S4: Visual markers include a variety of preset question type marker styles. Different question types correspond to different visual styles, and the visual styles are visually distinguishable. The addition and removal of issue anchors are both completed within the editor's transaction framework, ensuring that the operation is included in the editor's undo / redo stack.

[0021] Therefore, by using different visual styles corresponding to different problem types, and ensuring visual distinguishability between styles, doctors can quickly differentiate problem types (such as contradictions, omissions, and non-standard practices) through visual differences. They can make a preliminary judgment on the nature of the problem without clicking or hovering, thus improving quality control efficiency. Furthermore, by ensuring that the addition and removal of problem anchors are completed within the editor's transaction framework, all quality control operations (marking, marking, and one-click correction) are included in the editor's undo / redo stack, solving the technical problem of "marks being lost upon undoing." Doctors can undo erroneous operations at any time, meeting the rigor requirements of medical documents.

[0022] In some implementations, the visual markers specifically include: a red wavy underline for contradictory types, a yellow dashed background for missing types, and a blue underline for non-standard types.

[0023] Therefore, by setting the contradiction type to a red wavy underline, the warning attribute of red and the non-intrusiveness of the wavy underline are utilized to attract doctors' attention without compromising text readability, making it suitable for logical contradictions requiring immediate attention. By setting the missing type to a yellow dashed background, the hint attribute of yellow and the fill effect of the dashed background are utilized to suggest "content is missing," suitable for information gaps. By setting the non-standard type to a blue underline, the neutral hint attribute of blue is utilized, distinguishing it from the red warning of contradictions and the yellow warning of missing information, suitable for issues requiring optimization but not urgent, such as non-standard terminology. These three visual styles form a three-tiered "red-yellow-blue" warning system, allowing doctors to quickly determine the priority of issues by color, improving quality control efficiency. The combination of underlines and background colors ensures that the visual markings are compatible with the original text format and do not affect normal editing operations.

[0024] In some implementations, in step S5: The control panel provides at least two handling options, including accepting the suggested corrective action and ignoring the problem. One-click correction and replacement operations and problem anchor point clearing operations are completed in the same editor transaction, ensuring the atomicity of the operations.

[0025] Therefore, the operation panel provides at least two options: correction and ignore. Doctors can flexibly choose the treatment method according to the actual situation. It supports one-click acceptance of AI suggestions for quick correction, as well as ignoring false alarms or temporarily shelving problems, adapting to the needs of different clinical scenarios. The one-click correction and replacement operation and the problem anchor point clearing operation are completed in the same editor transaction, ensuring the atomicity of correction and clearing - either all succeed or all fail and rollback, avoiding the data inconsistency state of "text has been modified but the mark has not been cleared" or "mark has been cleared but the text has not been modified", ensuring the consistency of document status and quality control status, and meeting the rigor requirements of medical documents.

[0026] In some implementations, the options for handling the situation may be: "Accept suggestion", "Ignore this", "View details", etc.

[0027] Therefore, through the "Accept Suggestion" option, doctors can adopt the AI's correction suggestions with one click, automatically replacing the problem text and clearing the mark, achieving efficient "correction upon discovery" handling. Through the "Ignore This" option, doctors can quickly reject AI false alarms or problems that do not require handling, avoiding unnecessary interference. At the same time, the system records the ignored operation for subsequent quality control review. Through the "View Details" option, doctors can view complete problem information in the operation panel, including problem type, confidence level, detailed contradictory description, etc., to help doctors make more accurate judgments. The three handling options form a complete "correction-ignore-view" decision-making link. Doctors can flexibly choose according to the problem confidence level and clinical judgment, improving the efficiency and accuracy of quality control handling. At the same time, all handling records are retained, meeting the quality control traceability requirements.

[0028] In some implementations, in step S6: the AI ​​quality control service communicates with the editor via WebSocket or HTTP streaming interface; in incremental updates, the changed portion and its context are sent to the AI ​​quality control service.

[0029] Therefore, by communicating with the AI ​​quality control service via WebSocket or HTTP streaming interfaces, real-time streaming of AI detection results is supported. Doctors can start reviewing issues without waiting for a complete response, improving the response speed of real-time quality control. WebSocket supports full-duplex communication, making it suitable for high-frequency interaction scenarios. HTTP streaming interfaces have stronger compatibility and are suitable for standard web environments. By sending only the changed parts and their context to the AI ​​quality control service instead of the entire document, the amount of data transmission and AI computing costs are significantly reduced. At the same time, the context information ensures the accuracy of AI detection—AI can perform logical contradiction detection based on the context of the changed parts, avoiding misjudgments caused by a lack of context.

[0030] In some implementations, further, during incremental updates, the changed paragraph and the sentence before and after it are sent to the AI ​​quality control service as context.

[0031] Therefore, by sending the changed paragraph and the sentence before and after it as context to the AI ​​quality control service, the amount of data transmission is reduced to the minimum while ensuring the accuracy of AI detection. The context window of the sentence before and after is sufficient to cover most logical contradiction detection scenarios (such as negation conflicts between sentences, timeline contradictions, etc.), while avoiding the bandwidth and computational overhead of sending the entire document. This optimization reduces the number of AI calls by about 70%, significantly improves the response speed, and achieves the best balance between detection accuracy and response speed.

[0032] In some implementations, the preset delay in step S6 is 500 milliseconds. Thus, by setting the anti-shake delay to 500 milliseconds, an optimal balance is achieved between user input pauses and AI detection triggering; a 500ms delay is sufficient to filter out short pauses (typically 100-300ms) during rapid input, avoiding the performance overhead and network congestion caused by triggering AI detection with every keystroke; simultaneously, a 500ms delay is also short enough that doctors can receive quality control feedback after a 500ms pause following the input of a phrase or sentence, without experiencing a noticeable waiting delay; this delay parameter allows real-time quality control to achieve an optimal balance between "not interfering with the writing process" and "timely feedback."

[0033] According to a second aspect of the present invention, an AI-assisted quality control marking and real-time correction device based on a rich text editor is provided, characterized in that it comprises: The trigger listening module is used to register debouncing listeners in the rich text editor. When the user's input pauses for a preset delay, an AI quality control detection is triggered. The AI ​​detection module is used to extract the scope of document changes and obtain a list of issues through AI quality control services. The issue anchor definition module is used to define issue anchors carrying metadata in the document model of the rich text editor; The markup rendering module is used to add issue anchors to issue text and simultaneously render visual markup within the editor's transaction framework; The interactive correction module is used to bind hover tips and click operation panels to issue markers, and to enable one-click correction and replacement of issue text; The incremental update module is used to compare differences in document changes, sending only the changed paragraphs to the AI ​​quality control service and merging the old and new issue anchors. The export filtering module is used to selectively retain or filter problem anchors based on the export mode, outputting clean documents or quality control trace documents.

[0034] According to a third aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory storing one or more programs that, when executed by the processor, implement the above-described AI-assisted quality control marking and real-time correction method.

[0035] According to a fourth aspect of the present invention, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the above-described AI-assisted quality control marking and real-time correction method.

[0036] The beneficial effects of this invention are: 1. Real-time quality control and immediate feedback: Through anti-shake monitoring and streaming AI detection, quality control is automatically triggered when the doctor pauses input, and problems are detected and fed back immediately, reducing correction costs.

[0037] 2. Precise problem anchoring: By using custom problem anchors, you can precisely locate the problem at the character level. Hovering over the anchor will display the problem description and suggestions without leaving the editing interface.

[0038] 3. Transaction protection ensures undoable operations: By adding and clearing problem anchors within the editor's transaction framework, quality control operations are ensured to be included in the undo / redo stack, solving the persistent technical problem of "losing the mark upon undoing".

[0039] 4. Incremental updates reduce costs: The incremental update mechanism only detects changed paragraphs, significantly reducing the number of AI calls and improving response speed.

[0040] 5. One-click correction for efficient handling: Automatically replaces problematic text and removes markings with one-click correction, adding it to the undo / redo stack. Mistakes can be undone, meeting the requirements for the rigor of medical documents.

[0041] 6. Dual-mode export protects privacy: Through export filtering, dual-mode output is achieved, which is "visible when editing and hidden when sending". Quality control traces are automatically filtered when printing or sending, protecting quality control privacy.

[0042] 7. Unified adaptation to multiple editors: This invention can be uniformly adapted to five mainstream rich text editors: Quill, Tiptap, wangEditor-next, CKEditor 5, and TinyMCE. Each editor only needs to implement the same core logic according to its own extension mechanism, which has good universality and portability.

[0043] In summary, this invention discloses an AI-assisted quality control marking and real-time correction method, apparatus, device, and storage medium based on a rich text editor, belonging to the field of Web rich text editing and artificial intelligence quality control technology. The method includes: registering a debouncing listener to trigger AI quality control detection after a user pauses in input; extracting the scope of changes and obtaining a list of issues through an AI service; defining issue anchors carrying metadata in the document model; adding issue anchors within the editor's transaction framework and synchronously rendering visual markers; binding hover prompts and click operation panels for one-click correction and replacement of issue text and clearing of anchors; incremental updates that only detect changed paragraphs and merge old and new issue anchors; and filtering or retaining issue anchors during export based on the mode selection. This invention achieves real-time quality control and intelligent correction of medical records, providing immediate feedback on problem detection, significantly reducing correction costs, and is compatible with various mainstream rich text editors. Attached Figure Description

[0044] Figure 1 This is a flowchart of the AI-assisted quality control marking and real-time correction method based on a rich text editor according to the present invention. Figure 2 This is a flowchart of the AI-assisted quality control marking and real-time correction method based on CKEditor 5, as shown in Example 1. Figure 3 This is a flowchart of the AI-assisted quality control labeling and real-time correction method based on Quill, as shown in Example 2. Figure 4 This is a flowchart of the AI-assisted quality control labeling and real-time correction method based on TinyMCE, as shown in Example 3; Figure 5 This is a flowchart of the AI-assisted quality control labeling and real-time correction method based on Tiptap, as shown in Example 4. Figure 6 This is a flowchart of the AI-assisted quality control marking and real-time correction method based on wangEditor-next, as shown in Example 5. Figure 7 This is a framework diagram of the AI-assisted quality control marking and real-time correction device based on a rich text editor according to the present invention. Figure 8 This is a simplified schematic diagram of the electronic device of the present invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0046] This invention belongs to the field of Web rich text editing and artificial intelligence quality control technology, and in particular relates to the real-time detection and visual warning of logical contradictions in medical records in rich text editors. It is applicable to scenarios that require real-time quality control, such as electronic medical records, rehabilitation assessment reports, and medical documents.

[0047] like Figure 1 As shown, this invention discloses an AI-assisted quality control marking and real-time correction method based on a rich text editor, including the following steps: S1. Register a debouncing listener in the rich text editor. When the user's input pauses for a preset delay, trigger the AI ​​quality control detection process. S2. Extract the scope of content changes in the document, and obtain a list of issues through AI quality control services. Each issue in the issue list shall include at least the issue type, confidence level, issue description, suggested correction text, and the start and end positions of the issue in the document. S3. Define custom issue anchors in the document model of the rich text editor. The issue anchors carry the following metadata attributes: unique issue identifier, issue type, confidence level, issue description, and suggested correction text. S4. Within the editor's transaction framework, add question anchors to the text range corresponding to each question in the question list, and synchronously display visual markers through the editor's view rendering mechanism. S5. Bind interactive events to the issue marker: When hovering, display the issue description and suggested correction text; when clicked, bring up the operation panel for the user to choose the handling method; when the user selects to accept the suggestion, replace the issue text with the suggested correction text within the editor's transaction framework, and clear the corresponding issue anchor. S6. In subsequent AI quality control testing, compare the differences before and after the document changes, extract the changed nodes or paragraphs, send only the changed parts and their context to the AI ​​quality control service, and then update them in batches after merging the newly returned issues with the old issue anchors retained in the unchanged areas. S7. When exporting documents, selectively retain or filter problem anchors based on the export mode: filter problem anchors when exporting in normal editing mode and output a clean document; retain problem anchors and processing records when exporting in quality control review mode.

[0048] Therefore, this method has the following technical effects: (1) Real-time quality control and immediate feedback: By registering anti-shake listeners in the rich text editor, AI quality control detection is automatically triggered after the user's input pauses for a preset delay, realizing the real-time quality control experience of "writing and checking at the same time", providing immediate feedback on problems, greatly reducing the cost of correction, and solving the technical problem of feedback delay of several hours or even days in the existing "batch review after submission" mode.

[0049] (2) Precise positioning and immersive experience: By extracting the scope of document changes and obtaining a list of issues with precise start and end positions, character-level precise positioning of issue anchor points is achieved. Hovering over the issue reveals the issue description and suggestions without leaving the editing interface, solving the problems of inaccurate positioning in the existing sidebar mode and the inefficiency of doctors having to manually search in long documents.

[0050] (3) Persistent binding of issue anchors: By registering custom issue anchors carrying complete metadata (unique issue identifier, issue type, confidence level, issue description, and suggested correction text) in the document model, a persistent association between quality control markers and document content is achieved, rather than independent floating highlights. This fundamentally solves the technical problems of existing AI quality control highlighting being separated from the editor and highlight position drifting after editing not being synchronized in real time.

[0051] (4) Transaction protection operation is reversible: The addition and removal of problem anchors are completed within the editor's transaction framework, ensuring that quality control operations are included in the editor's undo / redo stack, solving the technical problem of "losing the mark when undoing", and meeting the rigor requirements of medical documents.

[0052] (5) One-click correction for efficient handling: By hovering over prompts and clicking on the operation panel, doctors can view problem details and select treatment methods without leaving the editing interface. One-click correction automatically replaces the problem text and clears the mark, and includes it in the undo / redo stack. Misoperations can be undone, forming a complete quality control closed loop of "discovery-prompt-correction-recording".

[0053] (6) Incremental updates reduce costs: By comparing differences in document changes, only the changed nodes or paragraphs are extracted and sent to the AI ​​quality control service, rather than the entire document is checked, which significantly reduces the number of AI calls and computational costs. Problem anchors in unchanged areas are preserved, enabling continuous accumulation and accurate updating of problem markers.

[0054] (7) Dual-mode export protects privacy: By selecting to filter or retain issue anchors based on the export mode, quality control mark management is achieved, which is "visible during editing and hidden when sending". In normal mode, a clean document is output, and quality control traces are automatically filtered when printing or sending to protect quality control privacy; in review mode, issue marks and processing records are fully retained for performance evaluation and quality analysis.

[0055] The method of this invention is adaptable to various mainstream rich text editors. To fully illustrate the technical solution and feasibility of this invention, five specific embodiments are provided below, using five editors: CKEditor 5, Quill, TinyMCE, Tiptap, and wangEditor-next as examples. Each embodiment follows the same core technical solution (steps S1 to S7), differing only in editor-specific APIs and extension mechanisms.

[0056] Example 1: AI-assisted quality control marking and real-time correction method based on CKEditor 5 This embodiment details the specific implementation of AI-assisted quality control marking and real-time correction in the CKEditor 5 rich text editor.

[0057] CKEditor 5 adopts the Model-View-Controller (MVC) architecture, which decouples the data model, view, and controller. All changes must be written through Model transactions, and direct manipulation of the DOM will be rolled back in the next synchronization. Developers can extend the editor's functionality by registering custom plugins, define custom nodes or tags through schema, and achieve synchronization between the Model and View through Downcast / Upcast converters.

[0058] The AI-assisted quality control marking and real-time correction method based on CKEditor 5 in this embodiment includes the following steps: Step S1: Register QcPlugin and anti-jitter monitoring: Register a custom plugin QcPlugin in CKEditor 5 and listen for the editor.model.document.on('change:data') event: Set the anti-shake delay to 500ms, and trigger AI quality control detection after the user pauses input for 500ms; The anti-shake mechanism avoids the performance overhead caused by triggering AI detection with every button press; Once image stabilization is triggered, the AI ​​quality control and testing process begins.

[0059] Step S2: Extract the scope of changes and detect issues using AI quality control service. Once the AI ​​quality control check is triggered, the scope of changes in the document can be extracted using editor.model.document.differ.getChanges(). Get the type (insert, delete, attribute, etc.) and location of the change; Extract the changed paragraph and its context text; Request AI quality control services via WebSocket streaming; The AI ​​quality control service returns a list of issues, each of which includes: a unique identifier for the issue, the issue type (contradiction / missing / nonstandard), confidence level, issue description, suggested corrections, and the issue's starting and ending positions in the document (indicated by path and offset).

[0060] Step S3: Register the custom marker type qc-marker in CKEditor 5 Schema: Attribute definitions: qcId (unique identifier for the issue), qcType (issue type: contradiction / missing / nonstandard), confidence (confidence level), message (issue description), suggestion (suggested correction text); Allows text to be overlaid within the line and supports overlapping and intersection issue markers.

[0061] Step S4: Add qc-marker within the Writer transaction and render the visual marker synchronously: Within the Writer transaction, call writer.addMarker() to add a qc-marker to the issue text: Use model.createRange() to locate the range of the question text; Call writer.addMarker('qc-marker', range, {usingOperation: true, data:{...}}) to add a marker; usingOperation: true ensures that the marking operation is included in the undo command stack; Visual rendering is defined using `editor.conversion.for('editingDowncast').markerToHighlight()`: Contradiction type: red wavy underline; Missing type: yellow dashed background; Nonstandard type: blue underline.

[0062] Step S5: Implement interactive problem marking and one-click correction: Bind interactive events using editor.conversion.for('editingDowncast').markerToElement(): Hover over the device to display a problem description and suggested fixes via a tooltip. Clicking triggers an operation panel that displays problem details and handling options; The control panel offers options such as "Accept suggestion", "Ignore this", and "View details". After the doctor selects "Accept Recommendation," the custom command AcceptQcCommand is executed: Within the Writer transaction, call writer.removeMarker() to clear the qc-marker; Call writer.insertText() to replace the problem text with the suggested correction text; Operations are incorporated into the undo command stack and can be undone with Ctrl+Z.

[0063] Step S6: Implement the Differ incremental update mechanism: Implement the Differ increment algorithm: Compare with editor.model.document.differ.getChanges() to extract the changed nodes; Only send the changed paragraph and the sentence before and after it as context to the AI ​​quality control service; After the AI ​​returns a new question, add new markers in batches using writer.addMarker(). For areas that have not been changed, retain the old markers (adjust the offsets) and merge the old and new problem anchors.

[0064] Step S7: Implement export filtering for quality control marks: When exporting HTML: Normal editing mode: Filter qc-marker using editor.data.stringify() in conjunction with the downcast converter; Alternatively, you can call editor.getData({trim:'none'}) and then iterate through and remove the markers. Quality control review mode: Disable Marker filtering before calling editor.getData() to fully retain all issue markers and processing records.

[0065] Specific application scenarios of this embodiment: Scenario 1: AI detection and issue tagging addition: The doctor writes in the medical record: "Patient denies history of hypertension; Past medical history: hypertension for 10 years." After a 500ms pause, QcPlugin debouncing is triggered, editor.model.document.differ.getChanges() extracts the range of changes, and a WebSocket streaming request is made to the AI ​​quality control service; the AI ​​returns the following issue: {qcId:"q1", qcType:"contradiction",confidence:0.95, message:"Contradicts 'denies hypertension'", suggestion:"", range:{start:{path:[0,12],offset:0}, end:{path:[0,20],offset:0}}}.

[0066] QcPlugin enables Writer transactions: writer.addMarker('qc-marker', range, {usingOperation:true, data:{qcId:"q1", qcType:"contradiction", ...}}). The editingDowncast converter synchronously renders... The text is underlined in red with a tooltip that reads "Contradicts 'denies hypertension' (95% confidence level) | Recommendation: Verify and delete or modify the preceding text."

[0067] Scenario 2, One-click correction: When the doctor clicks on the text, the event bound to markerToElement() is triggered, bringing up the operation panel, which provides options to "delete this sentence", "modify the preceding text to 'have high blood pressure'", and "ignore this sentence". Selecting "modify the preceding text" executes AcceptQcCommand, and within the Writer transaction, writer.removeMarker('qc-marker', q1Range) clears the marker, and writer.insertText() replaces "deny" with "yes". The operation is added to the undo command stack, and can be undone with Ctrl+Z.

[0068] Scenario 3, Incremental Update: The doctor continues writing, inserting "take antihypertensive medication regularly" in the third sentence; Differ extracts changes of type 'insert' from getChanges() and sends this sentence, along with the sentences before and after it, to the AI; the AI ​​returns a new question: {qcId:"q2", qcType:"missing", message:"Medication name not recorded", suggestion:"It is recommended to add the specific drug name"}; Writer adds q2 Markers in batches, while the unchanged areas retain the q1 cleared state.

[0069] Scenario 4: Export cleaning document: When the doctor clicks "Save", the system calls editor.data.stringify(), the downcast converter filters the qc-marker, and outputs clean HTML: "The patient has a history of hypertension; past medical history: hypertension for 10 years, regularly taking antihypertensive medication.", without any quality control marks such as red wavy lines, and can be directly used for printing or external distribution.

[0070] Scenario 5, Quality Control Review Mode: According to the quality control department's backend, the Marker filter is disabled before calling editor.getData() on the same medical record to fully retain all issue markers and doctor's handling records for performance evaluation and quality analysis.

[0071] Therefore, the advantages of this embodiment can be summarized as follows: In CKEditor 5's MVC architecture, by registering a QcPlugin and listening to the `editor.model.document.on('change:data')` event, the plugin extension mechanism of CKEditor 5 is fully utilized to achieve real-time triggering of AI quality control with minimal intrusion. The change range is extracted using `editor.model.document.differ.getChanges()`, leveraging CKEditor 5's Differ incremental difference calculation capability to accurately locate change nodes. A custom Marker type, `qc-marker`, is registered in the schema, utilizing CKEditor 5's Marker system to achieve precise association between issue anchors and text ranges, supporting overlapping and cross-issue marking. Markers are added within the Writer transaction using `writer.addMarker()` to ensure operations are included in the undo command stack. Visual rendering is achieved using `markerToHighlight()`, and interactive events are bound using `markerToElement()`, utilizing CKEditor 5's Downcast converter system to achieve automatic synchronization between Model and View. One-click correction is achieved using the custom command `AcceptQcCommand`, utilizing CKEditor's... The command mode of version 5 ensures that the correction operation conforms to the MVC architecture specification; clean export is achieved by using editor.data.stringify() in conjunction with the downcast converter to filter the qc-marker, thus decoupling the quality control mark from the exported content.

[0072] Example 2: AI-Assisted Quality Control Marking and Real-Time Correction Method Based on Quill This embodiment details the specific implementation of AI-assisted quality control marking and real-time correction in the Quill rich text editor.

[0073] Quill employs a Delta linear operation sequence combined with a Parse document model. A Parse is a parallel tree structure corresponding to the DOM tree, composed of Blots (nodes) responsible for document rendering. Developers can define custom content formats by inheriting the Parse's Blot class and define custom attributes by registering Attributes.

[0074] The Quill-based AI-assisted quality control labeling and real-time correction method in this embodiment includes the following steps: Step S1: Register QcModule and debouncing listener: Register a custom module QcModule in Quill and listen for the text-change event: Set the stabilization delay to 500ms; AI quality control detection is triggered when the user pauses input for 500ms. Extract the range of changes (index + length).

[0075] Step S2: Extract the scope of changes and detect issues using AI quality control service. Once the AI ​​quality control check is triggered, extract the location and content of the insert operation in the change Delta: By comparing the old and new Delta values, the changed insert / delete / retain operations can be identified. Extract the changed paragraph and its context text; Request AI quality control services via WebSocket streaming; The AI ​​returns a list of issues: issue type, confidence level, suggested corrections, and start and end points.

[0076] Step S3: Register the custom Attributor QcAnchor in the Parchment system: The attribute name is qc-anchor, and the value is a JSON string {qcId, qcType, confidence, message, suggestion}. It can be superimposed on any text range and supports overlapping and intersecting question marks.

[0077] Step S4: Construct Delta, add qc-anchor, and render visual markers synchronously. The QcModule constructs Delta: retain(index) + retain(length, {qc-anchor:JSON.stringify({...})}), and calls updateContents() to add properties: Register a custom Blot QcMark that inherits from Inline and render it as... ; Visual style: Contradiction type: red wavy underline; Missing type: yellow dashed background; Nonstandard type: blue underline; Hover over data-qc-info to display the tooltip; Click to trigger the operation panel.

[0078] Step S5: Implement interactive problem marking and one-click correction: When the doctor clicks on the question text, QcModule parses data-qc-info and brings up the operation panel: It provides options such as "Delete this sentence", "Modify the preceding text to 'has high blood pressure'", and "Ignore this sentence"; After selecting "Accept Suggestion", construct Delta: retain to locate + delete to delete the problem text + insert to insert the suggestion text (without qc-anchor attribute). Replacement and attribute clearing are completed in a single updateContents() call, ensuring the continuity of the operation sequence; Simultaneously construct Delta to clear the qc-anchor attribute; The operation is added to the Delta history stack and can be undone with Ctrl+Z.

[0079] Step S6: Implement incremental updates using the Delta difference algorithm: Implement the Delta difference algorithm: Compare the old and new Delta values ​​to extract the retain / insert / delete operations that have been changed; Only send the changed paragraph and the sentence before and after it to the AI; After the AI ​​returns a new question, construct Delta batch format() to add qc-anchors; For areas that have not been changed, retain the old anchor points (adjust the index offset) and merge the old and new problematic anchor points.

[0080] Step S7: Implement export filtering for quality control marks: When exporting HTML: Normal editing mode: Filtering rules are registered via addMatcher, and the qc-anchor attribute is not serialized to data-*; Alternatively, you can manually filter the qc-anchor attribute in ops after calling quill.getContents(); Quality control review mode: Call quill.getContents() with qc-anchor version to fully retain all issue markers.

[0081] Specific application scenarios of this embodiment: Scenario 1: AI detection and issue tagging addition: The doctor writes in the medical record: "Patient denies history of hypertension. Past medical history: hypertension for 10 years." After a 500ms pause, QcModule debouncing is triggered, extracting the position and content of the insert operation in the change Delta, and making a WebSocket streaming request to AI. AI returns the following issue: {qcId:"q1", qcType:"contradiction", confidence:0.95, message:"Contradicts 'denies hypertension'", suggestion:"", start:12, length:8}.

[0082] The QcModule constructs Delta: retain(12) + retain(8, {qc-anchor: JSON.stringify({qcId:"q1",...})}), and calls updateContents() to add attributes. The QcMark blot is rendered as...<spanclass="ql-qc-contradiction" data-qc-id="q1" data-qc-info="eyJxY1..."> High blood pressure for 10 years The text is underlined with a red wavy line, and the hover tooltip displays "Contradicts 'denies hypertension' (95% confidence level) | Recommendation: Verify and delete or modify the preceding text."

[0083] Scenario 2, One-click correction: The doctor clicks on the text, and QcModule parses data-qc-info to bring up the operation panel; selects "Modify Previous Text", constructs Delta: retain(2) + delete(2) + insert("Yes") + retain(8) to change "deny" to "Yes", and retain(12, {qc-anchor: null}) to clear the q1 attribute; updateContents() is executed atomically, Delta records the operation in history, and Ctrl+Z can undo it.

[0084] Scenario 3, Incremental Update: The doctor continues writing, inserting "take antihypertensive medication regularly" in the third sentence; the Delta difference algorithm compares the old and new Delta, identifying only the insert operation at index 25, and sends this sentence and the sentences before and after it to the AI; the AI ​​returns a new question: {qcId:"q2",qcType:"missing", message:"Medication name not recorded", suggestion:"It is recommended to add the specific drug name", start:25, length:6}; the merging algorithm retains the cleared state of q1, constructs Delta to add q2, and updates the view in batches.

[0085] Scenario 4: Export cleaning document: The doctor clicks "Save," and the system calls quill.root.innerHTML, adds a matcher to filter the qc-anchor attribute, and outputs clean HTML: "The patient has a history of hypertension. Past medical history: 10 years of hypertension, regularly taking antihypertensive medication."; there are no quality control marks such as red wavy lines, and it can be directly used for printing or distribution.

[0086] Scenario 5, Quality Control Review Mode: The quality control department's backend system showed that the same medical record calling quill.getContents() with the qc-anchor version fully preserved all issue markers and doctor's handling records.

[0087] Therefore, the advantages of this embodiment can be summarized as follows: In the Quill editor's Parchment document model, by registering a QcModule and listening to the text-change event, Quill's Module extension mechanism is fully utilized to achieve real-time triggering of AI quality control with minimal intrusion. By comparing the old and new Delta values ​​to extract the change range, Quill's Delta linear operation model is used to accurately identify insert / delete / retain operations. A custom Attributor QcAnchor is registered in the Parchment system, leveraging Quill's attribute system to achieve precise association between issue anchors and arbitrary text ranges, supporting overlapping and cross-point issue marking. By constructing a Delta and calling quill.updateContents() to add the qc-anchor attribute, Quill's atomic operation characteristics are utilized to ensure the traceability of document state changes and compatibility with undo / redo functions. A custom Blot is registered... QcMark implements visual rendering, utilizing Quill's Blot rendering mechanism to achieve differentiated visual display of issue markers; it achieves interaction by parsing data-qc-info, and enables one-click correction by constructing Delta retain / delete / insert operations, leveraging Quill's Delta operation combination capabilities to ensure the atomicity of correction operations; it achieves incremental updates through the Delta difference algorithm, sending only the changed parts to the AI, significantly reducing AI call costs; and it achieves clean export by registering filter rules through addMatcher, decoupling quality control markers from exported content.

[0088] Example 3: AI-Assisted Quality Control Marking and Real-Time Correction Method Based on TinyMCE This embodiment describes in detail the specific implementation method of AI-assisted quality control marking and real-time correction in the TinyMCE rich text editor.

[0089] TinyMCE is based on ContentEditable, DOMParser, and Schema validation mechanisms. TinyMCE's Schema has strict restrictions on custom inline elements and filters non-standard tags by default. TinyMCE's undoManager.transact() controls the undo stack. Directly manipulating the DOM will be considered "external tampering," and the quality control mark will be lost on the next undo.

[0090] The AI-assisted quality control labeling and real-time correction method based on TinyMCE in this embodiment includes the following steps: Step S1: Register QcPlugin and anti-jitter monitoring: Register a custom plugin QcPlugin in TinyMCE and listen for input events: Set the stabilization delay to 500ms; AI quality control detection is triggered when the user pauses input for 500ms.

[0091] Step S2: Extract the scope of changes and detect issues using AI quality control service. Once the AI ​​quality control check is triggered, the current selection range is obtained using `editor.selection.getRng()`, and the paragraph node is located using `editor.dom.getParent()` to extract the paragraph text as the scope of change. Extract the current paragraph and its context; Request AI quality control services via WebSocket streaming; The AI ​​returns a list of issues: issue type, confidence level, suggested corrections, and start and end points.

[0092] Step S3: Bypass schema interception by declaring custom attributes using extended_valid_elements: In the TinyMCE initialization parameter extended_valid_elements, explicitly declare the custom attributes allowed for the span: text extended_valid_elements: "span[class|data-qc-id|data-qc-type|data-qc-info|contenteditable]" By configuring as described above, the default schema's interception of custom attributes is bypassed, allowing span elements with data-qc-* attributes to be correctly parsed and persisted in the editor.

[0093] Step S4: Add formatting and synchronously render visual markup within the undoManager.transact() transaction: Wrap the operation using editor.undoManager.transact(): Call editor.selection.setRng() to locate the range of the problem text; Add formatting by calling editor.formatter.apply('qc-contradiction'|'qc-missing'|'qc-nonstandard', {}, rng); At the same time, editor.dom.setAttribs() writes data-qc-id, data-qc-type, and data-qc-info (Base64 encoded JSON); Register three formats using editor.formatter.register(): qc-contradiction: red wavy underline; qc-missing: Yellow dashed background; qc-nonstandard: underlined in blue; Rendered as High blood pressure for 10 years .

[0094] Step S5: Implement interactive problem marking and one-click correction: Hovering over the element displays the message and suggestion via `editor.dom.setAttrib(span, 'title', ...)`; clicking on the element brings up the action panel by parsing the `data-qc-info` property via `editor.on('click')`. It provides options such as "Delete this sentence", "Modify the preceding text to 'has high blood pressure'", and "Ignore this sentence"; After selecting "Accept suggestion", within undoManager.transact(): Call editor.selection.setRng() to locate the problematic text; Call editor.execCommand('mceInsertContent', false, suggestion) to replace the content; Call editor.formatter.remove() to clear the formatting and data-* attributes; The operation is added to the undo stack.

[0095] Step S6: Implement the incremental update mechanism: Implement incremental updates: Compare the DOM before and after the changes using editor.on('input'); Extract the changed paragraphs using editor.dom.select(); Only send the changed content and the sentence before and after it to the AI; After the AI ​​returns a new question, the old anchor points are retained for the unchanged areas (the offset is adjusted). Apply the new format in batches.

[0096] Step S7: Implement export filtering for quality control marks: When exporting HTML: Normal editing mode: editor.getContent() combined with editor.dom.select('span[data-qc-id]') iterates through and removes data-* attributes; Alternatively, you can call editor.formatter.remove('qc-contradiction') or similar methods to clear all formatting. Quality control review mode: Retains the version of the data-* attributes after calling editor.setContent().

[0097] Specific application scenarios of this embodiment: Scenario 1: AI detection and issue tagging addition: The doctor writes in the medical record: "Patient denies history of hypertension. Past medical history: hypertension for 10 years." After a 500ms pause, QcPlugin debouncing is triggered, editor.selection.getRng() retrieves the current selection range and extracts the text of the corresponding paragraph, and a WebSocket streaming request is made to the AI; the AI ​​returns the following question: {qcId:"q1", qcType:"contradiction",confidence:0.95, message:"Contradicts 'denies hypertension'", suggestion:"", startOffset:12,endOffset:20}.

[0098] QcPlugin calls `editor.undoManager.transact()` to start a transaction: `editor.selection.setRng()` locates characters 12-20, `editor.formatter.apply('qc-contradiction', {}, rng)` adds a red wavy underline, and `editor.dom.setAttribs(span, {'data-qc-id':'q1', 'data-qc-type':'contradiction', 'data-qc-info':'eyJxY1...','contenteditable':'false'})` renders the data as... <span class="qc-contradiction" data-qc-id="q1" ... contenteditable="false"> High blood pressure for 10 years .

[0099] Scenario 2, One-click correction: When the doctor clicks the text, `editor.on('click')` parses `data-qc-info` and brings up the operation panel; selecting "Modify Previous Text", `undoManager.transact()` starts a new transaction: `editor.selection.setRng()` locates "deny", `editor.execCommand('mceInsertContent', false, 'Yes')` replaces it, and `editor.formatter.remove('qc-contradiction', {}, rng)` clears the q1 flag; after the transaction is committed, it is added to the undo stack, and can be undone with Ctrl+Z.

[0100] Scenario 3, Incremental Update: The doctor continues writing, inserting "take antihypertensive medication regularly" in the third sentence; the incremental algorithm compares the DOM before and after the change, editor.dom.select() extracts the changed paragraph, and sends the sentence and the sentences before and after it to the AI; the AI ​​returns a new question: {qcId:"q2", qcType:"missing", message:"Medication name not recorded", suggestion:"It is recommended to add the specific drug name", startOffset:25, endOffset:31}; the merging algorithm retains the cleared state of q1 and applies the q2 format in batches.

[0101] Scenario 4: Export cleaning document: Before the system calls editor.getContent(), it first uses editor.dom.select('span[data-qc-id]') to iterate through and remove all data-* attributes, outputting clean HTML.

[0102] Scenario 5, Quality Control Review Mode: The quality control department's backend system shows that the same medical record retains the version with the data-* attribute after calling editor.setContent().

[0103] Therefore, the advantages of this embodiment can be summarized as follows: In the TinyMCE editor, by declaring allowed custom attributes for spans in the initialization parameter `extended_valid_elements`, the default schema of TinyMCE's interception of custom attributes is bypassed. This allows span elements with `data-qc-*` attributes to be correctly parsed and persisted in the editor, resolving the technical obstacle of TinyMCE's default filtering of non-standard tags, which prevents problematic anchors from surviving. By registering `QcPlugin` and listening to input events, TinyMCE's plugin extension mechanism is utilized to achieve real-time triggering of AI quality control with minimal intrusion. By wrapping operations with `editor.undoManager.transact()`, formatting application and cleanup are ensured to be included in TinyMCE's official undo stack, resolving the persistent technical problem of "direct DOM manipulation being regarded as external tampering, resulting in lost undo marks". Adding formatting using `r.formatter.apply()` and writing data-* attributes using `editor.dom.setAttribs()`, combined with the three formats registered by `formatter.register()`, achieves visually differentiated rendering of issue markers and metadata persistence. Interaction is achieved by parsing `data-qc-info` using `editor.on('click')` and one-click correction is achieved using `editor.execCommand('mceInsertContent')`, leveraging TinyMCE's command execution mechanism to ensure the correctness of correction operations. Incremental updates are achieved by comparing the DOM before and after changes using `editor.on('input')`, and clean export is achieved by traversing and removing data-* attributes using `editor.dom.select()`, realizing a complete closed loop of incremental detection and dual-mode output.

[0104] Example 4: AI-Assisted Quality Control Marking and Real-Time Correction Method Based on Tiptap This embodiment details the specific implementation of AI-assisted quality control marking and real-time correction in the Tipptap rich text editor.

[0105] Tiptap is built on ProseMirror, which uses a strict schema to define document structure, abstracting content into nodes and tags. Tiptap provides extensibility through an extension mechanism.

[0106] The Tippap-based AI-assisted quality control labeling and real-time correction method in this embodiment specifically includes the following steps: Step S1: Register QcExtension and anti-jitter monitoring: Register a custom extension QcExtension in Tipptap, configure the plugin, and listen for the editor.on('update') event: Set the stabilization delay to 500ms; AI quality control detection is triggered when the user pauses input for 500ms. Extract the scope of changes (from / to).

[0107] Step S2: Extract the scope of changes and detect issues using AI quality control service. When AI quality control detection is triggered, the previous document version is cached through the plugin state. In the update callback, the differences between the nodes in the old and new document trees are compared, and the positions of the changed nodes are extracted. Extract the changed paragraph and its context text; Request AI quality control services via WebSocket streaming; The AI ​​returns a list of issues: issue type, confidence level, suggested corrections, and start and end points.

[0108] Step S3: Define a custom Mark qc-anchor in the ProseMirror Schema: Attribute definitions: qcId, qcType (contradiction / missing / nonstandard), confidence, message, suggestion; It can be superimposed on any text range and supports overlapping and intersecting question marks.

[0109] Step S4: Construct a Transaction, add a qc-anchor Mark, and simultaneously render the visual markers: QcExtension constructs Transaction: tr.addMark(from, to, schema.marks['qc-anchor'].create({...})), editor.dispatch(tr): Register the DecorationPlugin using addProseMirrorPlugins(); Generate Decoration based on qc-anchor Mark; Rendered as ; Visual style: Contradiction type: red wavy underline; Missing type: yellow dashed background; Nonstandard type: blue underline; Hovering displays messages and suggestions via tooltip extensions; Click to trigger the operation panel.

[0110] Step S5: Implement interactive problem marking and one-click correction: After the doctor selects "Accept Recommendation," the following will be invoked: editor.chain().focus() .deleteRange({from, to}) .insertContent(suggestion) .unsetMark('qc-anchor') .run() Automatically replace the problematic text with suggested corrections; Clear the qc-anchor Mark; Add to ProseMirror history; Ctrl+Z can be used to undo.

[0111] Step S6: Implement the incremental update mechanism for the plugin: Implement incremental updates for plugins: Cache the last document version in the plugin state; Compare node differences during update; Only send the changed paragraph and the sentence before and after it to the AI; After the AI ​​returns a new question, the Decoration update is triggered by dispatch(tr.setMeta('addQc', issues)); Retain the old anchor points for areas that have not been changed (adjust the from / to offsets).

[0112] Step S7: Implement export filtering for quality control marks: When exporting HTML: Normal editing mode: Filter qc-anchor marks using getHTML() in conjunction with parseOptions; Alternatively, call getJSON() and then iterate through and delete the qc-anchor from the marks array; Quality control review mode: Call getJSON() with qc-anchor marks version.

[0113] Specific application scenarios of this embodiment: Scenario 1: AI detection and issue tagging addition: The doctor writes in the medical record: "Patient denies history of hypertension. Past medical history: hypertension for 10 years." After a 500ms pause, QcExtension debouncing is triggered, the changed position of editor.state.selection.from is extracted, and a WebSocket streaming request is made to the AI; the AI ​​returns the following question: {qcId:"q1", qcType:"contradiction", confidence:0.95, message:"contradicts 'denies hypertension'", suggestion:"", from:12, to:20}.

[0114] The QcExtension constructs a Transaction: tr.addMark(12, 20, schema.marks['qc-anchor'].create({qcId:"q1", qcType:"contradiction",...})), editor.dispatch(tr); the DecorationPlugin generates the Decoration and renders it as... High blood pressure for 10 years , red wavy underline.

[0115] Scenario 2, One-click correction: The doctor clicks on the text, and QcExtension parses the data-qc-id to bring up the operation panel; selects "Modify Previous Text", executes editor.chain().focus().deleteRange({from:2, to:4}).insertContent("Yes").unsetMark('qc-anchor').run(), automatically replacing "deny" with "Yes" and clearing the q1 Mark; ProseMirror records this operation in history, and Ctrl+Z can undo it.

[0116] Scenario 3, Incremental Update: The doctor continues writing, inserting "take antihypertensive medication regularly" in the third sentence; the plugin compares the old and new document trees, identifies only the node change at from25, and sends this sentence and the sentences before and after it to the AI; the AI ​​returns a new question: {qcId:"q2", qcType:"missing", message:"Medication name not recorded", suggestion:"It is recommended to add the specific drug name", from:25, to:31}; the plugin merges the status, dispatches a new transaction to add q2.

[0117] Scenario 4: Export cleaning document: When the doctor clicks "Save", the system calls editor.getHTML({parseOptions:{preserveWhitespace:true}}), which, along with the extended parseHTML rules, filters the qc-anchor and outputs clean HTML.

[0118] Scenario 5, Quality Control Review Mode: The quality control department's backend system showed that the same medical record was called with getJSON(), which included the qc-anchor marks version.

[0119] Therefore, the advantages of this embodiment can be summarized as follows: Within the ProseMirror kernel of the Tipptap editor, by registering a QcExtension and listening to the editor.on('update') event, Tipptap's Extension mechanism is fully utilized to achieve real-time triggering of AI quality control with minimal intrusion. A custom Mark qc-anchor is defined in the ProseMirror Schema, leveraging ProseMirror's Mark system to achieve precise association between issue anchors and text ranges, supporting overlapping and intersecting issue marking. By constructing a Transaction and calling tr.addMark() to add qc-anchor Marks, ProseMirror's transaction mechanism is utilized to ensure operations are included in the history, supporting undo / redo. Visual rendering is achieved by registering a DecorationPlugin using addProseMirrorPlugins(), utilizing ProseMirror's Decoration system to achieve automatic synchronization between the View and Model layers. One-click correction is implemented using editor.chain().deleteRange().insertContent().unsetMark(), utilizing Tipptap's chained command API to ensure the atomicity and undoability of correction operations. Plugins are also used to achieve this. The state caches document versions and compares node differences to achieve incremental updates, sending only the changed parts to the AI, significantly reducing the cost of AI calls; clean export is achieved by using getHTML() in conjunction with parseOptions to filter qc-anchor Mark, decoupling quality control marks from exported content, and supporting combination with other ProseMirror extensions.

[0120] Example 5: AI-assisted quality control marking and real-time correction method based on wangEditor-next This embodiment describes in detail the specific implementation method of AI-assisted quality control marking and real-time correction in the wangEditor-next rich text editor.

[0121] wangEditor-next is based on the Slate data model and provides complete document customization capabilities; although Slate's Decoration or Mark system can be visually marked, the official implementation scheme has not been disclosed.

[0122] The AI-assisted quality control marking and real-time correction method based on wangEditor-next in this embodiment specifically includes the following steps: Step S1: Register the onChange debouncing listener: Register the onChange debouncing listener in wangEditor-next: Set the stabilization delay to 500ms; AI quality control detection is triggered when the user pauses input for 500ms. Extract the changed paragraph text.

[0123] Step S2: Extract the scope of changes and detect issues using AI quality control service. Once the AI ​​quality control check is triggered, the modified paragraph text and its context are extracted: Request AI quality control services via WebSocket streaming; The AI ​​returns a list of issues: issue type, confidence level, suggested corrections, and start and end points.

[0124] Step S3: Define a custom mark qc-anchor in the Slate model: Attribute definitions: qcId, qcType (contradictory / missing / non-standard), confidence, message, suggestion, startOffset, endOffset; Overlapping and cross-over are allowed.

[0125] Step S4: Register renderQcAnchor to achieve differentiated rendering: Register the renderQcAnchor rendering function: Different visual styles are returned based on qcType: Contradiction type: red wavy underline; Missing type: yellow dashed background; Nonstandard type: blue underline; Hovering displays a tooltip containing a message and suggestion.

[0126] Step S5: Implement interactive problem marking and one-click correction: Click on the question text to bring up the operation panel: Offers options such as "Accept suggestion", "Ignore this", and "View details"; After selecting "Accept suggestion": Call Transforms.insertText() to replace the question text with the suggestion; At the same time, Transforms.unsetNodes() clears the qc-anchor mark; Included in the history of Slate undo.

[0127] Step S6: Implement the incremental detection algorithm: Implement the incremental detection algorithm: Compare the old and new Slate document trees; Extract the path of the changed node; Only send the changed paragraph context to the AI; After the AI ​​returns a new problem anchor point, the old anchor points in the unchanged areas are merged (the offset is adjusted). Call Transforms.setNodes() to update in batches.

[0128] Step S7: Implement export filtering for quality control marks: When exporting HTML: Normal editing mode: Filters qc-anchor marks using custom serialize options, and outputs a clean, traceless document using getHtml({excludeMarks: ['qc-anchor']}); This mode is automatically triggered during printing; Quality control review mode: Call getHtml() with qc-anchor version.

[0129] Specific application scenarios of this embodiment: Scenario 1: AI detection and issue tagging addition: The doctor writes in the medical record: "Patient denies history of hypertension. Past medical history: hypertension for 10 years." After a 500ms pause, the onChange debounce is triggered, extracting the second sentence "hypertension for 10 years" and its context, and making a WebSocket streaming request to the AI ​​quality control service; the AI ​​returns the following issue: {qcId:"q1", qcType:"contradiction", confidence:0.95, message:"contradicts 'denies hypertension'", suggestion:"", startOffset:12, endOffset:20}.

[0130] The renderQcAnchor adds a red wavy underline mark to "hypertension for 10 years". Hovering the tooltip displays "Contradicts 'denies hypertension' (95% confidence) | Recommendation: Verify and delete or modify the preceding text".

[0131] Scenario 2, One-click correction: The doctor clicks on the text, and an operation panel pops up; selects "Change the previous text to 'has high blood pressure'", Transforms.insertText() replaces "deny" with "yes", and Transforms.unsetNodes() clears the q1 anchor point; Slate undo records the replacement, and the doctor can press Ctrl+Z to undo.

[0132] Scenario 3, Incremental Update: The doctor continues writing, inserting "take antihypertensive medication regularly" in the third sentence; the incremental detection algorithm compares the document tree and identifies that only the third sentence has changed, sending the sentence and the context of the sentences before and after it to the AI; the AI ​​returns a new question: {qcId:"q2", qcType:"inconsistency", message:"Medication name not recorded", suggestion:"It is recommended to add the specific drug name"}; the merging algorithm retains the cleared state of q1 and adds the anchor point q2.

[0133] Scenario 4: Export cleaning document: The doctor clicks "Save", and the system calls getHtml({ excludeMarks: ['qc-anchor']}), which outputs clean HTML.

[0134] Scenario 5, Quality Control Review Mode: The quality control department checked the backend and found that the same medical record called getHtml() with a version of qc-anchor.

[0135] Therefore, the advantages of this embodiment can be summarized as follows: In the Slate data model of the wangEditor-next editor, the onChange debouncing listener is registered, fully utilizing wangEditor-next's event listening mechanism to achieve real-time triggering of AI quality control with minimal intrusion. A custom mark qc-anchor is defined in the Slate model, leveraging Slate's flexible data model to achieve precise association between issue anchors and text ranges, supporting overlapping and cross-marking of issues. Visual rendering is achieved by registering the renderQcAnchor rendering function, utilizing Slate's declarative rendering mechanism to achieve automatic synchronization between view and data. One-click correction is implemented using Transforms.insertText() and Transforms.unsetNodes(), utilizing Slate's structured transformation API to ensure the atomicity and undoability of correction operations. Incremental updates are achieved by extracting the path of changed nodes by comparing the old and new Slate document trees, utilizing Slate's node path system to accurately identify change locations and send only the changed parts to the AI. Finally, getHtml({ excludeMarks: ['qc-anchor']) is used to achieve the final result. To achieve clean export, the custom serialization options of wangEditor-next are used to decouple quality control markers from exported content. Plugin-based encapsulation ensures non-intrusive version upgrades.

[0136] Example 6: System Hardware Example This embodiment fully describes the specific hardware configuration and module functions of an AI-assisted quality control marking and real-time correction device based on a rich text editor.

[0137] like Figure 7 As shown, the AI-assisted quality control marking and real-time correction device based on a rich text editor in this embodiment includes the following seven core modules: 1. Trigger the listening module This module is used to register debouncing listeners in a rich text editor. When a user's input pauses for a preset delay, an AI quality control check is triggered. In one specific implementation, this module exists as a software plugin and is integrated with the target rich text editor (Quill / Tiptap / wangEditor-next / CKEditor 5 / TinyMCE). Its core functions include: listening for document content change events (Quill's text-change, Tiptap's update, wangEditor-next's onChange, CKEditor 5's change:data, and TinyMCE's input); setting the debouncing delay to 500ms; and triggering the AI ​​quality control check process when a user's input pauses for a preset delay.

[0138] 2. AI Detection Module This module is used to extract the scope of document changes and obtain a list of issues through the AI ​​quality control service. Its core functions include: extracting the scope of changed content and its context (CKEditor 5 uses `differ.getChanges()`, Quill uses Delta for difference comparison, TinyMCE uses `getRng()` to get paragraphs, Tipta uses `selection.from` to extract the change location, and wangEditor-next uses document tree comparison); making streaming requests to the AI ​​quality control service via WebSocket; and receiving and parsing the list of issues returned by the AI.

[0139] 3. Problem Anchor Point Definition Module This module is used to define issue anchors carrying metadata in the document model of rich text editors. Its core functions include: defining custom issue anchor types in the document model of each editor (qc-markerMarker for CKEditor 5, qc-anchor Attributor for Quill, data-qc-* attributes for TinyMCE, qc-anchorMark for Tiptap, and qc-anchor mark for wangEditor-next); and defining metadata attributes: unique issue identifier, issue type, confidence level, issue description, and suggested correction text.

[0140] 4. Marker rendering module This module is used to add issue anchors to issue text and synchronously render visual markers within the editor's transaction framework. Its core functions include: adding issue anchors within the editor's transaction framework (CKEditor 5's writer.addMarker(), Quill's updateContents(), TinyMCE's undoManager.transact()+formatter.apply(), Tiptap's tr.addMark(), and wangEditor-next's Transforms.setNodes()); and synchronously displaying visual markers (red wavy underline / yellow dashed background / blue underline) through the view rendering mechanism.

[0141] 5. Interactive Correction Module This module is used to bind hover tips and clickable action panels to issue markers and enable one-click correction and replacement of issue text. Its core functions include: displaying issue description and suggested correction text when hovering; bringing up the action panel when clicking; after the user selects "accept suggestion", the replacement operation is performed within the editor's transaction framework, replacing the issue text with the suggested correction text and clearing the corresponding issue anchor; the operation is added to the undo / redo stack.

[0142] 6. Incremental Update Module This module is used to compare document changes, sending only the changed paragraphs to the AI ​​quality control service and merging old and new issue anchors. Its core functions include: comparing the differences before and after document changes (CKEditor 5's differ.getChanges(), Quill's Delta difference algorithm, TinyMCE's DOM comparison, Tippap's node difference comparison, and wangEditor-next's document tree comparison); extracting the changed nodes or paragraphs; sending only the changed parts and their context to the AI ​​quality control service; and merging newly returned issues with the old issue anchors retained in the unchanged areas for batch updates.

[0143] 7. Export Filtering Module This module is used to selectively retain or filter problem anchors based on the export mode, outputting clean documents or quality control log documents. Its core functions include: filtering problem anchors during export in normal editing mode (CKEditor 5 filters via downcast converter, Quill filters via addMatcher, TinyMCE filters via traversal to remove data-* attributes, Tiptap filters via parseOptions, and wangEditor-next filters via excludeMarks); and retaining problem anchors and processing records during export in quality control review mode.

[0144] By registering debouncing listeners in the rich text editor through a trigger listening module, AI quality control is automatically triggered, allowing users to receive real-time quality control feedback without manual operation. The AI ​​detection module extracts the scope of document changes and obtains a list of issues through the AI ​​quality control service, achieving accurate extraction of changed content and efficient invocation of AI detection. The issue anchor definition module defines issue anchors carrying metadata in the document model, achieving persistent association between quality control markers and document content. The marker rendering module adds issue anchors to issue text within the editor's transaction framework and simultaneously renders visual markers, ensuring the atomicity and reversibility of quality control operations while achieving instant visualization of markers. The interactive correction module binds hover tips and click operation panels to issue markers, enabling one-click correction and replacement of issue text, achieving immersive handling of quality control issues without leaving the editing interface. The incremental update module compares document change differences, sending only the changed paragraphs to the AI ​​and merging old and new issue anchors, significantly reducing AI invocation costs. The export filtering module selects to filter or retain issue anchors based on the export mode, achieving dual-mode output: "visible during editing, hidden when sending." The seven modules work together to achieve a complete closed loop of AI-assisted quality control labeling and real-time correction.

[0145] Example 7: General Complete Application Scenario Example This embodiment uses a complete medical document editing scenario as an example to illustrate the complete workflow of the present invention in practical applications. This embodiment is independent of specific editor types and is applicable to any of the aforementioned five editors.

[0146] Scenario: A doctor is writing an "admission record" in the electronic medical record system, and a logical contradiction occurs.

[0147] Step 1: Doctor input and anti-shake trigger The doctor entered the following in the medical record editing interface: "Patient denies history of hypertension. Past medical history: hypertension for 10 years." After a 500ms pause, the system's anti-shake monitoring triggered the AI ​​quality control detection process.

[0148] Step 2: AI Detection and Problem Return The system extracts the changed content and makes a streaming request to the AI ​​quality control service via WebSocket. The AI ​​detects a logical contradiction and returns the following issue: the issue type is "contradiction", the confidence level is 95%, the issue description is "contradicts 'denying hypertension'", and the start and end positions point to "hypertension for 10 years".

[0149] Step 3: Adding Problem Markers and Visual Rendering The system adds a problem anchor point for "hypertension for 10 years" within the editor's transaction framework, carrying complete metadata. The editor view synchronously renders a red wavy underline, allowing doctors to visually see the problem marker in the editing interface.

[0150] Step 4: Hover Tip The doctor hovered the mouse over the red wavy underlined text, and the system displayed a tooltip overlay: "Contradicts 'denies hypertension' (95% confidence level) | Recommendation: Verify and delete or modify the preceding text."

[0151] Step 5: Click on the operation panel When the doctor clicks on the question text, the system brings up an operation panel, providing three options: "Delete this sentence", "Change the preceding text to 'has high blood pressure'", and "Ignore this sentence".

[0152] Step 6: One-click correction When the doctor selects "Change the preceding text to 'has high blood pressure'", the system executes the following within the editor's transaction framework: replacing "deny" with "yes" and clearing the issue anchor; the operation is added to the undo / redo stack, and the doctor can undo it by pressing Ctrl+Z.

[0153] Step 7: Incremental Update The doctor continued writing, inserting "take antihypertensive medication regularly" in the third sentence. The system compared the document changes, sending only the changed paragraphs and their context to the AI. The AI ​​returned new questions, and the system merged the anchor points of the old and new questions before updating the view in batches.

[0154] Step 8: Export the cleanup document After the doctor completes the document and clicks "Save", the system filters out all problematic anchor points when exporting in normal editing mode, outputting a clean HTML document without quality control traces such as red wavy lines, which can be directly used for printing or external distribution.

[0155] Step 9: Quality Control Review When the quality control department views the same medical record in the background, the system retains all issue markers and doctors' handling records (acceptance / ignore) when exporting in quality control review mode, for use in performance evaluation and quality analysis.

[0156] Example 8: Electronic Device Example This embodiment provides an electronic device that can execute the above-described method embodiments.

[0157] like Figure 8 As shown, the electronic device 1 includes, but is not limited to: a memory 11, a processor 12, a display 13, and a network interface 14. The electronic device 1 connects to the network through the network interface 14 to obtain raw data or upload recognition results. The network can be an intranet, the Internet, a 4G / 5G network, Wi-Fi, etc.

[0158] The memory 11 includes at least one type of readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In this embodiment, the memory 11 can be an internal storage unit of the electronic device 1 (e.g., hard disk or memory) or an external storage device. The memory 11 is used to store the operating system and various application software installed on the electronic device 1, such as storing the program code of the AI-assisted quality control marking and real-time correction program 10 described in this invention.

[0159] The processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip. The processor 12 is used to control the overall operation of the electronic device 1, such as performing data interaction or communication-related control and processing. In this embodiment, the processor 12 is used to run the program code stored in the memory 11, such as running the AI-assisted quality control marking and real-time correction program 10, to implement any of the steps described in the above method embodiments.

[0160] The display 13 is used to display information processed in the electronic device 1 and to display a visual working interface, such as a rich text editor interface and filled document content.

[0161] Network interface 14 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface), which is typically used to establish a communication connection between electronic device 1 and other electronic devices (such as an HIS server).

[0162] Figure 8 Only an electronic device 1 having components 11-14 and procedure 10 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0163] Example 9: Example of a computer-readable storage medium The present invention also proposes an embodiment of a computer-readable storage medium, which may be non-volatile or volatile, and may be any one or any combination of several of the following: hard disk, multimedia card, SD card, flash memory card, SMC, read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), and USB memory.

[0164] The computer-readable storage medium stores an AI-assisted quality control marking and real-time correction program, which, when executed by a processor, can implement all or part of the steps described in the above method embodiments.

[0165] The specific implementation of the computer-readable storage medium of the present invention is largely the same as the specific implementation of the AI-assisted quality control marking and real-time correction method described above, and will not be repeated here.

[0166] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method for AI-assisted quality control marking and real-time correction based on a rich text editor, characterized in that, Includes the following steps: S1. Register a debouncing listener in the rich text editor. When the user's input pauses for a preset delay, trigger the AI ​​quality control detection process. S2. Extract the scope of content changes in the document, and obtain a list of issues through AI quality control services. Each issue in the issue list shall include at least the issue type, confidence level, issue description, suggested correction text, and the start and end positions of the issue in the document. S3. Define a custom issue anchor in the document model of the rich text editor. The issue anchor carries the following metadata attributes: unique issue identifier, issue type, confidence level, issue description, and suggested correction text. S4. Within the editor's transaction framework, add question anchors to the text range corresponding to each question in the question list, and synchronously display visual markers through the editor's view rendering mechanism. S5. Bind interactive events to the problem marker: display the problem description and suggested correction text when hovering, and bring up the operation panel for the user to choose the handling method when clicking; when the user chooses to accept the suggestion, replace the problem text with the suggested correction text in the editor's transaction framework, and clear the corresponding problem anchor. S6. In subsequent AI quality control testing, compare the differences before and after the document changes, extract the changed nodes or paragraphs, send only the changed parts and their context to the AI ​​quality control service, and then update them in batches after merging the newly returned issues with the old issue anchors retained in the unchanged areas. S7. When exporting a document, selectively retain or filter problem anchors based on the export mode: filter problem anchors when exporting in normal editing mode to output a clean document; When exporting in quality control review mode, retain the issue anchor points and processing records.

2. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to claim 1, characterized in that, The rich text editor is CKEditor 5. The anti-shake monitoring is implemented by registering a QcPlugin and listening to the editor.model.document.on('change:data') event; The scope of changes is extracted using editor.model.document.differ.getChanges(); The aforementioned problem anchor is achieved by registering a custom Marker type qc-marker in CKEditor 5 Schema; The addition of the issue anchor point is implemented within the Writer transaction using writer.addMarker(), and the visual rendering is implemented using editor.conversion.for('editingDowncast').markerToHighlight(). The interactive event is bound via editor.conversion.for('editingDowncast').markerToElement(), and the one-click correction is implemented through the custom command AcceptQcCommand. The incremental update is achieved by comparing with difference.getChanges(); The clean export is achieved by using editor.data.stringify() in conjunction with the downcast converter to filter the qc-marker.

3. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to claim 1, characterized in that, The rich text editor is Quill editor; The anti-shake monitoring is implemented by registering a QcModule and listening for the text-change event; The scope of the change is extracted by comparing the old and new Delta values. The problem anchor is achieved by registering a custom Attributor QcAnchor in the Parchment system; The addition of the problem anchor point is achieved by constructing Delta and calling quill.updateContents() to add the qc-anchor attribute; the visual rendering is achieved by registering a custom Blot QcMark. The interactive event is implemented by parsing data-qc-info, and the one-click correction is implemented by constructing the retain / delete / insert operation of Delta; The incremental update is implemented using the Delta difference algorithm; The clean export is achieved by registering filtering rules using addMatcher.

4. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to claim 1, characterized in that, The rich text editor is the TinyMCE editor; The anti-shake monitoring is implemented by registering a QcPlugin and listening to the input event; The change range is obtained by using editor.selection.getRng() to get the current selection range, and then using editor.dom.getParent() to locate the paragraph node and extract the paragraph text. The aforementioned problem anchor is achieved by declaring allowed custom attributes of the span in the TinyMCE initialization parameter extended_valid_elements, thereby bypassing the default schema's interception of custom attributes; The process of adding issue anchors involves wrapping the operation with `editor.undoManager.transact()`, adding formatting with `editor.formatter.apply()`, and writing data-* attributes with `editor.dom.setAttribs()` to achieve visual rendering. The interactive event is implemented by parsing data-qc-info through editor.on('click'), and the one-click correction is implemented through editor.execCommand('mceInsertContent'). The incremental update is achieved by comparing the DOM before and after the change using editor.on('input'); The clean export is achieved by iterating through and removing data-* attributes using editor.dom.select().

5. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to claim 1, characterized in that, The rich text editor is the Tipptap editor; The anti-shake monitoring is implemented by registering a QcExtension and listening to the editor.on('update') event; The scope of the change is achieved by caching the previous document version in the Plugin state, comparing the differences between the nodes in the old and new document trees in the update callback, and extracting the positions of the nodes that have changed. The problem anchor is implemented by defining a custom Mark qc-anchor in the ProseMirror Schema; The addition of the problem anchor point is achieved by constructing a Transaction and calling tr.addMark() to add the qc-anchor Mark, and the visual rendering is achieved by registering the DecorationPlugin through addProseMirrorPlugins(). The one-click correction is implemented using editor.chain().deleteRange().insertContent().unsetMark(); The incremental update is achieved by caching document versions in the plugin state and comparing node differences. The clean export is achieved by using getHTML() in conjunction with parseOptions to filter the qc-anchor Mark.

6. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to claim 1, characterized in that, The rich text editor is wangEditor-next editor; The anti-shake monitoring is implemented by registering an onChange anti-shake listener; The scope of the change is obtained by extracting the text of the changed paragraph and its context. The problem anchor is implemented by defining a custom mark qc-anchor in the Slate model; The visual rendering is achieved by registering the renderQcAnchor rendering function; The one-click correction is achieved through Transforms.insertText() and Transforms.unsetNodes(); The incremental update is achieved by comparing the old and new Slate document trees to extract the path of the changed node; The clean export is achieved using getHtml({ excludeMarks: ['qc-anchor']}).

7. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to any one of claims 1-6, characterized in that, In step S4: The visual markers include a variety of preset question type marker styles, with different question types corresponding to different visual styles, and the visual styles are visually distinguishable from each other; The addition and removal of the aforementioned problem anchors are both completed within the editor's transaction framework, ensuring that the operations are included in the editor's undo / redo stack.

8. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to any one of claims 1-6, characterized in that, In step S5: The operation panel provides at least two handling options, including accepting the suggested corrective action and ignoring the problem. The one-click correction and replacement operation and the problem anchor point clearing operation are completed in the same editor transaction to ensure the atomicity of the operation.

9. The AI-assisted quality control marking and real-time correction method based on a rich text editor according to any one of claims 1-6, characterized in that, In step S6: The AI ​​quality control service communicates with the editor via WebSocket or HTTP streaming interface; In the incremental update, the changed portion and its context are sent to the AI ​​quality control service.

10. An AI-assisted quality control marking and real-time correction device based on a rich text editor, characterized in that, include: The trigger listening module is used to register debouncing listeners in the rich text editor. When the user's input pauses for a preset delay, an AI quality control detection is triggered. The AI ​​detection module is used to extract the scope of document changes and obtain a list of issues through AI quality control services. The issue anchor definition module is used to define issue anchors carrying metadata in the document model of the rich text editor; The markup rendering module is used to add issue anchors to issue text and simultaneously render visual markup within the editor's transaction framework; The interactive correction module is used to bind hover tips and click operation panels to issue markers, and to enable one-click correction and replacement of issue text; The incremental update module is used to compare differences in document changes, sending only the changed paragraphs to the AI ​​quality control service and merging the old and new issue anchors. The export filtering module is used to selectively retain or filter problem anchors based on the export mode, outputting clean documents or quality control trace documents.