Feature #3237
Enable copilot as quickly as possible
Added by Ram Kordale about 1 year ago. Updated about 1 year ago.
100%
Description
Today, we do the following: (a) wait for 10 seconds (b) make api call (c) show copilot.
we want to show copilot immediately. so, one way to handle this is:
(a) show copilot (b) in parallel, make api call (c) wait for final page load event (d) wait for 2 more seconds (e) make api call.
if user asks for some search phrase X after (b) and after (e), the user may get different answers.
Updated by Ram Kordale about 1 year ago
- Assignee changed from Ayush Khandelwal to Ayanava Karmakar
Updated by Ayanava Karmakar about 1 year ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Updated by Ayanava Karmakar about 1 year ago
- Status changed from Resolved to In Progress
- % Done changed from 100 to 0
Updated by Ayanava Karmakar about 1 year ago
1) call api with page URL
2) wait for an appropriate event (page or dom loaded or some such event that fires last), scan the page for yt urls, make api call with page and yt urls
3) wait for 20 seconds (is it 20 right now?), scan the page for yt urls, make api call with page and yt urls
Updated by Ayanava Karmakar about 1 year ago
Updated requirements
show the UI only after you get results or do not get results even in the final call
1 2 3
1 n n N - show 3rd
2 n n Y - show
3rd
3 n Y Y - show 2nd
4 Y Y Y - show
1st
[Yesterday 18:50] Ram Kordale
i see. in the above table, 1 could be triggered initially (no delay). 2 to be triggered after the UI event and 3. triggered as today.
Updated by Ayanava Karmakar about 1 year ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Updated by Ayanava Karmakar about 1 year ago
- Status changed from Resolved to Review
- Assignee changed from Ayanava Karmakar to Ayush Khandelwal
Updated by Ayanava Karmakar about 1 year ago
- second API call at min(completeTriggerTime, now + DELAY_BEFORE_SECOND_API_CALL))
Updated by Ayanava Karmakar about 1 year ago
- Status changed from Review to Reopened
- Assignee changed from Ayush Khandelwal to Ayanava Karmakar
Updated by Ayanava Karmakar about 1 year ago
A) getPurpleLinksInfoExtFull API calls timing -
JS-Snippet - (Non-YouTube Pages)
1) After all the js-snippet scripts have been added to head tag & loaded
2) Immediately after "load" event is triggered
3) 2 seconds constant delay after "load" event is triggered
JS-Snippet - (YouTube Pages)
1) After all the js-snippet scripts have been added to head tag & loaded
Extension - (Non-YouTube Pages)
1) Immediately on page visit
2) Immediately after "load" event is triggered
3) 2 seconds constant delay after "load" event is triggered
Extension - (YouTube Pages)
1) Immediately on page visit
B) When to show the UI
1) After the 1st API call- for both cases a) No purple links results b) we get purple link results
2) if we get updated responses -> We show/update the related links section after we get the 2nd & 3rd API calls
3) if we get updated responses -> We update the purplelinks data from which the user is searching the search term
C) When to show Related Links ( assuming is_snippet_test_mode is TRUE )
1) If we don't get purple link results in the 1st call, we don't show the Related Links section -> If we get purple links after 2nd/3rd API calls, then we show the Related Links section
2) If we get purple link results in the 1st call, we show the Related Links section -> if we get more purple links after 2nd/3rd API calls, then we update the related links section
Updated by Ayanava Karmakar about 1 year ago
Ayanava Karmakar wrote in #note-13:
A) getPurpleLinksInfoExtFull API calls timing -
JS-Snippet - (Non-YouTube Pages)
1) After all the js-snippet scripts have been added to head tag & loaded
2) Immediately after "load" event is triggered
3) 2 seconds constant delay after "load" event is triggeredJS-Snippet - (YouTube Pages)
1) After all the js-snippet scripts have been added to head tag & loaded
Extension - (Non-YouTube Pages)
1) Immediately on page visit
2) Immediately after "load" event is triggered
3) 2 seconds constant delay after "load" event is triggeredExtension - (YouTube Pages)
1) Immediately on page visit
B) When to show the UI
1) After the 1st API call- for both cases a) No purple links results b) we get purple link results
2) if we get updated responses -> We show/update the related links section after we get the 2nd & 3rd API calls
3) if we get updated responses -> We update the purplelinks data from which the user is searching the search termC) When to show Related Links ( assuming is_snippet_test_mode is TRUE )
1) If we don't get purple link results in the 1st call, we don't show the Related Links section -> If we get purple links after 2nd/3rd API calls, then we show the Related Links section
2) If we get purple link results in the 1st call, we show the Related Links section -> if we get more purple links after 2nd/3rd API calls, then we update the related links section
UPDATED REQUIREMENTS
Updated by Ayanava Karmakar about 1 year ago
- Assignee changed from Ayanava Karmakar to Ayush Khandelwal
Updated by Ayush Khandelwal about 1 year ago
- Status changed from Review to Feedback
- Assignee changed from Ayush Khandelwal to Ayanava Karmakar
Updated by Ayanava Karmakar about 1 year ago
- Assignee changed from Ayanava Karmakar to Ayush Khandelwal
working correctly
Tested on the following links -
1. https://www.studytonight.com/operating-system/introduction-operating-systems - we get purple links from 1st response
2. https://js-client-master.netlify.app/home - no purple links even in 3rd response
3. https://www.classcentral.com/classroom/youtube-python-tutorial-for-beginners-full-course-53265/610cb3f906eaf - NO purple links in 1st response. either a) purple links in 2nd b) more purple links in 3rd OR a) also no purple links in 2nd b) purple links in 3rd
Updated by Ayush Khandelwal about 1 year ago
The way we determine that all the `js-snippet` scripts have been added to head tag & loaded is as follows:
var script_loaded_count = 0; // Get HTML head element var head = document.getElementsByTagName('HEAD')[0]; var scriptNames = ["modal.js","cookie.js", "copilotScript.js", "extensionIndex.js", "extensionJaro.js", "extensionLoader.js", "extensionSearchUserTerms.js", "selection.js", "first-modal.js"]; var total_script_count = scriptNames.length; // 9 for(var scriptName : scriptNames) { var script = document.createElement('script'); script.src = scriptName; script.onload = () { script_loaded_count++; if(script_loaded_count == total_script_count) { // first api call } } head.appendChild(script); }