Asktim Summary in search results - #3994
Conversation
OpenAPI Changes44 changes: 0 error, 24 warning, 20 info Unexpected changes? Ensure your branch is up-to-date with |
|
what is the prefilled query instruction? |
|
in the drawer there is numbers: 1,2 what are those for? |
|
The prefilled prompt:
Its not clear what the numbers should actually do (in the figma they turn red and have a tooltip when hovered). |
|
I see what you are trying to do. The main reason we are doing this is to offer personalized recommendation, because search is not so we'd really like for them to continue conversation with asktim, hopefully finding what they are looking for. you might be bothered by asktim asking "tell me more.." perhaps it gives some recommendation first, and then says "if you tell me more.." |
|
we could do that. we can consider either always ending strictly with "if you tell me more.." etc or leave it to the bot continue in some context specific way |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Shared thread state and streaming-error handling can produce incorrect recommendation conversations and blank overviews.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 3
Open (3)
What changed in this PR
Adds a feature-flagged AskTIM-generated course overview to search results, with a drawer for follow-up conversation.
Changes:
- Adds the AI overview UI, prompt configuration, and analytics.
- Reuses recommendation-chat request configuration.
- Adds feature flagging, environment validation, and tests.
| File | Description |
|---|---|
env/frontend.local.example.env |
Documents the optional prompt override. |
frontends/main/validateEnv.js |
Registers the prompt environment variable. |
frontends/main/src/common/feature_flags.ts |
Adds the search overview flag. |
frontends/main/src/page-components/AiChat/AiRecommendationBotDrawer.tsx |
Exposes shared recommendation-chat configuration. |
frontends/main/src/page-components/SearchDisplay/SearchDisplay.tsx |
Inserts the overview into search results. |
frontends/main/src/page-components/SearchDisplay/AiSearchOverview.tsx |
Implements overview generation and follow-up drawer. |
frontends/main/src/page-components/SearchDisplay/AiSearchOverview.test.tsx |
Tests overview behavior and configuration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@shanbady i think that's much better |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Refactor response handling to check for error messages and improve readability. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: shanbady <196425+shanbady@users.noreply.github.com>
Co-authored-by: shanbady <196425+shanbady@users.noreply.github.com>
Co-authored-by: shanbady <196425+shanbady@users.noreply.github.com>
Co-authored-by: shanbady <196425+shanbady@users.noreply.github.com>
Co-authored-by: shanbady <196425+shanbady@users.noreply.github.com>
mbertrand
left a comment
There was a problem hiding this comment.
Not sure piggybacking on the recommendation bot is the best approach. It mixes two different things: a learner choosing to ask AskTIM about courses, and an automatic summary on every search. A couple of side effects:
- Threads: the recommendation bot keeps its thread in a cookie. Each search starts a new summary thread (
clear_history) and points that cookie at it, so the learner's next message in the regular AskTIM drawer continues the summary thread, prompt instructions included. - Rate limit: the summary shares the
recommendation_botlimit, which on prod is 20/day anonymous and 30/day logged in. Every search uses one, so after ~20 searches an anonymous user gets "You have reached the maximum number of chat requests…" as the summary. learn-ai returns that as a normal 200, so it isn't caught as an error. It also blocks the regular AskTIM chat for the rest of the day.
Might be better to give the summary its own consumer in learn-ai. It probably doesn't need a new bot, just a subclass of RecommendationBotHttpConsumer with its own ROOM_NAME and throttle_scope, a route, and a ConsumerThrottleLimit row with a significantly higher limit. That gives it its own cookie and its own limit, keeps summary traffic out of the recommendation bot's usage numbers, and avoids polluting the main page's AskTIM drawer with the summary's prompt & chat messages.
|
@mbertrand this should be ready for another look. I updated the PR with new instructions and created the learn-ai PR |
…iew.tsx Co-authored-by: Matt Bertrand <mrbertrand@gmail.com>
mbertrand
left a comment
There was a problem hiding this comment.
LGTM, ol-infrastructure will need a PR for setting NEXT_PUBLIC_LEARN_AI_SEARCH_SUMMARY_ENDPOINT if it doesn't already


What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/13558
Description (What does it do?)
This PR adds an "AskTim summary" to the search results. The component leverages the existing recommendation bot endpoint with a prefilled query/instructions so it renders appropriately.
Screenshots (if appropriate):
How can this be tested?