Implementation method and device of intelligent writing assistant and storage medium

By initiating a writing assistant request in the user editing document, and using the large language model to generate and convert the response text of the format flag, the problem of mismatch between the response text and the editing document format is solved, achieving seamless connection and user experience improvement.

CN120471025APending Publication Date: 2025-08-12BEIJING ZHENGYAN SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510519612.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

In the prior art, the response text does not match the format of the user's edited document, resulting in the user's need to manually adjust it, affecting the user's experience.

Method used

By initiating a writing assistant request in a document edited by the user, a large language model is used to generate a response text containing format flags, and format conversion is performed on the front end, so that the response text is uniformly connected with the document format edited by the user.

Benefits of technology

It realizes seamless format connection between the response text and the user edited documents, reducing the steps of manual adjustment by users and improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120471025A_ABST
    Figure CN120471025A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent writing assistant implementation method and device and a storage medium, and the method comprises the steps: initiating a writing assistant request in a first document edited by a user, and organizing the first document according to a block structure; the large language model deployed at the rear end generates a response text and returns the response text to the front end; the front end performs format conversion, determines response text content and a corresponding format flag, takes the determined response text content as target text content, takes the corresponding format flag as a target format flag, and converts the format of the target text content into a format corresponding to the target format flag; and embedding the target text content after format conversion into a first document edited by a user as a block structure. By applying the scheme of the embodiment of the invention, the response text output by the large language model can be automatically converted into a proper format and is connected with the text edited by the user, and the user does not need to spend extra time for adjustment, so that the user experience is better improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method for implementing an intelligent writing assistant, a device for implementing an intelligent writing assistant, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the widespread adoption of digital office work, users are increasingly demanding writing assistance tools. Existing technologies typically output text based on user queries for reference, thereby assisting users in writing. However, these technologies often fail to consider the format of the document being edited, resulting in mismatches between the output text and the document, forcing users to manually adjust the format, impacting the user experience. Summary of the Invention

[0003] In view of the above-mentioned prior art, an embodiment of the present invention discloses a method for implementing an intelligent writing assistant, which can overcome the defect of mismatch between the formats of the response text and the edited text, and achieve the purpose of unified format connection.

[0004] In view of this, an embodiment of the present application proposes a method for implementing an intelligent writing assistant, which includes:

[0005] Initiating a writing assistant request in a first document edited by a user, where the first document is a document displayed based on a front-end and is organized according to a block structure. Different block structures correspond to different block flags, and the block flags are formatting flags that comply with formatting rules of the first document.

[0006] The large language model deployed on the backend generates a response text according to the writing assistant request and returns the response text to the frontend. The large language model is aware of the formatting rules of the first document in advance, and the response text includes the formatting mark.

[0007] The front end performs format conversion in the process of receiving the response text, determines the response text content and the corresponding format mark, uses the determined response text content as the target text content, uses the corresponding format mark as the target format mark, converts the format of the target text content into the format corresponding to the target format mark, and embeds the target text content after format conversion as the block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

[0008] In response to the above-mentioned prior art, an embodiment of the present invention discloses an implementation device of an intelligent writing assistant, which can overcome the defect of mismatch between the formats of the response text and the edited text, and achieve the purpose of unified format connection.

[0009] In view of this, an embodiment of the present application proposes a device for implementing an intelligent writing assistant, which includes:

[0010] a user interaction module, configured to initiate a writing assistance request in a first document being edited by a user, wherein the first document is a document displayed based on a front-end, the first document being organized according to a block structure, different block structures corresponding to different block flags, and the block flags being format flags that comply with formatting rules of the first document;

[0011] a response module, configured to generate a response text based on the writing assistant request using a large language model deployed on the backend, and return the response text to the frontend, wherein the large language model is previously aware of the formatting rules of the first document, and the response text includes the formatting mark;

[0012] A format conversion module is used for the front end to perform format conversion in the process of receiving the response text, determine the response text content and the corresponding format mark, use the determined response text content as the target text content, use the corresponding format mark as the target format mark, convert the format of the target text content into the format corresponding to the target format mark, and embed the target text content after format conversion as the block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

[0013] In response to the above-mentioned prior art, an embodiment of the present invention discloses a computer-readable storage medium, which can overcome the defect that the response text and the editing text format do not match, and achieve the purpose of unified format connection.

[0014] A computer-readable storage medium stores computer instructions, which, when executed by a processor, can implement the steps of the above-mentioned method for implementing an intelligent writing assistant.

[0015] In view of the above-mentioned prior art, an embodiment of the present invention discloses a computer program product, which can overcome the defect of mismatch between the formats of the response text and the edited text, and achieve the purpose of unified format connection.

[0016] A computer program product includes computer instructions, which, when executed by a processor, implement the above-mentioned method for implementing an intelligent writing assistant.

[0017] To sum up, in the implementation scheme of the intelligent writing assistant provided by the present application, a writing assistant request is initiated for the first document edited by the user and organized using a block structure. The large language model on the back end generates a response text based on the writing assistant request. The front end performs format conversion according to the block structure granularity in the process of receiving the response text, and converts the format of the response text into a format that conforms to the format rules of the first document, so that the response text is seamlessly connected in format with the first document edited by the user. The user does not need to adjust the format of the response text, which greatly improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0019] Figure 1 This is a flowchart of Example 1 of the implementation method of the intelligent writing assistant of this application.

[0020] Figure 2 This is a flowchart of the recognition and optimization of writing assistant requests in the second embodiment of the method of the present application.

[0021] Figure 3 This is a flowchart of the third embodiment of the method of the present application for integrating information and generating prompt words.

[0022] Figure 4 This is a flowchart of the fourth embodiment of the method of the present application for converting the format of the response text.

[0023] Figure 5 This is a flowchart of temporary format conversion in Example 5 of the method of this application.

[0024] Figure 6 This is a flowchart of the sixth embodiment of the method of the present application for completing the missing format flags.

[0025] Figure 7 This is a flowchart of the seventh embodiment of the method of the present application for implementing error correction using format flags.

