Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] replace does not work in certain use-cases #39

Closed
squidrye opened this issue Apr 4, 2023 · 3 comments · Fixed by #45
Closed

[Bug] replace does not work in certain use-cases #39

squidrye opened this issue Apr 4, 2023 · 3 comments · Fixed by #45

Comments

@squidrye
Copy link
Contributor

squidrye commented Apr 4, 2023

Bug Description

This issue was discovered in appflowy, so I have used a usecase there to describe the issue.

As the title suggests, replace option when using OpenAi to generate a summary or fix-spelling does not work as expected in few use-cases, if response generated is multiline, last line overwrites the previous lines. This can cause much problem and confusion if user is working on large selections of text for correction or summary generation.

How to Reproduce

  1. Select some text on editor (likely a query to generate multiple lines from open ai)
  2. select summarize and then replace the selected text.

Expected Behavior

Selected text should be correctly replaced by the response generated by open-ai.

Operating System

Linux

AppFlowy Version(s)

Version 0.1.1 (1)

Screenshots

AwesomeScreenshot-3_23_2023.5.13.13PM.mp4

Additional Context

This issue was previously opened, resolved and merged in appflowy and I needed it to write correct integration tests for other dependent issue I was working on however, since dependencies there have been changed for appflowy editor, those fixes are now redundant. For more reference kindly take a look at these.

AppFlowy-IO/AppFlowy#2100 (Now Redundant)
AppFlowy-IO/AppFlowy#2107 (comment)

These changes will be tested in appflowy via integration tests.

@squidrye
Copy link
Contributor Author

squidrye commented Apr 4, 2023

Let me know if I have permission to open PR to fix this issue so that I can finish up with main issues on appflowy

@squidrye squidrye changed the title [Bug] OpenAi replace does not work in certain use-cases [Bug] replace does not work in certain use-cases Apr 4, 2023
@LucasXu0
Copy link
Collaborator

LucasXu0 commented Apr 6, 2023

Hey, @squidrye. I remember you fixed this issue before in the AppFlowy repository. I just synced the code here. Could you help me check if it works perfectly now?

@squidrye
Copy link
Contributor Author

squidrye commented Apr 6, 2023

Hi @LucasXu0, I'll check it out and revert back, also I have to add another change in transaction.dart, I need this for selection to work correctly, issue was if some node in document is deleted beforeSelection is not being propagated to afterSelection , I'll link the commit here for a review Commit in other repo

edit: I have opened a pr for this, other than this previous changes seem to be working perfectly 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants