-
Notifications
You must be signed in to change notification settings - Fork 136
AI: Generate product sharing message part 2: Functionality #9236
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
AI: Generate product sharing message part 2: Functionality #9236
Conversation
|
You can test the changes on this Pull Request by downloading an installable build, or scanning this QR code: |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## trunk #9236 +/- ##
============================================
- Coverage 44.05% 43.99% -0.06%
+ Complexity 4268 4251 -17
============================================
Files 859 859
Lines 45459 45454 -5
Branches 5965 5958 -7
============================================
- Hits 20026 19997 -29
- Misses 23676 23707 +31
+ Partials 1757 1750 -7
☔ View full report in Codecov by Sentry. |
…m sheet is used. This allows actual sharing to happen.
The note itself is generated by ChatGPT.
| private const val PRODUCT_DESCRIPTION_PROMPT = "Write a description for a product with title \"%1\$s\"%2\$s.\n" + | ||
| "Identify the language used in the product title and use the same language in your response.\n" + | ||
| "Make the description 50-60 words or less.\n" + | ||
| "Use a 9th grade reading level.\n" + | ||
| "Perform in-depth keyword research relating to the product in the same language of the product title, " + | ||
| "and use them in your sentences without listing them out." | ||
|
|
||
| fun generateProductDescriptionPrompt(name: String, features: String = ""): String { | ||
| val featuresPart = if (features.isNotEmpty()) " and features: \"$features\"" else "" | ||
| return String.format(PRODUCT_DESCRIPTION_PROMPT, name, featuresPart) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused yet, but will be very soon, so I thought to add it right away.
Generated by 🚫 dangerJS |
|
|
||
| fun onShareButtonClicked() { | ||
| val writtenMessage = _viewState.value.shareMessage | ||
| val messageToShare = writtenMessage.ifEmpty { navArgs.productName } + "\n" + navArgs.permalink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user doesn't enter any share message, we default to "[product_name] [URL]" as the sharing text, otherwise it's "[written_message] [URL]"
|
Hey @hafizrahman 👋🏼 I'm still reviewing the PR but, while testing, I couldn't generate the test with AI. I always get an error. I tested with a couple different products, with and without description: GenerateDescription.mp4Any idea what might be wrong? |
| val messageToShare = writtenMessage.ifEmpty { navArgs.productName } + "\n" + navArgs.permalink | ||
|
|
||
| tracker.track( | ||
| AnalyticsEvent.PRODUCT_SHARING_AI_GENERATE_TAPPED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Np, I think this tracking should be PRODUCT_SHARING_AI_SHARE_TAPPED ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Great eye.
…ites for now. Otherwise it opens the old sharing feature as usual.
# Conflicts: # WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt # WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsTracker.kt # WooCommerce/src/main/kotlin/com/woocommerce/android/util/FeatureFlag.kt
|
Just finished reviewing @hafizrahman Thanks for quick fixing the tracking issue. About this:
As discussed over Slack, it didn't work because I wasn't testing with a WP.com site and, as you well noticed this feature only applies to WP.com accounts. Now that the check is added to only display AI sharing UI for WP.com sites, we are good to go! Excellent job!! Ready to ship |
Has to be a WPCom Atomic site, and is public.
Please do not merge before #9224 is merged.
Part of: #9216
Ref: pe5sF9-1AH-p2
Sorry if the PR is a bit large; a good chunk of it is just the Prompts text, and trackings.
Description
This PR continues from #9224 by adding the actual functionalities to the UI.
The added features are:
Testing instructions
Check video below for testing example:
Video
share-with-ai-android.webm
RELEASE-NOTES.txtif necessary.