[0026] Figure 8 This is a flowchart of Example 8 of the implementation method of the intelligent writing assistant of the present application.

[0027] Figure 9 It is a structural diagram of embodiment 1 of the device of the present application.

[0028] Figure 10 It is a structural diagram of the second embodiment of the device of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0030] The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way are interchangeable where appropriate, so that the embodiments of the invention described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or that are inherent to these processes, methods, products or apparatus.

[0031] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0032] In the first embodiment of the method of the present application, its application environment may be in a system such as an office system. The office system here refers in particular to a collaborative office system, such as collaborative notes, which is deployed on the front end and the back end. Among them, the front end refers to the front end for the collaborative office system, and the back end refers to the back end for the collaborative office system, both of which are deployed on the cloud and implemented by the cloud server. The user accesses the document displayed on the front end through a browser or the like. During the access process, the document (such as collaborative notes) displayed on the web page can be edited. When help is needed during the editing process, a request is initiated through the writing assistant. The large language model deployed on the back end can process the writing assistant request and return the response text to the text being edited by the user, thereby achieving the purpose of assisting the user in writing. The example here is an office system, and in actual applications it can also be other application systems, such as e-commerce systems, etc., as long as the application scenario in which a writing assistant is needed during the editing process can be realized.

[0033] Figure 1 This is a flow chart of the first embodiment of the method for implementing the intelligent writing assistant of this application. Figure 1 As shown, the method includes:

[0034] Step 101: Initiate a writing assistant request in the first document edited by the user. The first document is a document displayed based on the front end. The first document is organized according to a block structure. Different block structures correspond to different block flags. The block flag is a format flag that complies with the format rules of the first document.

[0035] In this embodiment of the present application, the first document edited by the user is organized according to a block structure, and different block structures correspond to different block flags. A block generally refers to a document element, such as a title, paragraph, ordered list, or unordered list, while a block flag is an identifier of the block structure, such as a dash or space. The set of all block flags supported by the first document is called the formatting rules of the first document, and these rules can generally be represented by regular expressions.

[0036] Step 102: The large language model deployed on the backend generates a response text according to the writing assistant request and returns the response text to the frontend. The large language model knows the formatting rules of the first document in advance, and the response text includes formatting marks.

[0037] A large language model (LLM) is a machine learning algorithm that uses a large amount of text data to learn the statistical characteristics of a language and then generate new text with similar statistical characteristics. The core goal of a language model is to establish a statistical model to estimate the probability of each word or character appearing in a text sequence, thereby achieving natural language processing tasks such as language generation and language understanding. A large language model is a pre-trained language model that uses large-scale corpus data for pre-training and is one of the methods of natural language processing. In short, a large language model is a deep learning model trained on a huge data set to understand human language, and its core goal is to accurately learn and understand human language. Existing large language models (LLMs) usually use streaming output, which may not contain formatting marks and cannot be converted to a format according to a block structure. Unlike existing large language models, the large language model in the embodiment of the present application has learned the formatting rules of the first document in advance, so that the output response text can contain formatting marks. These formatting marks will be further used for subsequent format conversion.

[0038] Step 103: The front end performs format conversion in the process of receiving the response text, determines the response text content and the corresponding format mark, uses the determined response text content as the target text content, uses the corresponding format mark as the target format mark, converts the format of the target text content into the format corresponding to the target format mark, and embeds the converted target text content as a block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

[0039] The response text output by the large language model is generated step by step and delivered to the user. In an embodiment of the present application, the format of the response text is converted in blocks, that is, the format of the received response text is converted into a format corresponding to the format mark therein. In order to distinguish it from other subsequent response texts and formats, the response text content described here is referred to as the target text content, and the format mark is referred to as the target format mark. Assuming that the received response content is "Analysis Report" and contains the title block mark "#", then "Analysis Report" will be placed as the title in the first document, for example, in a manner that is enlarged to size 1, bold, and centered. Since the title format in the format rules of the first document edited by the user is the same as that of the first document, which is also size 1, bold, and centered, the response text output by the large language model can be connected with the format of the first document.

[0040] By applying the solution of the first embodiment of the method of the present application, the response text output by the large language model can be automatically converted into a suitable format and connected with the text edited by the user. The user does not need to spend extra time to make adjustments, thereby better improving the user experience.

[0041] In another method embodiment 2, when a user initiates a writing assistant request, in order to obtain a more accurate response text, the request can be further identified and optimized to more accurately determine the user's intention and facilitate the subsequent accurate response by the large language model. Figure 2 As shown, the method for identifying and optimizing the writing assistant request in the second method embodiment includes:

[0042] Step 201: Identify user intent based on a writing assistant request.

[0043] The identification method described here can perform semantic analysis based on the content input by the user. The specific method can be implemented using any existing technology to preliminarily determine the user's intention, such as seeking writing suggestions, querying factual information or other types of questions. The specific factual method will not be repeated here.

[0044] Step 202: According to the writing assistant request, any one or any combination of the existing knowledge base, network search resources, and large language model is retrieved to obtain request optimization information.

[0045] In actual applications, although semantic analysis can be used to determine the approximate intent of user output, in order for the large language model to respond to users more accurately, the user intent can also be optimized to provide more information. In actual applications, request optimization information can be obtained by searching any one or any combination of existing knowledge bases, online search resources, and large language models. For example: if the user's intent is to query factual information, the existing knowledge base and online search resources can be searched; or, if the user's intent is to seek writing advice, the request can be submitted to the large language model; or, if the user's intent is to seek writing advice, the request can be submitted to the large language model first, and then submitted to the large language model, and so on. The online search resources mentioned here specifically refer to Internet resources. In addition, if the knowledge base contains user-uploaded documents or user-uploaded documents are stored separately, the user-uploaded documents can also be retrieved. In short, the writing assistant request is optimized here using technical means such as knowledge bases, online search resources, large language models, and user-uploaded documents.

[0046] A knowledge base can be understood as the knowledge information provided by the backend of a system (such as an office system). In another embodiment, the knowledge base can be divided into three levels of knowledge bases based on the scope of authority: a personal knowledge base, an organizational knowledge base, and a public knowledge base. Among them, the personal knowledge base can only be privately accessed by the user and stores the information most relevant to the user, such as documents uploaded by the user in advance. The format of the uploaded documents is not restricted, and PDF documents or Word documents can be uploaded. The document content is usually content that the user frequently uses, such as document content that the user edits using the system front end and accumulates over time. Of course, in actual applications, the documents uploaded by users can also be stored separately instead of in the personal knowledge base, and can also be searched. The organizational knowledge base provides information related to the organization and is accessed by users who are members of the organization, while the public knowledge base provides public knowledge and is accessible to all users in the system. It should be noted that the knowledge base described in the embodiment of the present application includes both knowledge information stored in a database and user-uploaded documents stored outside the database. In addition, in step 202, in order to optimize the writing assistance request initiated by the user, priority can be given based on the information provided by the above-mentioned personal knowledge base, organizational knowledge base, and public knowledge base.

[0047] In response to writing assistant requests, the backend can also use Internet searches to obtain optimization information.

[0048] For writing assistant requests, the backend can also use large language models to obtain priority information.

[0049] The above steps 201 to 202 can be performed between steps 101 and 102 of the first method embodiment. That is, after initiating a writing assistant request in the first document edited by the user, the user's intent is first identified based on the writing assistant request, and then any one or any combination of existing knowledge bases, network search resources, and large language models are retrieved based on the writing assistant request to obtain request optimization information. In short, the embodiment of the present application can identify and optimize user intent based on the writing assistant request.

[0050] In another method embodiment 3, in order to accurately transmit the user intention to the large language model, after obtaining the request optimization information in the above step 202, the information can also be integrated and a prompt word can be generated. Figure 3 As shown, the method of integrating information and generating prompt words in the third embodiment of the method includes:

[0051] Step 301: Integrate the user intention and the request optimization information as an integrated writing assistant request.

[0052] The above step 201 identifies the user intention, and step 202 obtains the request optimization information. Here, these two parts of information are integrated, such as by splicing or fusion.

[0053] Step 302: Generate prompt words according to the integrated writing assistant request.

[0054] In the embodiment of the present application, since the existing large language model does not contain formatting marks, it will not contain formatting marks in the first document edited by the user. In order to provide accurate information to the large language model and hope that the large language model will output in the required format, this step generates prompt words according to the integrated writing assistant request. Prompt word engineering technology can be used to generate prompt words. Prompt word engineering technology is a technology that improves the generation results of artificial intelligence models by optimizing input text. In essence, it converts user needs into language instructions that the model can understand, and achieves precise control through iteration and adjustment. In actual applications, the format rules of the first document can also be input into the large language model in advance in the form of prompt words, so that the large language model can know the format rules of the first document and output it in the required format.

[0055] Step 303: Input the integrated writing assistant request and prompt words into the backend large language model.

[0056] The integrated writing assistant request utilized in this embodiment of the present application is optimized and more accurate and informative than the writing assistant request in step 101. The prompt words are also input into the large language model, enabling the large language model to more accurately generate response information that includes formatting tags consistent with the first document. In actual applications, if the writing assistant request initiated by the user is accurate and informative, steps 201-202 and 301-303 can be omitted. Identification and optimization are preferred embodiments, not essential technical measures.

[0057] In another method embodiment 4, the specific implementation process of converting the format of the response text is as follows: Figure 4 As shown, including:

[0058] Step 401: Determine whether the response text has been processed. If so, then the step of format conversion performed by the front end in the process of receiving the response text is ended. Otherwise, continue to execute step 402.

[0059] Step 402: Determine whether a block structure has been processed. If so, return to step 401; otherwise, continue to execute step 403.

[0060] Step 403: Determine the response text content and the corresponding format mark, use the determined response text content as the target text content, and use the corresponding format mark as the target format mark.

[0061] As mentioned above, the formatting rules of the first document are represented by regular expressions. If there are multiple formatting rules, there will be multiple corresponding regular expressions, and all regular expressions will be combined into a rule set. For example, the rule set may include:

[0062] 1) The title should start with a specific number of #;

[0063] 2) Unordered list items should start with - or *;

[0064] 3) Ordered list items should begin with 1. or other numbers followed by periods;

[0065] 4) Ordinary paragraphs should not have list markers or heading markers;

[0066] 5) The indentation should start with \t or a sufficient number of spaces;

[0067] 6)……

[0068] The currently received response text content is used as the determined response text content. When determining the target format mark, a rule deviation function can be used to calculate the matching degree between the response text content and the format mark in the format rule of the first document. This matching method can be expressed as:

[0069]

[0070] Among them, B i Indicates the response text content, F indicates the candidate format flag, D rules (B i ,F) represents the matching degree between the response text content and the candidate format mark. Match(B i ,r) represents the Boolean matching function, r represents the rule set R F The regular expression in B is F, and F is a set of candidate formats. When the regular expression r successfully matches B i , the result is True, otherwise the result is False. is the indicator function, when B i If the regular expression is not satisfied, the result is 1, otherwise the result is 0. r The weight of the regular expression r, which reflects the importance of the rule in matching.

[0071] After using the rule deviation function to calculate the matching degree between the response text content and the formatting mark in the formatting rule of the first document, the mark with the smallest matching error is used as the target formatting mark:

[0072]

[0073] in, is the target format flag, Indicates the smallest matching error.

[0074] Step 404: Convert the format of the target text content into a format corresponding to the target format mark.

[0075] Step 405 : Embed the target text content after format conversion into the first document edited by the user as a block structure, and return to step 401 .

[0076] In practical applications, large language models are usually streamed text outputs, and this embodiment converts the format of the received part in real time according to the granularity of the block structure. The prior art usually has two ways to perform conversion, one is the full-text single conversion method, and the other is the full-text real-time conversion method. The full-text single conversion method refers to converting the format once all the response text content is received. If the full-text single conversion method is adopted, when the content of the response text is relatively long (for example, thousands of words), the user may have to wait for a long time to obtain the converted response text, and the user experience is not good. If the full-text real-time conversion method is adopted, as the length of the response text increases, it will cause a large amount of computing resources to be occupied, and its complexity is very high, which increases the system burden and may even cause a decrease in speed or even a freeze.

