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

Assistant design improvements + V2 API #3327

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from

Conversation

mpivchev
Copy link
Collaborator

@mpivchev mpivchev commented Feb 19, 2025

Prerequisite: nextcloud/NextcloudKit#124

  1. Implemented [Assistant_iOS] Improve Assistant on mobile screen #3241 + Assistant improvements #3226.
    Some points @Hyeyoung346:
  • Tasks created in the same day show up as "Today" in the timeframe.
  • I think it's good to keep the status in the task detail, as just icons is not enough information IMO. In that case in the detail the status is shown like this:
image
  • "Pending" does not show in the list and only shows on the detail, as that is where we get more information.
  1. Fixed [Assistant] A list view with scrolling issue #3201
  2. Made Assistant compatible with API V1 (<NC30) and API V2 (>=NC30)
  3. Added UI tests
    • @i2h3 @marinofaggiana You can run the UI tests to test V2 functionality. You need a server instance with assistant and testing app enabled. Server.sh now includes the commands to enable that, so you can start a server using that script.
    • For testing V1, please change the useV2 flag to false and test manually.

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@Hyeyoung346
Copy link

@mpivchev I think AI conversations are rarely “completed”. People often want to ask follow-up questions. This aligns better with the natural flow of human reasoning (where follow-up questions are common), therefore, should avoid “completed”mark.

  • Tasks created in the same day show up as "Today" in the timeframe.
    => I think "Today" is possible, but how to display the time frame after today in the list view?

  • I think it's good to keep the status in the task detail, as just icons is not enough information IMO.

  • "Pending" does not show in the list and only shows on the detail, as that is where we get more information.
    => I think it would be useful to show the status (timeframe, pending) in the list view rather than in the task view.
    Maybe if it’s possible to implement follow-up questions with input filed inside the task detail later, probably would be useful to add good/bad feedback or report legal issue, modify response etc.

What is the difference between API V1 (<NC30) and API V2 (>=NC30)? Is there any improvements or difference from API V1?

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@mpivchev
Copy link
Collaborator Author

mpivchev commented Feb 21, 2025

@Hyeyoung346

  1. We can put the completion status on the left side, and the date on the right side?
    I think in general having the icon on the list items is good enough for information, and it's not too cluttered. If you do want more information you can then open the details.
  • I do think in general if we are going to have a message-like input and output structure we will have to redesign a lot of this. For example instead of straight up showing the status we can do it like a message saying "I could not generate a response, try again" or something similar.

For now, however, since we just have input-output prompts, this is informative.

  1. You didn't comment on this, so not sure if you agree.

  2. As mentioned above, i think it becomes too cluttered.

  3. Difference between API 1 and 2 is that we can have different input and output types for different task types (text input, uploading image, uploading audio, transcribing, translating etc). Currently for mobile apps only simple text input is supported.

  • V2 also sends us more information: progress, last updated, scheduled at and ended at. V1 only provides completed at.

At the moment it looks like this:

@mpivchev mpivchev marked this pull request as ready for review February 21, 2025 16:36
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@Hyeyoung346
Copy link

@mpivchev

  1. You mean icon + date in the list view? I think current list view screen looks good & informative. Perhaps the date could be displayed shorter => 25.Feb 2025.
    I mean icon + date + completed mark in the task details screen looks still questionable. I noticed that output responses sometimes also ask the following questions like “Would you like to know more about ~?”, so it looked strange to show the “completed” mark. Not sure icon + date + completed mark would be informative in the task detail screen, so I want to suggest to remove this part. But, as you said, we just have simple input-output prompts, so can iterate later further.

  2. You mean => Fixed [Assistant] A list view with scrolling issue #3201
    Yeah if you fixed that scrolling issue in the list view, that would be awesome!

Thanks for the detailed info! It looks better and more useful now, with more functionalities.

@mpivchev
Copy link
Collaborator Author

Hi @Hyeyoung346 the scrolling issue is already fixed in this PR. It's just open until this PR is merged :)

@mpivchev
Copy link
Collaborator Author

Regarding 1. I'll see what I can do on Monday. Have a nice weekend 😀

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@mpivchev
Copy link
Collaborator Author

mpivchev commented Feb 24, 2025

@Hyeyoung346 modified the date to show in a more human readable way
- Less than a minute: Returns "Less than a minute ago".
- Less than an hour: Returns the number of minutes (e.g., "5 minutes ago").
- Less than a day: Returns the number of hours (e.g., "2 hours ago").
- Less than a month: Returns the number of days (e.g., "3 days ago").
- More than a month: Returns the full formatted date (e.g., "Jan 10, 2025").

image

I mean icon + date + completed mark in the task details screen looks still questionable. I noticed that output responses sometimes also ask the following questions like “Would you like to know more about ~?”, so it looked strange to show the “completed” mark. Not sure icon + date + completed mark would be informative in the task detail screen, so I want to suggest to remove this part. But, as you said, we just have simple input-output prompts, so can iterate later further

I agree ultimately we should remove the status altogether and mimic a chat-like behavior. But for now, since it's just a prompt-style, we should keep it this way IMO.

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@mpivchev
Copy link
Collaborator Author

@jancborchardt can you quickly go over this :)

