Open Bug 2092109 Opened 4 days ago Updated 4 days ago

cache smart actions toolbar suggestions when returning to a page instead of requesting new ones

Categories

(Core :: Machine Learning: Frontend, enhancement)

enhancement
Points:
2

Tracking

()

People

(Reporter: Mardak, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [aiasst])

smart actions toolbar from bug 2090056 requests new suggestions from MLPA every time its context key changes, including on a tab switch or going back to a page it already showed actions for. Raised in review of D340378.

The sidebar already avoids this: ai-window.mjs keeps #sidebarStarterCache, a map bounded by MAX_SIDEBAR_STARTER_CACHE_KEYS that evicts the oldest entry, keyed by the context tabs and the memories setting.

The toolbar should keep a similar bounded cache keyed by contextKey in SmartActionsToolbar.sys.mjs, so switching back to a tab shows the earlier actions with no new request. Things to decide:

  • whether the cache is per window or shared across windows
  • what stays in the key as more context is added later (selection, memories, prompt version)
  • whether to cache the suggestions rather than the built actions, so the button labels and page title are read fresh when shown
  • whether the sidebar and the toolbar can share results while both ask for starters on the same page

more broadly, this is being smarter about when to make requests vs reuse cache as passing more context for richer results might not need as frequent updates e.g., scrolling through the page changing the uri hash -- then again, we might want to react to make suggestions based on the current section of a long wikipedia article

You need to log in before you can comment on or make changes to this bug.