[0077] The embodiment of the present application converts the text in block-structured granularity to avoid the above problems, reduce complexity, and improve user experience. Taking the full-text real-time conversion method as an example, the analysis is as follows:

[0078] Assuming that the length of the response text to be processed is N, the existing full-text real-time conversion technology requires that each new character output must be format matched with the full text. The matching complexity can be expressed as:

[0079]

[0080] When N is large, its complexity is expressed as:

[0081]

[0082] It can be seen that the complexity of real-time conversion of full text increases exponentially.

[0083] The embodiment of the present application performs format conversion according to the granularity of the block structure. Assume that the length of the response text is N, which includes M blocks. The average length of each block is B = N / M. The length of B does not change with the length of N. Therefore, O(B 2 )≈O(1), then the total complexity of M blocks is That is to say, the format conversion method adopted in the embodiment of the present application reduces the complexity of format matching from O(N 2 ) is reduced to O(N), that is, from the power level to the linear level, which improves the efficiency of format conversion.

[0084] When the large language model deployed on the back end pushes the response text, long-distance transmission may be required, such as using a server-send event (SSE) to push the response text. Due to the complexity of the network environment, network fluctuations, data transmission interruptions or errors may occur. In this case, it may be necessary to wait for data, making it impossible for the user to browse the response text in real time. In another method embodiment five, when the complete block structure is not received, a temporary format conversion can be performed immediately, and the response text that has temporarily completed the format conversion can be presented to the user in real time.

[0085] like Figure 5 As shown, the temporary format conversion method of the fifth embodiment of the present application includes:

[0086] Step 501: Use the currently received response text content as the first part of the text content.

[0087] Step 502: Calculate the matching degree between the first portion of text content and the formatting mark in the formatting rule of the first document using a rule deviation function, and use the one with the smallest matching error as the first temporary formatting mark.

[0088] Step 503: Convert the format of the first portion of text content into a format corresponding to the first temporary format mark.

[0089] The above steps 501 to 503 are similar to step 403 in the fourth embodiment of the method, except that the embodiment of the present application does not receive a complete block structure, but only receives a portion of the response text content in the block structure. In this case, the embodiment of the present application does not continue to wait, but performs format conversion in advance using temporary format marks in real time. Among them, step 502 uses the rule deviation function to calculate the matching degree of the first part of the text content and the format mark in the format rule of the first document as follows:

[0090]

[0091] Among them, P i represents the first part of the text content, F represents the candidate format set, D rules (P i ,F) represents the matching degree between the first part of the text content and the candidate format mark. Match(P i ,r) represents the Boolean matching function, r represents the rule set R F When the regular expression r successfully matches P i , the result is True, otherwise the result is False. is the indicator function, when P i If the regular expression is not satisfied, the result is 1, otherwise the result is 0. r The weight of the regular expression r, which reflects the importance of the rule in matching.

[0092] After calculating the matching degree between the first portion of text content and the formatting mark in the formatting rule of the first document using the rule deviation function, the one with the smallest matching error is used as the first temporary formatting mark:

[0093]

[0094] in, is the first temporary format flag, Indicates the smallest matching error.

[0095] Step 504: embed the first portion of text content after format conversion into the first document edited by the user.

[0096] In an embodiment of the present application, when a complete block structure is not obtained, a more reasonable format flag can be selected in real time for conversion based on the minimization deviation function, and the converted first part of the text content can be embedded into the first document edited by the user, so that the user can browse the response text in real time, thereby improving the user experience.

[0097] The above method presents the response text of the temporary format conversion to the user in real time, but some format marks may be missing due to network fluctuations, data transmission interruption or errors. In this case, the sixth embodiment of the method of the present application can also fill in the missing format marks. Figure 6 As shown, the method embodiment 6 of the present application includes the following steps to fill in the missing format flags:

[0098] Step 601: Calculate the format integrity of the currently received response text content in real time using a format integrity measurement function.

[0099] In practical applications, the format integrity measurement function is expressed as:

[0100]

[0101] in, Indicates the degree of match between the first part of the text content and the first temporary format mark, w r is the weight of the regular expression r, represents the weight sum, which can usually be simplified to 1, Indicates the completeness of the first temporary format flag.

[0102] Step 602: If the completeness of the format of the response text content does not reach a preset completeness threshold, the format is completed according to the format rules of the first document and embedded into the first document edited by the user.

[0103] when The completeness is low and does not reach the preset completeness threshold, which means that the information of the current first part of the text content is incomplete and the first temporary format mark is missing. In this case, it can be supplemented according to the format rules of the first document. For example, the first part of the text content does not require a list item, but the corresponding first temporary format mark lacks spaces. In this case, the spaces can be supplemented to optimize the display effect to the user. In addition, the actively supplemented block structure can be marked as "non-final state" here, which is convenient for retrospective confirmation or correction after the subsequent data arrives.

[0104] Step 603: If the format completeness result of the response text content reaches the preset completeness threshold, the first part of the text content is used as the target text content, the first temporary format mark is used as the target format mark, and the block structure corresponding to the target text content is locked and not adjusted.

[0105] when If the completeness result reaches the preset completeness threshold, the information and formatting of the first portion of text content are complete, equivalent to receiving a complete block structure. The first portion of text content is the target text content, and the first temporary formatting flag is the target formatting flag. At this point, the received complete block structure can be locked. Locking means that the block structure will no longer be adjusted by subsequent data and will not be affected by subsequent data.

[0106] After the above-mentioned response text of the temporary format conversion is presented to the user in real time, subsequent response text content will continue to be received. Since the format conversion was previously temporarily completed based on part of the response text content, it may be found based on the subsequent response text content that the temporary format conversion has a large deviation or is even wrong. The large deviation or error in the temporary format conversion is due to the failure to fully receive the format mark due to network fluctuations, or due to data transmission interruption or error. In this case, the seventh embodiment of the method of the present application can also perform error correction.

