feat(assistant): v2 — query-language detection, analytics, chips, auto-index

Addresses real gaps found in testing (a Macedonian question on an English
page returned nothing):

- Detect the language of the QUESTION (Cyrillic -> MK; Slovene markers -> SI;
  else the page language) and load that language's index + curated answers.
  Fixes cross-language questions.
- Expand curated multilingual intents (now incl. enrolment/eVŠ, deadlines,
  health, "what is MSOS", etc.) with stem keywords for better paraphrase
  matching. MK/SI answers machine-drafted — proofread before launch.
- Suggested-question chips on open (localized) to guide users.
- Privacy-safe analytics: fire a GA4 'assistant_query' event ONLY after the
  visitor accepts cookies (q text, result type, question vs page language) so
  the team can see real FAQs and unanswered questions.
- Move the widget to bottom-left on pages with the floating "Become a member"
  CTA so they never overlap. Design polish (chips, typing dots, launcher pulse).
- CI: rebuild the search index on every deploy (setup-python + build script)
  so the assistant stays in sync with content automatically. Build script is
  now path-portable (no hardcoded path).

Verified in a headless browser: MK-on-EN now answers correctly, chips work,
analytics event fires only with consent, become-a-member offset applies,
zero console errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
popovskikandClaude Opus 4.8 committed 2026-08-04 01:48:39 +02:00
1 parent f7f297bd65
commit 661943bb34
4 files changed
+263 -185

No files matched your search

+32 -3
View File
@@ -14,19 +14,30 @@
z-index: 9999;
font-family: inherit;
}
/* On the Become-a-member page the floating "Become a member" CTA sits
bottom-right, so move the assistant to the bottom-left there. */
.msa-root.msa-left { right: auto; left: 20px; }
.msa-root.msa-left .msa-panel { right: auto; left: 0; }
/* launcher */
.msa-launch {
position: relative;
display: inline-flex; align-items: center; gap: 8px;
background: var(--msa-accent); color: #fff;
border: 0; border-radius: 999px;
padding: 12px 18px; font-size: 15px; font-weight: 600;
cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
transition: transform .15s ease, background .15s ease;
transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.msa-launch:hover { background: var(--msa-accent-dark); transform: translateY(-1px); }
.msa-launch:hover { background: var(--msa-accent-dark); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.24); }
.msa-launch i { font-size: 17px; }
.msa-open .msa-launch { display: none; }
/* gentle attention pulse on the launcher */
.msa-launch::before {
content: ""; position: absolute; inset: 0; border-radius: 999px;
box-shadow: 0 0 0 0 rgba(18,112,126,.45); animation: msa-pulse 2.8s ease-out infinite;
}
@keyframes msa-pulse { 0%{box-shadow:0 0 0 0 rgba(18,112,126,.45);} 70%{box-shadow:0 0 0 14px rgba(18,112,126,0);} 100%{box-shadow:0 0 0 0 rgba(18,112,126,0);} }
/* panel */
.msa-panel {
@@ -38,7 +49,25 @@
box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
overflow: hidden;
}
.msa-open .msa-panel { display: flex; }
.msa-open .msa-panel { display: flex; animation: msa-rise .22s ease; }
@keyframes msa-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
/* suggested-question chips */
.msa-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.msa-chips-label { width: 100%; font-size: 12.5px; color: #5a6b72; margin-bottom: 2px; }
.msa-chip {
background: #fff; border: 1px solid var(--msa-accent); color: var(--msa-accent);
border-radius: 999px; padding: 7px 12px; font-size: 13px; font-family: inherit;
cursor: pointer; line-height: 1.2; transition: background .12s ease, color .12s ease;
}
.msa-chip:hover { background: var(--msa-accent); color: #fff; }
/* typing indicator */
.msa-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.msa-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9fb0b6; display: inline-block; animation: msa-blink 1.2s infinite; }
.msa-typing i:nth-child(2) { animation-delay: .2s; }
.msa-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes msa-blink { 0%,80%,100%{ opacity:.3; } 40%{ opacity:1; } }
.msa-head {
display: flex; align-items: center; justify-content: space-between;