Data processing method and apparatus
The method and apparatus enable direct content generation from a target string input in an editing page, reducing user operations and enhancing experience by integrating AI model output within the editing environment.
Patent Information
- Application Number
- US19/689777
- Authority / Receiving Office
- US · United States
- Patent Type
- Applications(United States)
- Current Assignee / Owner
- Priority Date
- 2025-05-29
- Filing Date
- 2026-05-27
- Publication Date
- 2026-12-03
AI Technical Summary
Users face complexity in operations when switching between different interfaces for information acquisition and content editing using generative AI models, such as needing to switch between applications for content generation and pasting the generated content back into the document.
A data processing method and apparatus that allows parsing a target string input in an editing page of a target application, determining if it matches a trigger string, generating first content based on the string, providing it to a target model independent from the application, and outputting the generated second content directly in the editing page without requiring user switching or copying/pasting.
Reduces user operation complexity by allowing direct generation and output of content within the editing page, improving user experience by eliminating the need for switching between applications and manual content transfer.
Smart Images

Figure US20260387464A1-D00000_ABST
Abstract
Description
CROSS-REFERENCE TO RELATED APPLICATION
[0001] This application claims priority to Chinese Patent Application No. CN120540769A, filed on May 29, 2025, the entire content of which is incorporated herein by reference.TECHNICAL FIELD
[0002] The present disclosure relates to the technical field of data processing, and in particular, to a data processing method and apparatus.BACKGROUND
[0003] Currently, when using a generative AI (Artificial Intelligence) model, a user often needs to switch between different interfaces to complete information acquisition and content editing operations.
[0004] For example, during a process of editing a document by using Office software, a user needs to switch to the AI model to generate content, and after copying the content, switch back to the Office software to copy and paste the content into the document.
[0005] Therefore, when using the AI model, user operations are complex.SUMMARY
[0006] In view of this, the present disclosure provides a data processing method and apparatus, as follows:
[0007] One aspect of the present disclosure provides a data processing method, including parsing a target string in response to the target string being input in an editing page of a target application; obtaining first content according to the target string in a case where the target string is determined to match a trigger string based on a parsing result of the target string, wherein the first content at least comprises a first prompt generated based on the target string; providing the first content to a target model, to receive second content generated by the target model according to the first content, wherein the target application and the target model are independent from each other; and outputting the second content in the editing page of the target application.
[0008] Another aspect of the present disclosure provides a data processing apparatus, including: a target application, configured to provide an editing page; a target model, configured to generate content; and an input service, configured to in response to a target string being input in the editing page, parse the target string, and based on a parsing result of the target string, in a case where the target string is determined to match a trigger string, obtain first content according to the target string, wherein the first content at least comprises a first prompt generated based on the target string; provide the first content to the target model, to receive second content generated by the target model according to the first content; and transmit the second content to the target application, such that the target application outputs the second content in the editing page.
[0009] Another aspect of the present disclosure provides a computer readable storage medium. The computer storage medium stores one or more computer programs, when executed by one or more processors, the one or more computer programs implementing the data processing method as described above.
[0010] It can be seen from the above technical solutions that, in the data processing method and apparatus disclosed in the present disclosure, the target string can be directly parsed in response to the target string being input in the target application, such that based on a parsing result of the target string, in a case where the target string is determined to match a trigger string, first content including a first prompt generated based on the target string is obtained according to the target string, whereby after the first content is provided to the target model that is independent from each other from the target application, second content generated by the target
[0011] model according to the first content can be received, and the second content is then output in the editing page. It can be seen that, in the present disclosure, after a user inputs the target string in the editing page of the target application, the user can view the second content generated by the target model in the editing page, without needing to switch from the editing page of the target application to an input page of the target model, and without needing to switch from an output page of the target model back to the editing page of the target application after the target model generates the second content, and furthermore without needing operations such as copying and pasting the second content. As such, during a process of using the target model, the number of user operations can be reduced, user operation complexity can be lowered, and the user experience of using the target model can be improved.BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the accompanying drawings required for use in descriptions of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following descriptions are merely some embodiments of the present disclosure, and a person of ordinary skill in the art may further obtain other accompanying drawings according to these accompanying drawings without creative efforts.
[0013] FIG. 1 is a flowchart of a data processing method provided in an embodiment of the present disclosure;
[0014] FIG. 2 is a diagram of invoking a target model to generate poetic sentences in a target application in an embodiment of the present disclosure;
[0015] FIG. 3 is a diagram of a service component interacting between a target application and a target model in an embodiment of the present disclosure;
[0016] FIG. 4 is a diagram of an input service interacting with an Office application and a generative AI model in an embodiment of the present disclosure;
[0017] FIG. 5 is a partial flowchart of a data processing method provided in an embodiment of the present disclosure;
[0018] FIG. 6 is a diagram of a user interrupting output of second content in an embodiment of the present disclosure;
[0019] FIG. 7 is a schematic structural diagram of a data processing apparatus provided in an embodiment of the present disclosure;
[0020] FIG. 8 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure;
[0021] FIG. 9 is a diagram of implementing an intelligent generative AI input assistance function in a notebook computer to which the present disclosure is applicable.DETAILED DESCRIPTION OF THE EMBODIMENTS
[0022] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are merely a part of the embodiments of the present disclosure, rather than all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts fall within the scope of the present disclosure.
[0023] Referring to FIG. 1, FIG. 1 is an implementation flowchart of a data processing method provided in an embodiment of the present disclosure. The method may be applicable to an electronic device capable of running a target application and capable of invoking a target model, such as a mobile phone, a notebook computer, a tablet device, or the like. The technical solutions in the present embodiment are mainly used to reduce user operation complexity and improve user experience of using the target model.
[0024] Specifically, the method in the present embodiment may include the following operations:
[0025] Operation 101: In response to a target string being input in an editing page of a target application, parsing the target string.
[0026] Where the editing page refers to a page providing an input function in the target application, such as a text input page of an office application, an input box of a chat application, or the like.
[0027] For example, as shown in FIG. 2, taking the target application being an Office application as an example, in the text input page, a user may perform character input through an input device such as a keyboard, thereby outputting a target string input by the user in the text input page, such as “#Write a poem about scenery, 200 words#”. Based on this, character parsing is performed on the target string in the present embodiment.
[0028] Specifically, in the present embodiment, each character included in the target string and character attributes of each character, such as language type, character semantics, and the like, may be parsed.
[0029] Operation 102: Based on a parsing result of the target string, determining whether the target string matches a trigger string. When, based on the parsing result of the target string, the target string is determined to match the trigger string, operation 103 is executed. If the target string is determined not to match the trigger string, no other processing is performed.
[0030] Where the target string matching the trigger string may be that the target string at least includes the trigger string. Based on this, in the present embodiment, operation 103 is executed in a case where the obtained parsing result represents that the target string at least includes the trigger string.
[0031] Operation 103: Obtaining first content based on the target string.
[0032] Where the first content at least includes a first prompt generated based on the target string.
[0033] For example, based on the target string “#Write a poem about scenery, 200 words#”, a first prompt “A poem about scenery within 200 words” is generated. Based on this, first content is obtained according to the first prompt.
[0034] Operation 104: Providing first content to the target model, to receive second content generated by the target model based on the first content.
[0035] Where the target application and the target model are independent from each other. That is, the target application and the target model are respectively independent application programs, and a user may separately use the target application and the target model. For example, the user may perform an input operation in the editing page of the target application, or perform an input operation in an input page of the target model. In the present embodiment, information interaction between the target application and the target model may be established through a service component in an operating system, as shown in FIG. 3, thereby obtaining the target string from the target application through the service component without switching to the input page of the target model, and invoking the target model, such that the target model generates second content according to the received first content, and the service component then returns the second content to the target application, as shown in FIG. 2.
[0036] In one embodiment, the target model may be a generative AI model based on machine learning, such as an AI model for generating text or an AI model for generating images, or the like.
[0037] Operation 105: Outputting the second content in the editing page of the target application.
[0038] For example, as shown in FIG. 2, the second content is output after the target string, such as a poem titled “Uniquely Beautiful Scene”.
[0039] It can be seen from the above technical solutions that, in the data processing method and apparatus disclosed in the present disclosure, the target string can be directly parsed in response to the target string being input in the target application, such that based on a parsing result of the target string, in a case where the target string is determined to match a trigger string, first content including a first prompt generated based on the target string is obtained according to the target string, whereby after the first content is provided to the target model that is independent from each other from the target application, second content generated by the target model according to the first content can be received, and the second content is then output in the editing page. It can be seen that, in the present disclosure, after a user inputs the target string in the editing page of the target application, the user can view the second content generated by the target model in the editing page, without needing to switch from the editing page of the target application to an input page of the target model, and without needing to switch from an output page of the target model back to the editing page of the target application after the target model generates the second content, and furthermore without needing operations such as copying and pasting the second content, whereby during a process of using the target model, the number of user operations can be reduced, user operation complexity can be lowered, and the user experience of using the target model can be improved.
[0040] In one embodiment, a service component deployed in the operating system at least includes an input service, and the input service is configured to present the target string in the editing page in response to an input operation on the editing page. For example, in a text input page of an office application, a user taps a keyboard, an input method application is invoked, an initial string tapped by the user is output in an input method interface and identified as the target string, and the input service in the operating system presents the target string in the text input page.
[0041] Based on this, in the present embodiment, after the target string is output in the text input page, the target string is obtained and parsed through the input service, and then based on a parsing result of the target string, in a case where the target string is determined to match the trigger string, first content is obtained according to the target string and the first content is provided to the target model. Thereafter, after the input service receives the second content generated by the target model, the input service sends the second content to the target application, whereby the second content is output in the editing page of the target application.
[0042] For example, as shown in FIG. 4, the input service parses the target string “#Write a poem about scenery, 200 words#” input in the text input page of the office application, and based on a parsing result of the target string, in a case where the target string is determined to match the trigger string, generates first content “A poem about scenery within 200 words” according to the target string, and then provides the first content to the generative AI model. The generative AI model generates second content according to the first content, that is, a poem titled “Uniquely Beautiful Scene”. Based on this, the input service receives the poem generated by the generative AI model and sends the poem to the text input page of the Office application for output.
[0043] Based on the embodiment shown in FIG. 1, when operation 102 determines that the target string matches the trigger string, the operation may specifically include:
[0044] Identifying that the target string includes a first string and a second string, where the first string precedes the second string in the target string, and at least one intermediate character exists between the first string and the second string.
[0045] Where the trigger string is a string combination composed of the first string and the second string. For example, the first string is “#”, and the second string is “#”. Based on this, in the present embodiment, character recognition is performed starting from a starting character of the target string “#Write a poem about scenery, 200 words#”, to identify whether the characters included in the target string include the first string and the second string. After the first string such as “#” is identified, backward recognition continues until the second string such as “#” is identified. Based on this, it is determined that the target string matches the trigger string, and an intermediate character between the first string and the second string such as “Write a poem about scenery, 200 words” is extracted. Based on this, after first content is obtained according to the target string, the target model generates second content for the intermediate character according to the first prompt.
[0046] Based on the embodiment shown in FIG. 1, in another implementation, when operation 102 determines that the target string matches the trigger string, the operation may specifically include:
[0047] Identifying that the target string includes a third string, where at least one intermediate character exists after the third string in the target string.
[0048] Where the third string is a starting identifier string representing a string corresponding to the first prompt. For example, the third string is “%%”. Based on this, in the present embodiment, character recognition is performed starting from a starting character of the target string “%%Write a poem about scenery, 200 words”, to identify whether the characters included in the target string include the third string. After the third string such as “%%” is identified, backward recognition continues, to identify an intermediate character after the third string such as “Write a poem about scenery, 200 words”. Based on this, it is determined that the target string matches the trigger string, and the intermediate character after the third string such as “Write a poem about scenery, 200 words” is extracted.
[0049] It should be noted that, in the present embodiment, after the third string in the target string is identified, a string of a line in which the third string is located may first be extracted, and then characters from the third string to an ending character in the string of the line in which the third string is located (where a newline character is a boundary character of the line) are all extracted as the intermediate character, such that after first content is obtained according to the target string, the target model generates second content for the intermediate character according to the first prompt.
[0050] Based on the embodiment shown in FIG. 1, in another implementation, when operation 102 determines that the target string matches the trigger string, the operation may specifically include:
[0051] Identifying that the target string includes a fourth string, where at least one intermediate character exists before the fourth string in the target string.
[0052] Where the fourth string is an ending identifier string representing a string corresponding to the first prompt. For example, the fourth string is “&&&”. Based on this, in the present embodiment, character recognition is performed starting from a starting character of the target string “Write a poem about scenery, 200 words&&&”, to identify whether the characters included in the target string include the fourth string. After the fourth string such as “&&&” is identified, the intermediate character before the fourth string such as “Write a poem about scenery, 200 words” is determined. Based on this, it is determined that the target string matches the trigger string, and the intermediate character before the fourth string such as “Write a poem about scenery, 200 words” is extracted.
[0053] It should be noted that, in the present embodiment, after the fourth string in the target string is identified, a string of a line in which the fourth string is located may first be extracted, and then characters from a starting character to a character before the fourth string in the string of the line in which the fourth string is located are all extracted as the intermediate character, such that after first content is obtained according to the target string, the target model generates second content for the intermediate character according to the first prompt.
[0054] In one embodiment, the first content obtained in operation 103 further includes: a second prompt. Based on this, the target model generates second content for the intermediate character according to the first prompt and the second prompt.
[0055] Where the second prompt includes context information of the target application. The context information is associated with the intermediate character extracted from the target string. The intermediate character is extracted from the target string based on the trigger string. The intermediate character may include one or more characters. The context information may include at least one type of information, such as a text type, an image type, an audio type, or the like. The context information may represent content of at least one attribute, such as an application type of the target application, a language type of output content of the target application, a tone style of output content of the target application, a content form of output content of the target application, a content quantity of output content of the target application, content output before and after the target string in the editing page of the target application such as text and images, output rules of the editing page of the target application, and other information content.
[0056] Based on the above implementation, an accessibility service is further deployed in the operating system in which the target application is located. The accessibility service is configured to obtain context information associated with the intermediate character in the target application and provide the context information to the input service. The input service generates the second prompt based on the context information, then combines the second prompt with the first prompt into first content and sends the first content to the target model. The target model generates second content for the intermediate character extracted according to the trigger string based on the first prompt and the second prompt.
[0057] For example, after the input service obtains the target string from the office application, based on the target string “#Write a poem about scenery, 200 words#”, the trigger strings “#” and “#” are matched, and the intermediate character “Write a poem about scenery, 200 words” is extracted from the target string. A first prompt “A poem about scenery within 200 words” is generated based on the intermediate character. At the same time, context information associated with the intermediate character in the office application, such as an application type, text and images in the page, and the like, is obtained through accessibility, and a second prompt “poetry format, Chinese, lyrical style” is generated based on the context information associated with the intermediate character. Finally, the first prompt and the second prompt are sent to the target model, and the target model generates second content for the intermediate character “Write a poem about scenery, 200 words” according to the first prompt “A poem about scenery within 200 words” and the second prompt “poetry format, Chinese, lyrical style”, such as a poem titled “Uniquely Beautiful Scene”.
[0058] For example, after the input service obtains the target string from the chat application, based on the target string “#Give a rap complaining about corporate drones#”, the trigger strings “#” and “#” are matched, and the intermediate character “Give a rap complaining about corporate drones” is extracted from the target string. A first prompt “text complaining about exhausting work” is generated based on the intermediate character. At the same time, context information associated with the intermediate character in the chat application, such as an application type, text and images in the page, and the like, is obtained through accessibility, and a second prompt “within 400 characters, Chinese, rhyming” is generated based on the context information associated with the intermediate character. Finally, the first prompt and the second prompt are sent to the target model, and the target model generates second content for the intermediate character according to the first prompt and the second prompt, such as a 400-character rhyming text complaining about exhausting work.
[0059] Further, in the present embodiment, when the second content is output in the editing page of the target application, the input service may output the second content in the editing page based on context information of the target application.
[0060] Where the context information of the target application can represent information such as an output position, an output style (such as a layout manner), an output type (such as text, an image, or voice), and an output format (such as a font format and a font size) of content in the editing page. Based on this, the input service sends the second content generated by the target model to the editing page of the target application, and outputs the second content in the editing page according to the output position, output style, output type, output format, and the like of the content represented by the context information.
[0061] Taking the target application being an Office application as an example, in the present embodiment, the second content is output according to an existing font format and font size in the editing page of the office application. As another example, in the present embodiment, the second content is output at a last position of the target string in the editing page of the office application.
[0062] Based on the embodiment shown in FIG. 1, in one embodiment, when first content is provided to the target model in operation 104, the operation may be implemented in the following manner, as shown in FIG. 5:
[0063] Operation 501: Detecting whether an electronic device on which the editing page is located is connected to the Internet. In a case where the electronic device is connected to the Internet, operation 502 is executed. In a case where the electronic device is not connected to the Internet, operation 503 is executed.
[0064] Operation 502: Invoking a target interface, such that the target interface sends the first content to the target model deployed in the cloud.
[0065] Where, in the present embodiment, the target interface may be invoked based on a first parameter, such that the target interface sends the first content to the target model deployed in the cloud. The first parameter represents invoking the target model in the cloud.
[0066] Specifically, in the present embodiment, both the first content and the first parameter may be sent to the target interface, and the target interface sends the first content to the generative AI model in the cloud, and the generative AI model in the cloud generates second content according to the first content.
[0067] Operation 503: Invoking the target interface, such that the target interface sends the first content to the target model deployed locally.
[0068] Where, in the present embodiment, the target interface may be invoked based on a second parameter, such that the target interface sends the first content to the target model deployed in the cloud. The second parameter represents invoking the local target model.
[0069] Specifically, in the present embodiment, both the first content and the second parameter may be sent to the target interface, and the target interface sends the first content to the generative AI model installed in the electronic device, and the generative AI model installed in the electronic device generates second content according to the first content.
[0070] Based on the above embodiment, in a case where operation 501 detects that the electronic device is not connected to the Internet, it may first be detected whether the first content satisfies a sensitive-content condition, where the sensitive-content condition indicates that the first content does not include a preset censored description word. Based on this, in a case where the first content satisfies the sensitive-content condition, that is, does not include the censored description word, operation 503 may be executed to generate second content through the local target model. In a case where the first content does not satisfy the sensitive-content condition, that is, includes the censored description word, operation 503 is not executed, and instead prompt information is output in the editing page, where the prompt information is configured to prompt re-input. Accordingly, in the present embodiment, it can be ensured that the first content provided to the target model does not include the censored description word, thereby reducing a possibility (that is, a probability) that the second content generated by the target model includes the censored description word.
[0071] Based on the embodiment shown in FIG. 1, in one embodiment, in a process of sequentially outputting content such as text and images included in the second content in the editing page, the present embodiment may continuously monitor whether an interruption operation is received, such as an interruption operation generated by a user pressing keys such as “esc” and “Enter”, or performing focus switching, or operating to hide a soft keyboard, and the like. If an interruption operation is received during a process of outputting the second content in the editing page, it may be controlled to stop outputting other content in the second content in the editing page.
[0072] For example, as shown in FIG. 6, during a process of outputting a poem titled “Uniquely Beautiful Scene” in the text input page of the office application, whether an interruption operation corresponding to interruption keys such as “esc” or “Enter” exists is continuously monitored. If so, outputting other content in “Uniquely Beautiful Scene” that has not yet been output may be stopped.
[0073] Referring to FIG. 7, FIG. 7 is a schematic structural diagram of a data processing apparatus provided in the present disclosure. The apparatus may be deployed in an operating system of an electronic device, and the apparatus may include the following units:
[0074] A target application 701, configured to provide an editing page;
[0075] A target model 702, configured to generate content;
[0076] An input service 703, configured to, in response to a target string being input in the editing page of the target application 701, parse the target string, and based on a parsing result of the target string, in a case where the target string is determined to match a trigger string, obtain first content according to the target string; where the first content at least includes a first prompt generated based on the target string; provide the first content to the target model, to receive second content generated by the target model 702 according to the first content; and transmit the second content to the target application 701, such that the target application 701 outputs the second content in the editing page.
[0077] It can be seen that, in the data processing apparatus provided in the embodiments of the present disclosure, after a user inputs the target string in the editing page of the target application, the user can view the second content generated by the target model in the editing page, without needing to switch from the editing page of the target application to an input page of the target model, and without needing to switch from an output page of the target model back to the editing page of the target application after the target model generates the second content, and furthermore without needing operations such as copying and pasting the second content, whereby during a process of using the target model, the number of user operations can be reduced, user operation complexity can be lowered, and the user experience of using the target model can be improved.
[0078] It should be noted that the target application 701 is deployed in an application layer of the operating system, and the target model 702 is a generative AI model independent from the target application 701, and may be deployed in the cloud or locally in the electronic device. The input service 703 is deployed in a framework layer of the operating system.
[0079] Where the input service 703 is further configured to present the target string in the editing page in response to an input operation directed to the editing page.
[0080] In one embodiment, when the input service 703 determines that the target string matches the trigger string, the input service 703 is specifically configured to:
[0081] Identify that the target string includes a first string and a second string, where the first string precedes the second string in the target string, and at least one intermediate character exists between the first string and the second string; or
[0082] Identify that the target string includes a third string, where at least one intermediate character exists after the third string in the target string; or,
[0083] Identify that the target string includes a fourth string, where at least one intermediate character exists before the fourth string in the target string.
[0084] Where the first content further includes: a second prompt; the target model generates the second content for the intermediate character according to the first prompt and the second prompt; where the second prompt includes context information of the target application.
[0085] An accessibility service is deployed in the operating system in which the target application is located, where the accessibility service is configured to obtain context information associated with the intermediate character in the target application and provide the context information to the input service, and the input service generates the second prompt based on the context information.
[0086] In one embodiment, when the input service 703 outputs the second content in the editing page of the target application, the input service 703 is specifically configured to: output the second content in the editing page based on context information of the target application.
[0087] In one embodiment, when the input service 703 provides the first content to the target model, the input service 703 is specifically configured to: detect whether an electronic device on which the editing page is located is connected to the Internet; in a case where the electronic device is connected to the Internet, invoke a target interface, such that the target interface sends the first content to the target model deployed in the cloud; and in a case where the electronic device is not connected to the Internet, invoke the target interface, such that the target interface sends the first content to the target model deployed locally.
[0088] Where, in a case where the input service 703 detects that the electronic device is not connected to the Internet, the input service 703 is further configured to: detect whether the first content satisfies a sensitive-content condition; in a case where the first content satisfies the sensitive-content condition, execute the invoking the target interface, such that the target interface sends the first content to the target model deployed locally; and in a case where the first content does not satisfy the sensitive-content condition, output prompt information on the editing page, where the prompt information is configured to prompt re-input.
[0089] In one embodiment, the input service 703 is further configured to: in a case where part of the second content is output in the editing page and an interruption operation is received, control stopping further output other content in the second content in the editing page.
[0090] It should be noted that specific implementations of the units in the present embodiment may refer to corresponding content in the foregoing descriptions, and details are not described herein again.
[0091] Referring to FIG. 8, FIG. 8 is a schematic structural diagram of an electronic device provided in the present disclosure. The electronic device may include the following structures:
[0092] A memory 801, configured to store a computer program and data generated during running of the computer program;
[0093] A processor 802, where the target application and the input service are deployed in the processor 802, and the target model may also be deployed in the processor 802, or the target model is deployed in the cloud. Based on this, the input service in the processor 802 may be configured to, in response to a target string being input in the editing page of the target application, parse the target string, and based on a parsing result of the target string, in a case where the target string is determined to match a trigger string, obtain first content according to the target string; where the first content at least includes a first prompt generated based on the target string; provide the first content to the target model, to receive second content generated by the target model according to the first content; and transmit the second content to the target application, such that the target application outputs the second content in the editing page.
[0094] It can be seen that, in the electronic device provided in the embodiments of the present disclosure, after a user inputs the target string in the editing page of the target application, the user can view the second content generated by the target model in the editing page, without needing to switch from the editing page of the target application to an input page of the target model, and without needing to switch from an output page of the target model back to the editing page of the target application after the target model generates the second content, and furthermore without needing operations such as copying and pasting the second content, whereby during a process of using the target model, the number of user operations can be reduced, user operation complexity can be lowered, and the user experience of using the target model can be improved.
[0095] Taking an Office application program as an example, scenarios in which a user uses a generative AI model in a notebook computer are described below by way of example:
[0096] First, the present disclosure aims to provide an “intelligent generative AI input assistance function”. The function can directly provide AI question-answering and content generation functions in all input boxes of devices using the Android operating system, such as notebook computers.
[0097] After adopting the solution proposed in the present disclosure, the following significant advantages may be obtained:
[0098] (1) Simplifying operation procedures: A user no longer needs to switch back and forth between multiple applications (that is, the Office application and the generative AI model), and all content generation and conversion may be completed in a current input box, thereby greatly simplifying operation procedures.
[0099] (2) Improving work efficiency: A requirement for repetitive work such as manually copying and pasting is reduced, allowing the user to focus more on content itself, thereby improving work efficiency.
[0100] (3) Lowering a usage threshold: A user does not need to adapt to different AI functions of various applications, thereby lowering usage difficulty and a technical threshold.
[0101] (4) Enhancing user experience: Personalized recommendations and optimization further improve user experience, such that content generation and communication become natural and smooth.
[0102] Referring to FIG. 9, FIG. 9 is a schematic interaction diagram among an application-layer APP, a framework-layer framework, and an AI engine under a Windows operating system or an Android system. Certainly, the method provided in the present disclosure may also be applied in other operating systems having a similar architecture, and the operating system is not limited in the present disclosure.
[0103] Where an application in the application layer provides an input box, and a user may perform text input in the input box. In the framework layer, implementation is achieved through the input service and the accessibility service. In the present embodiment, a native input service in the Android system is modified and customized, thereby implementing main functions including: identifying special instructions, extracting prompts, and displaying AI-generated results to a text box. The AI engine in the present embodiment is triggered by a special instruction input by the user. For example, the user may input “&&prompt&&” in the text box, and the special string may trigger the AI engine to generate content and automatically embed the content into the current text box. The AI engine is implemented through an AI service. Based on this, an interaction process is as follows:
[0104] First, a user inputs text in any input box in any application program.
[0105] Then, the input service obtains text input in the input box, parses the text, and obtains content between two “&&”; and obtains a current page environment, that is, the context information in the foregoing descriptions (for example, a currently used application type, a language style of preceding text, and the like) through the accessibility service. The input service combines the obtained text between the two “&&” and the current page environment as a prompt, and then sends the prompt to the AI service;
[0106] Finally, the AI engine generates a corresponding content result according to the received prompt and sends (commits) the content result to the application program providing the input box, and returns the content result to the input box of the application program. Where the AI engine may be deployed in the cloud or deployed locally. If the notebook computer has network access, the AI engine deployed in the cloud may be used. If the notebook computer does not have network access, the AI engine deployed locally may be used.
[0107] Based on this, the user may view an AI-generated result in the input box, and continue editing or directly send the AI-generated result accordingly.
[0108] It should be noted that the input service may further have an interruption exit function. For example, the user interrupts output of the AI-generated result in the input box by pressing an ESC key on a keyboard, performing focus switching, hiding a soft keyboard, or the like.
[0109] The embodiments in the present disclosure are described in a progressive manner, and each embodiment mainly describes differences from other embodiments. Same or similar parts among the embodiments may refer to each other. For an apparatus disclosed in the embodiments, because the apparatus corresponds to the method disclosed in the embodiments, the description is relatively simple, and relevant portions may refer to descriptions of the method part.
[0110] A person skilled in the art may further appreciate that the units and algorithm operations of various examples described in connection with the embodiments disclosed herein may be implemented by electronic hardware, computer software, or a combination thereof. In order to clearly illustrate interchangeability between hardware and software, the compositions and operations of the various examples have been generally described above according to functions. Whether the functions are executed in a hardware manner or a software manner depends on a specific application and design constraint condition of the technical solutions. A person skilled in the art may use different methods for each specific application to implement the described functions, but such implementation should not be considered to fall outside the scope of the present disclosure.
[0111] The operations of the method or algorithm described in connection with the embodiments disclosed herein may be directly implemented by hardware, a software module executed by a processor, or a combination thereof. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium well known in the technical field.
[0112] The above descriptions of the disclosed embodiments enable a person skilled in the art to implement or use the present disclosure. Various modifications to these embodiments will be apparent to a person skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments shown herein, but is to accord with the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data processing method, comprising:parsing a target string in response to the target string being input in an editing page of a target application;obtaining first content according to the target string in a case where the target string is determined to match a trigger string based on a parsing result of the target string, wherein the first content at least comprises a first prompt generated based on the target string;providing the first content to a target model, to receive second content generated by the target model according to the first content, wherein the target application and the target model are independent from each other; andoutputting the second content in the editing page of the target application.
2. The method according to claim 1, wherein an input service deployed in an operating system is configured to parse the target string, and obtain first content according to the target string in a case where the target string is determined to match the trigger string based on a parsing result of the target string; andthe input service is configured to present the target string in the editing page in response to an input operation directed to the editing page.
3. The method according to claim 1, wherein determining that the target string matches a trigger string comprises:identifying that the target string includes a first string and a second string, wherein the first string precedes the second string in the target string, and at least one intermediate character exists between the first string and the second string; oridentifying that the target string includes a third string, wherein at least one intermediate character exists after the third string in the target string; or,identifying that the target string includes a fourth string, wherein at least one intermediate character exists before the fourth string in the target string.
4. The method according to claim 3, wherein the first content further comprises:a second prompt; the target model generates the second content for the intermediate character according to the first prompt and the second prompt, and the second prompt comprises context information of the target application.
5. The method according to claim 4, wherein an accessibility service is deployed in an operating system in which the target application is located, the accessibility service is configured to obtain context information associated with the intermediate character in the target application and provide the context information to the input service, and the input service generates the second prompt based on the context information.
6. The method according to claim 4, wherein outputting the second content in the editing page of the target application comprises:the input service outputting the second content in the editing page based on the context information of the target application.
7. The method according to claim 1, wherein providing the first content to the target model comprises:detecting whether an electronic device on which the editing page is located is connected to the Internet;invoking a target interface in a case where the electronic device is connected to the Internet, such that the target interface sends the first content to the target model deployed in the cloud; andinvoking the target interface in a case where the electronic device is not connected to the Internet, such that the target interface sends the first content to the target model deployed locally.
8. The method according to claim 7, wherein in a case where the electronic device is not connected to the Internet, the method further comprises:detecting whether the first content satisfies a sensitive-content condition;invoking the target interface in a case where the first content satisfies the sensitive-content condition, enabling the target interface to send the first content to the target model deployed locally; andoutputting prompt information on the editing page in a case where the first content does not satisfy the sensitive-content condition, wherein the prompt information is configured to prompt re-input.
9. The method according to claim 1, wherein the method further comprises:stopping output of content in the second content in the editing page in a case where part of the second content is output in the editing page and an interruption operation is received.
10. A data processing apparatus, comprising:a target application, configured to provide an editing page;a target model, configured to generate content; andan input service, configured to:in response to a target string being input in the editing page, parse the target string, and based on a parsing result of the target string, in a case where the target string is determined to match a trigger string, obtain first content according to the target string, wherein the first content at least comprises a first prompt generated based on the target string;provide the first content to the target model, to receive second content generated by the target model according to the first content; andtransmit the second content to the target application, such that the target application outputs the second content in the editing page.
11. The data processing apparatus according to claim 10, wherein the input service deployed in an operating system is configured to parse the target string, and obtain first content according to the target string in a case where the target string is determined to match the trigger string based on a parsing result of the target string; andthe input service is configured to present the target string in the editing page in response to an input operation directed to the editing page.
12. The data processing apparatus according to claim 10, wherein determining that the target string matches a trigger string comprises:identifying that the target string includes a first string and a second string, wherein the first string precedes the second string in the target string, and at least one intermediate character exists between the first string and the second string; oridentifying that the target string includes a third string, wherein at least one intermediate character exists after the third string in the target string; or,identifying that the target string includes a fourth string, wherein at least one intermediate character exists before the fourth string in the target string.
13. The data processing apparatus according to claim 12, wherein the first content further comprises: a second prompt; the target model generates the second content for the intermediate character according to the first prompt and the second prompt, and the second prompt comprises context information of the target application.
14. The data processing apparatus according to claim 13, wherein an accessibility service is deployed in an operating system in which the target application is located, the accessibility service is configured to obtain context information associated with the intermediate character in the target application and provide the context information to the input service, and the input service generates the second prompt based on the context information.
15. The data processing apparatus according to claim 13, wherein outputting the second content in the editing page of the target application comprises:the input service outputting the second content in the editing page based on the context information of the target application.
16. The data processing apparatus according to claim 10, wherein providing the first content to the target model comprises:detecting whether an electronic device on which the editing page is located is connected to the Internet;invoking a target interface in a case where the electronic device is connected to the Internet, such that the target interface sends the first content to the target model deployed in the cloud; andinvoking the target interface in a case where the electronic device is not connected to the Internet, such that the target interface sends the first content to the target model deployed locally.
17. The data processing apparatus according to claim 16, wherein in a case where the data processing apparatus is not connected to the Internet, the input service is further configured to:detect whether the first content satisfies a sensitive-content condition;invoke the target interface in a case where the first content satisfies the sensitive-content condition, enabling the target interface to send the first content to the target model deployed locally; andoutput prompt information on the editing page in a case where the first content does not satisfy the sensitive-content condition, wherein the prompt information is configured to prompt re-input.
18. The data processing apparatus according to claim 10, wherein the input service is further configured to: stop outputting content in the second content in the editing page in a case where part of the second content is output in the editing page and an interruption operation is received.
19. Computer storage medium storing one or more computer programs, when executed by one or more processors, the one or more computer programs implementing a data processing method, comprising:parsing a target string in response to the target string being input in an editing page of a target application;obtaining first content according to the target string in a case where the target string is determined to match a trigger string based on a parsing result of the target string, wherein the first content at least comprises a first prompt generated based on the target string;providing the first content to a target model, to receive second content generated by the target model according to the first content, wherein the target application and the target model are independent from each other; andoutputting the second content in the editing page of the target application.
20. The computer readable storage medium according to claim 19, wherein an input service deployed in an operating system is configured to parse the target string, and obtain first content according to the target string in a case where the target string is determined to match the trigger string based on a parsing result of the target string; andthe input service is configured to present the target string in the editing page in response to an input operation directed to the editing page.