[0107] like Figure 7 As shown, the seventh embodiment of the present invention implements the format flag to correct errors in the following manner:

[0108] Step 701: The first part of the text content and the subsequently received response text content are taken together as the second part of the text content.

[0109] In order to distinguish it from the first part of text content mentioned above, the newly received response text content and the previous first part of text content are collectively referred to as the second part of text content.

[0110] Step 702: Calculate the matching degree between the second portion of text content and the formatting mark in the formatting rule of the first document in real time using the rule deviation function, and use the one with the smallest matching error as the second temporary formatting mark.

[0111] This step is similar to step 502, except that this step matches the newly received second portion of text containing more data with the formatting mark in the formatting rules of the first document. The matching method is as follows:

[0112]

[0113] Among them, P i+1 Indicates the second part of the text content, F indicates the candidate format mark, D rules (P i+1 ,F) represents the matching degree between the second part of the text content and the candidate format mark. Match(P i+1 ,r) represents the Boolean matching function, r represents the rule set R F When the regular expression r successfully matches Pi+1 , the result is True, otherwise the result is False. is the indicator function, when P i+1 If the regular expression is not satisfied, the result is 1, otherwise the result is 0. r The weight of the regular expression r, which reflects the importance of the rule in matching.

[0114] After calculating the matching degree between the second part of the text content and the formatting mark in the formatting rules of the first document using the rule deviation function, the one with the smallest matching error is used as the second temporary formatting mark:

[0115]

[0116] in, is the second temporary format flag, Indicates the smallest matching error. If This indicates that as more data arrives, it is found that the deviation of determining the format flag as the first temporary format flag has become relatively large, while the deviation of the second temporary format flag is the smallest.

[0117] Step 703: convert the format of the second portion of text content according to the second temporary format mark, replace the first portion of text content, and embed it into the first document edited by the user.

[0118] Since the deviation of the second temporary formatting mark is minimal, error correction is required at this point, changing the original first temporary formatting mark to the second temporary formatting mark. Since the second portion of text content is now received, the second portion of text content should be formatted according to the second temporary formatting mark, thus replacing the first portion of text content and being embedded into the first document edited by the user. At this point, the user sees the response text with the modified formatting mark through the front-end browser.

[0119] It should be noted that if multiple block structures have been received before, only the format flags of the current block structure need to be converted, and there is no need to retroactively modify other block structures on a large scale. For example, the front end has received the P1 to P5 block structures of the response text, and has embedded them in the first document edited by the user according to the above method, and has been locked. At this time, for P6 that is being received, the format flag corresponding to the P6 part of the response text content needs to be converted from the first temporary format flag to the second temporary format flag. Then, only the P6 part needs to be updated, without involving the locked block structures P1 to P5, which greatly saves the cost of retroactive modification and improves the efficiency of format conversion.

[0120] In addition, the embodiment of the present application can continue to use the format integrity measurement function to calculate the integrity of the format of the currently received response text content in real time. If the integrity of the format of the response text content does not reach the preset integrity threshold, the format is completed according to the format rules of the first document and embedded in the first document edited by the user. If the integrity result of the format of the response text content is complete, the second part of the text content is used as the target text content, the second temporary format flag is used as the target format flag, and the block structure corresponding to the locked target text content is not adjusted.

[0121] Method embodiment 4 of the present application provides a way to perform format conversion normally, method embodiment 5 provides a way to perform temporary format conversion, method embodiment 6 provides a way to fill in missing format flags, and method embodiment 7 provides a way to correct format flags. In actual applications, these methods may be implemented repeatedly and staggered according to actual conditions, and are not independent of each other. For example, when receiving a response text of a long text, the temporary format conversion of method embodiment 5 is used for the current block structure P6 to convert part of its text into a format according to the first temporary format flag, and the format flag is filled in accordance with method embodiment 6; after continuing to receive data, format flag error correction is performed using method embodiment 7; after continuing to receive data, format flag error correction is performed again using method embodiment 7. In short, when temporary format conversion is needed, when format flag filling is needed, when format flag error correction is needed, and when to determine the completeness of the received format can be handled flexibly according to actual conditions, and there is no strict order.

[0122] In order to better illustrate the embodiment scheme of the present application, a specific method embodiment eight is listed below for detailed description. In method embodiment eight, it is assumed that there is an office system for scientific research engineering, and the front-end and back-end carrying the system are deployed in the cloud, and the front-end and back-end are connected via Hypertext Transfer Protocol (HTTP) and WebSocket full-duplex communication protocol. The system provides users with a software as a service (SaaS) business. Users access the office system through a browser and are allowed to edit work records in the browser page during the office process. Work records can be shared online with other work partners to browse, edit or change, and are also commonly referred to as "collaborative notes."

[0123] If the user needs the writing assistant to provide more resources during the collaborative note editing process, the method of the embodiment of the present application can be used to achieve this. The embodiment of the present application assumes that the user is editing a document introducing a scientific research experiment on a web page of the system browser, and initiates a writing assistant request during the process. The document that the user is editing is the first document, and the writing assistant request is "Please help me generate a data analysis report, including the experimental environment, formulas, relevant Python code examples and experimental results". The writing assistant request here can be regarded as a natural language query. Figure 8 As shown, the processing process of the embodiment of the present application includes:

[0124] Step 801: Initiate a writing assistant request in the first document edited by the user, where the writing assistant request is "Please help me generate a data analysis report, including the experimental environment, formulas, relevant Python code examples and experimental results."

[0125] As mentioned above, the first document is a document displayed based on the front-end, and is organized according to a block structure. Different block structures correspond to different block flags, and the block flag is a format flag that complies with the format rules of the first document. The block described in the embodiment of the present application generally refers to a document element, such as a title, paragraph, ordered list, unordered list, etc., and the block flag is an identifier of the block structure, such as a dash, space, etc. The block flag can be understood as a format requirement similar to Markdown, but the actual application can be formulated according to its own needs and must be completely consistent with Markdown.