@jancborchardt jancborchardt self-requested a review February 26, 2025 10:27
Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a really nice improvement @mpivchev! :)

I only have 2 small details for now, but they are not necessarily blockers, could also be done in follow-ups:

  • The vertical space between the 3 lines in the task list should be even (right now there is more space above the date)
  • I agree the "Completed" text could be cut. The icon is fine enough. And in the detail view, if it is still pending or if there is an error, that should show more presently as a sort of empty content view where the Output would normally be.

@marinofaggiana
Copy link
Member

marinofaggiana commented Feb 27, 2025

@mpivchev Seems do not use all width and the font seems a bit too big

Screenshot 2025-02-27 alle 17 29 30

@i2h3
Copy link

i2h3 commented Feb 28, 2025

How do I test this? Either with our corporate production instance or the test server run by the shell script I have eternally scheduled tasks but never responses.

@mpivchev
Copy link
Collaborator Author

mpivchev commented Mar 4, 2025

@mpivchev Seems do not use all width and the font seems a bit too big

Screenshot 2025-02-27 alle 17 29 30

This doesnt happen for me

image

@i2h3
Copy link

i2h3 commented Mar 5, 2025

I tried to test again but I cannot on our daily server due to nextcloud/server#51248

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpivchev can’t see your comment about the vertical spacing anymore, but if you think it’s too close together, let’s at least go for a padding value inbetween the current state and your screenshot. :)

@mpivchev
Copy link
Collaborator Author

mpivchev commented Mar 5, 2025

@mpivchev can’t see your comment about the vertical spacing anymore, but if you think it’s too close together, let’s at least go for a padding value inbetween the current state and your screenshot. :)

Hi, added equal padding so it looks better now :) @jancborchardt

image

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thank you! :)

@i2h3
Copy link

i2h3 commented Mar 6, 2025

@mpivchev Is fixing the translation form out of scope? There is an obvious mismatch between the web version and what the app offers with its single text field and no hint what to enter there.

App
Web

@mpivchev
Copy link
Collaborator Author

mpivchev commented Mar 6, 2025

@mpivchev Is fixing the translation form out of scope? There is an obvious mismatch between the web version and what the app offers with its single text field and no hint what to enter there.

App Web

This is out of scope for now, currently iOS and Android only support certain tasks, and Translate is not one of them. In normal instances (not the one you use), I believe the API only returns the available tasks.

Copy link

@i2h3 i2h3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI tests are fragile and fail for me. Mostly it is the login and not your fault. By now I think we should replace the fragile web view interaction by just injecting an app token through an app launch argument so the whole login can be skipped and tests run much faster to the point.

The tests did not work on the daily server, but tech preview somewhat better.

Also it was strange that I first had to remove all the unnecessary framework references from the Xcode UI test target. Xcode was complaining about RealmSwift not being found when linking. It is not even supposed to be in the UI test target. 😵‍💫

I stop at this point now, I could spend the rest of the day making the tests work.

app.navigationBars["Assistant"].buttons["CreateButton"].tap()

app.textViews["InputTextEditor"].typeText(input)
app.navigationBars["New Free text to text prompt task"].buttons["Create"].tap()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscript is invalid. Issuing p app.navigationBars.allElementsBoundByAccessibilityElement.map(\.identifier) in the debugger prints:

([String]) 2 values {
  [0] = "More"
  [1] = "New ContextAgent task"
}

This resembles the navigation bar title "New ContextAgent task" in the sheet of the assistant.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, this is different when testing against the server on localhost:

([String]) 2 values {
  [0] = "More"
  [1] = "New Free text to text prompt task"
}

try await aMoment()

let cell = app.collectionViews.children(matching: .cell).element(boundBy: 0)
XCTAssert(cell.staticTexts[taskInputCreated].exists)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails for me when testing against tech preview because "an error occurred" when creating the task, so there is no cell to find.

Comment on lines +96 to +98
createTask(input: taskInputCreated)

pullToRefresh()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running against localhost, a short delay is needed in between, otherwise pull to refresh will fail because the cell has not appeared yet in the visible area.

@mpivchev
Copy link
Collaborator Author

mpivchev commented Mar 6, 2025

UI tests are fragile and fail for me. Mostly it is the login and not your fault. By now I think we should replace the fragile web view interaction by just injecting an app token through an app launch argument so the whole login can be skipped and tests run much faster to the point.

The tests did not work on the daily server, but tech preview somewhat better.

Also it was strange that I first had to remove all the unnecessary framework references from the Xcode UI test target. Xcode was complaining about RealmSwift not being found when linking. It is not even supposed to be in the UI test target. 😵‍💫

I stop at this point now, I could spend the rest of the day making the tests work.

The tests were made to be ran with Server.sh just like the download limit tests. Using any other server can cause the tests to fail as they may have different tasks enabled and so on. Please always use the Server.sh instance for these tests.

Regarding injecting the app token, i think we did that before, let me check.

Co-authored-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@i2h3
Copy link

i2h3 commented Mar 6, 2025

The tests were made to be ran with Server.sh just like the download limit tests.

I got confused because you recommended other servers. 😄 I see now, for manual testing only.

Regarding injecting the app token, i think we did that before, let me check.

I think Talk team does it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ At engineering
5 participants