[0126] Step 802: Identify the user intention according to the writing assistant request, and retrieve any one or any combination of existing knowledge bases, network search resources, and large language models according to the writing assistant request to obtain request optimization information.

[0127] In practical applications, natural language parsing methods can be used to process the query, perform semantic understanding and intent extraction, and determine that the user's intention is to "generate a data analysis report." Its core elements include: 1) Title: Data Analysis Report; 2) Experimental Environment; 3) Related Experimental Formulas; 4) Code Functions; 5) Specific Experimental Results.

[0128] Based on natural language understanding, the system determines that the user's intention is to generate a data analysis report that includes the experimental environment, formulas, code examples, and experimental results. However, the current information is not enough to directly complete the response, and further supplementation and optimization are needed. For example, the experimental environment details need to be supplemented, such as clarifying the Python version or Pandas version used in the experiment; the data model details need to be supplemented to clarify the specific mathematical model types involved in the report, such as linear regression and the LaTeX expression of specific formulas; Python code examples need to be supplemented to clarify the Python code related to data reading and modeling in the document, and ensure that the code syntax is correct and meets the code block requirements of the first document; the experimental result data needs to be supplemented to extract key experimental results, such as R 2 Values, RMSE values, etc., so as to facilitate subsequent conversion into a table similar to Markdown format.

[0129] The information that needs to be supplemented and optimized can be obtained from any one or any combination of the backend knowledge base, network search resources, and large language models. The knowledge base includes personal knowledge base, organizational knowledge base, and public knowledge base.

[0130] Step 803: Integrate the user intention and the request optimization information, generate prompt words according to the integrated writing assistant request, and input the integrated writing assistant request and prompt words into the back-end large language model.

[0131] In actual applications, based on the optimized user intent, a writing assistant request with prompt words can be generated, such as: Please provide the experimental environment (such as Python version, Pandas version), model formula (such as linear regression formula), Python code (such as data reading and model fitting code) and experimental result data (such as R) provided in the user document. 2 value and RMSE value), and generate a structured Markdown format data analysis report.

[0132] The above user intention is more detailed and clear, and comes with accurate prompt words, which facilitates the subsequent large language model to respond accurately.

[0133] Step 804: The large language model deployed on the backend generates a response text based on the writing assistant request and the prompt word, and returns the response text to the frontend. The large language model knows the formatting rules of the first document in advance, and the response text contains formatting marks.

[0134] In this embodiment, it is assumed that the content of a document in the knowledge base includes:

[0135] Experimental purpose: Use linear regression model to predict house prices

[0136] Environment: Python 3.10, Pandas 2.1, scikit-learn 1.4

[0137] Dataset: Simple structured CSV data containing house area (x) and price (y)

[0138] Model: linear regression, the fitting formula is

[0139] $$

[0140] y=\beta_0+\beta_1x+\epsilon

[0141] $$

[0142] Model results: R 2 =0.85, RMSE=2.13

[0143] Supplementary records: No missing values have been verified; variables such as house age may be added later

[0144] Experiment code:

[0145]

[0146] Then, based on the user's intent, the large language model might recall the content and generate the following response text:

[0147] #Data Analysis Report

[0148] ##Experimental data summary

[0149] 1. Experimental Environment

[0150] -Python 3.10

[0151] -Pandas 2.0

[0152] -scikit-learn 1.4

[0153] 2. Mathematical Model

[0154] -This experiment uses a linear regression model, which is expressed as:

[0155] $$

[0156] y=\beta_0+\beta_1x+\epsilon

[0157] $$

[0158] 3. Code Examples

[0159] ```Python

[0160] import pandas as pd

[0161] from sklearn.linear_model import LinearRegression

[0162] from sklearn.metrics import r2_score,mean_squared_error

[0163] data=pd.read_csv("housing.csv")

[0164] model = LinearRegression()

[0165] model.fit(data[['area']],data['price'])

[0166] preds=model.predict(data[['area']])

[0167] print("R 2 :",r2_score(data['price'],preds))

[0168] print("RMSE:",mean_squared_error(data['price'],preds,squared=False))

[0169] ```

[0170] 4. Experimental Results

[0171] |Serial number|Parameter|Value|

[0172] |---|---|---|

[0173] |1|R 2 |0.85|

[0174] |2|RMSE|2.13|

[0175] Step 805: The front end performs format conversion in the process of receiving the response text, determines the response text content and the corresponding format mark, uses the determined response text content as the target text content, uses the corresponding format mark as the target format mark, converts the format of the target text content into the format corresponding to the target format mark, and embeds the target text content after format conversion as a block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

[0176] In this step, the embodiment of the present application can utilize the above-mentioned method embodiments 4 to 7 to perform format conversion so that the response text received by the front end is consistent in format with the document being edited by the user.

[0177] Specifically, under normal circumstances, this step can perform format conversion in the manner of method embodiment 4, that is: the back-end large language model streams the response text, and the front-end converts the format one by one according to the block structure and embeds it into the first document edited by the user.

[0178] If the response text is relatively long, and there are network fluctuations, data transmission interruptions or errors, and the complete block structure is not received, a temporary format conversion is performed in accordance with the method embodiment five, and part of the response text is converted according to the first temporary format mark and embedded in the first document edited by the user.

[0179] If some format flags are missing due to network fluctuations, data transmission interruption or errors, the missing format flags are supplemented in accordance with the method of the sixth embodiment of the method.

[0180] Example 1: If the code block in the response text only contains the first half of the markup:

[0181] ```Python

[0182] code

[0183] Then, the sixth step 602 of the method embodiment can be used to complete the gap:

[0184] ```Python

[0185] code

[0186] ```

[0187] For example 2, if the code is nested, it can also be accurately judged and analyzed, such as:

[0188] ```Python

[0189] code_part_1

[0190] ```Python

[0191] code_part_2

[0192] ```

[0193] code_part_3

[0194] Similarly, the sixth embodiment of the method can be used to complete the step 602:

[0195] ```Python

[0196] code_part_1

[0197] ```json

[0198] code_part_2

[0199] ```

[0200] code_part_3

[0201] ```

[0202] If the format conversion has a large deviation or is erroneous due to network fluctuations, data transmission interruption or errors, error correction is performed in accordance with the seventh method embodiment.

[0203] Example 3: If the table is not correctly recognized during the format conversion process:

[0204] |Serial number|Parameter|Value|

[0205] Since there is no Markdown formatted split line here, it will be recognized as normal text format instead of a table. Even if the split line is received later, cells may be lost because it is not recognized as a table:

[0206] |Serial number|Parameter|Value|

[0207] |---|---|---|

[0208] |1|R 2

[0209] In this case, error correction is performed using the method of embodiment 7. After error correction, the cells can be filled in to return to a normal table format:

[0210] |Serial number|Parameter|Value|

[0211] |---|---|---|

[0212] |1|R 2 ||

[0213] By applying the solution of the embodiment of the method of the present application, since the large language model knows the format rules of the first document edited by the user in advance, the output response text contains format marks and can be automatically converted to a suitable format to connect with the text edited by the user, thereby improving the user experience. During the format conversion, the conversion is performed according to the block structure without the need for full-text backtracking, which greatly speeds up the conversion efficiency. In addition, the embodiment of the present application can also fill in the missing formats and correct the wrong formats according to the actual situation, which can greatly improve the accuracy of the format conversion and ensure the smoothness and accuracy of the user in the process of editing the document.

[0214] Based on the above method, this application also provides an implementation device of an intelligent writing assistant. Figure 9 As shown, the device includes: a user interaction module 901, a response module 902, and a format conversion module 903. Among them:

[0215] The user interaction module 901 is used to initiate a writing assistant request in the first document edited by the user. The first document is a document displayed based on the front end. The first document is organized according to a block structure. Different block structures correspond to different block flags. The block flag is a format flag that complies with the format rules of the first document.

[0216] The response module 902 is used for the large language model deployed on the back end to generate a response text according to the writing assistant request and return the response text to the front end. The large language model knows the format rules of the first document in advance, and the response text contains format marks.

[0217] The format conversion module 903 is used for the front end to perform format conversion in the process of receiving the response text, determine the response text content and the corresponding format mark, use the determined response text content as the target text content, use the corresponding format mark as the target format mark, convert the format of the target text content into the format corresponding to the target format mark, and embed the target text content after format conversion as a block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

[0218] That is to say, when the user is editing the first document, if he needs writing help, he will initiate a writing assistant request, and the first document is based on the document displayed on the front end; the response module 902 generates a response text based on the writing assistant request by the large language model deployed on the back end, and returns the response text to the front end; the format conversion module 903 performs format conversion in the process of receiving the response text, determines the response text content and the corresponding format mark, uses the determined response text content as the target text content, uses the corresponding format mark as the target format mark, converts the format of the target text content into the format corresponding to the target format mark, and embeds the target text content after format conversion as a block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

[0219] By applying the solution of the first embodiment of the device of the present application, the response text output by the large language model can be automatically converted into a suitable format and connected with the text edited by the user. The user does not need to spend extra time to make adjustments, thereby better improving the user experience.

[0220] like Figure 10As shown, in another preferred embodiment, the second embodiment of the intelligent writing assistant implementation device may further include: an intention recognition and optimization module 904, a prompt word generation module 905, and a knowledge base and retrieval module 906, wherein:

[0221] The intention recognition and optimization module 904 is used to recognize the user intention according to the writing assistant request, and retrieve any one or any combination of the existing knowledge base, network search resources and the large language model according to the writing assistant request to obtain request optimization information.

[0222] The prompt word generation module 905 is used to integrate the user intention and request optimization information as an integrated writing assistant request, generate prompt words based on the integrated writing assistant request, and input the integrated writing assistant request and prompt words into the back-end large language model.

[0223] The knowledge base and retrieval module 906 is used to provide retrieval to the intent recognition and optimization module 904, including any one or any combination of existing knowledge bases, network search resources and the large language model. Among them, the knowledge base can be divided into three levels of knowledge bases according to the scope of authority: personal knowledge base, organizational knowledge base and public knowledge base. Among them, the personal knowledge base can only be accessed privately by the user, and saves the information most relevant to the user, such as the document content uploaded by the user in advance, and the document content that the user edited using the system front end and accumulated over time; the organizational knowledge base provides information related to the organization and is accessed by users who are members of the organization; the public knowledge base provides public knowledge and is accessible to all users in the system.

[0224] In actual applications, users can also upload documents using the user interaction module 901, which will be parsed and saved by the knowledge base and retrieval module 906. There are no restrictions on the format of the uploaded documents, and users can upload PDF documents, Word documents, etc. Generally speaking, documents uploaded by users are often content that users use frequently. They can be saved in a personal knowledge base or saved separately, and can be provided to the intent recognition and optimization module 904 for retrieval, thereby better identifying user intent.

[0225] In another preferred embodiment, the format conversion module 903 can further provide a normal format conversion method according to method embodiment 4, provide a temporary format conversion method according to method embodiment 5, provide a missing format flag filling method according to method embodiment 6, and provide a format flag error correction method according to method embodiment 7.

[0226] The present application also provides a computer-readable medium, which stores instructions, and when the instructions are executed by a processor, the steps in the implementation method of the intelligent writing assistant described above can be executed. In practical applications, the computer-readable medium can be included in the device / apparatus / system described in the above embodiments, or it can exist independently without being assembled into the device / apparatus / system. The above-mentioned computer-readable storage medium carries one or more programs, and when the above-mentioned one or more programs are executed, the implementation method of the intelligent writing assistant described in the above embodiments can be implemented. According to the embodiments disclosed in the present application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, for example, it can include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above, but is not used to limit the scope of protection of this application. In the embodiments disclosed in the present application, the computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, device or device.

[0227] An embodiment of the present application further provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, the method described in any of the above embodiments is implemented.

[0228] The flowcharts and block diagrams in the accompanying drawings of the present application show the possible implementation architecture, functions and operations of the systems, methods and computer program products according to the various embodiments disclosed in the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in the order of the standards in different figures. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0229] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims of this disclosure may be combined and / or coupled in various ways, even if such combinations and / or couplings are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments and / or claims of this application may be combined and / or coupled in various ways, and all such combinations and / or couplings fall within the scope of this application.

[0230] The principles and implementation methods of the present invention are described herein using specific embodiments. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas, and is not intended to limit this application. For those skilled in the art, changes can be made in the specific implementation methods and application scope based on the ideas, spirit and principles of the present invention. Any modifications, equivalent replacements, improvements, etc. made therein should be included within the scope of protection of this application.

Claims

1. A method for implementing an intelligent writing assistant, characterized in that: The method includes: Initiating a writing assistant request in a first document edited by a user, where the first document is a document displayed based on a front-end and is organized according to a block structure. Different block structures correspond to different block flags, and the block flags are formatting flags that comply with formatting rules of the first document. The large language model deployed on the backend generates a response text according to the writing assistant request and returns the response text to the frontend. The large language model is aware of the formatting rules of the first document in advance, and the response text includes the formatting mark. The front end performs format conversion in the process of receiving the response text, determines the response text content and the corresponding format mark, uses the determined response text content as the target text content, uses the corresponding format mark as the target format mark, converts the format of the target text content into the format corresponding to the target format mark, and embeds the target text content after format conversion as the block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

2. The method according to claim 1, characterized in that Between the step of initiating a writing assistant request in the first document edited by the user and the step of generating a response text according to the writing assistant request by the large language model deployed on the backend, the method further includes: identifying user intent based on the writing assistant request; According to the writing assistant request, any one or any combination of an existing knowledge base, a network search resource, and the large language model is retrieved to obtain request optimization information.

3. The method according to claim 2, characterized in that Between the step of obtaining the request optimization information and the step of generating a response text according to the writing assistant request by the large language model deployed on the back end, the method further includes: Integrating the user intention and the request optimization information as the integrated writing assistant request; generating prompt words according to the integrated writing assistant request; The integrated writing assistant request and the prompt word are input into the large language model of the backend.

4. The method according to any one of claims 1 to 3, characterized in that The front end performs format conversion in the process of receiving the response text, determines the response text content and the corresponding format mark, uses the determined response text content as the target text content, uses the corresponding format mark as the target format mark, converts the format of the target text content into a format corresponding to the target format mark, and embeds the converted target text content as the block structure into the first document edited by the user. The steps include: Determine whether the response text has been processed. If so, terminate the step of format conversion performed by the front end in the process of receiving the response text. Otherwise, continue to execute subsequent steps. Determine whether one of the block structures has been processed, and if so, return to the step of determining whether the response text has been processed, otherwise continue to execute subsequent steps; Determine the response text content and the corresponding format mark, use the determined response text content as the target text content, and use the corresponding format mark as the target format mark; Converting the target text content into a format corresponding to the target format flag; embedding the target text content after format conversion as the block structure into the first document edited by the user; Return to the step of determining whether the response text has been processed.

5. The method according to claim 4, characterized in that The steps of determining the response text content and the corresponding format mark, using the determined response text content as the target text content, and using the corresponding format mark as the target format mark include: Using the currently received response text content as the determined response text content; Calculating the degree of match between the response text content and the formatting mark in the formatting rule of the first document using a rule deviation function; The one with the smallest matching error is used as the target format mark.

6. The method according to claim 4, characterized in that The step of performing format conversion in the process of receiving the response text by the front end further includes: Using the currently received response text content as the first part of text content; Calculating the matching degree between the first portion of text content and the formatting mark in the formatting rule of the first document using the rule deviation function, and taking the one with the smallest matching error as the first temporary formatting mark; Converting the format of the first part of text content into a format corresponding to the first temporary format mark; The first portion of text content after the format conversion is embedded into the first document edited by the user.

7. The method according to claim 6, characterized in that After the step of embedding the first portion of text content after format conversion into the first document edited by the user, the method further includes: Calculating the completeness of the format of the currently received response text content in real time using a format completeness measurement function; If the completeness of the format of the response text content does not reach the preset completeness threshold, completing the format according to the format rules of the first document and embedding it into the first document edited by the user; If the format completeness result of the response text content reaches a preset completeness threshold, the first part of the text content is used as the target text content, the first temporary format mark is used as the target format mark, and the block structure corresponding to the target text content is locked and not adjusted.

8. The method according to claim 6, characterized in that After the step of embedding the first portion of text content after format conversion into the first document edited by the user, the method further includes: taking the first part of text content and the subsequently received response text content as the second part of text content; Calculating the matching degree of the second portion of text content and the formatting mark in the formatting rule of the first document in real time using the rule deviation function, and taking the one with the smallest matching error as the second temporary formatting mark; The format of the second portion of text content is converted according to the second temporary format mark, and the first portion of text content is replaced and embedded into the first document edited by the user.

9. An implementation device of an intelligent writing assistant, characterized in that: The device includes: a user interaction module, configured to initiate a writing assistance request in a first document being edited by a user, wherein the first document is a document displayed based on a front-end, the first document being organized according to a block structure, different block structures corresponding to different block flags, and the block flags being format flags that comply with formatting rules of the first document; a response module, configured to generate a response text based on the writing assistant request using a large language model deployed on the backend, and return the response text to the frontend, wherein the large language model is previously aware of the formatting rules of the first document, and the response text includes the formatting mark; A format conversion module is used for the front end to perform format conversion in the process of receiving the response text, determine the response text content and the corresponding format mark, use the determined response text content as the target text content, use the corresponding format mark as the target format mark, convert the format of the target text content into the format corresponding to the target format mark, and embed the target text content after format conversion as the block structure into the first document edited by the user, so that the response text and the first document edited by the user are seamlessly connected based on a unified format.

10. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instructions are executed by a processor, the steps of the method for implementing an intelligent writing assistant according to any one of claims 1 to 8 can be implemented.

11. A computer program product, comprising computer instructions, wherein when executed by a processor, the computer instructions implement the method for implementing the intelligent writing assistant according to any one of claims 1 to 8.