Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
beb9847
fix highlight attributes
louisachu May 25, 2026
6babb8c
fix : info card text overflow issue
BaskarMitrah May 27, 2026
d21914f
fix : unquoted src and alt attributes in superhero video tag
BaskarMitrah May 27, 2026
33743ec
fix : malformed title attributes in embed block
BaskarMitrah May 27, 2026
2dbc419
feat(ai-assistants): implement analytics
davids-ensemble May 19, 2026
fe41511
feat(ai-assistant): update link rendering to include tracking attributes
davids-ensemble May 19, 2026
052c798
feat(ai-assistant): update clear button's daa-ll to describe action
davids-ensemble May 19, 2026
9fa0a8f
fix(ai-assistant): add noopener noreferrer to marked links
davids-ensemble May 28, 2026
1255182
feat(ai-assistant): prevent auto-scroll when user scrolls up
davids-ensemble May 19, 2026
8e85164
feat(ai-assistant): added prod url
davids-ensemble May 20, 2026
c6897ad
feat(ai-assistant): added prod api key
davids-ensemble May 26, 2026
3445f8a
Rename `API_KEY` to `STAGE_API_KEY` for clarity and consistency
davids-ensemble May 26, 2026
4012cd1
feat(ai-assistant): add Beta badge and widen chat window to 460px
davids-ensemble May 26, 2026
edf7572
fix(ai-assistant): fixed marked crashing because of undefined renderer
davids-ensemble May 29, 2026
13b7f09
feat(ai-assistant): new panel animation
davids-ensemble May 29, 2026
d3d55d2
hide OnThisPage option
May 26, 2026
c7ef245
update naming noOnThisPage
May 27, 2026
a97aabd
update naming
May 27, 2026
742492b
exclude block headings from OnThisPage sidebar
May 28, 2026
435193e
update edition color
louisachu Jun 2, 2026
f8a880f
rename the color
louisachu Jun 2, 2026
9bfd544
fixed vertical tab block decoration
May 27, 2026
743f77b
update query selector
May 28, 2026
9cea319
make tab image optional
May 28, 2026
d12e4f1
feat: enable text color on non-default superhero variants
melissag-ensemble Jun 2, 2026
0737d5b
fix: empty search and product checkboxes jumpiness
dianeba3 Jun 2, 2026
664f8ca
fix: lag in between clicking products and All Products
dianeba3 Jun 2, 2026
ef3ce00
test: console log message
dianeba3 Jun 3, 2026
3386f55
fix: add anchor links and results order
dianeba3 Jun 3, 2026
0ed04b6
fix: remove console log
dianeba3 Jun 3, 2026
dc41d74
feat(ai-assistant): improve daa-ll tracking identifiers
davids-ensemble Jun 4, 2026
d9711c7
replace Devsite AI with DevsiteAI
davids-ensemble Jun 4, 2026
743b25a
fix(ai-assistant): fixed chat button size
davids-ensemble Jun 1, 2026
c5f8ee1
update the copy button
louisachu Jun 5, 2026
0201723
fix: uncomment navigation loading logic in header.js
dianeba3 Jun 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 39 additions & 44 deletions hlx_statics/blocks/ai-assistant/ai-assistant.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
);
--container-padding: 40px;
--button-size: 48px;
--opening-transition-duration: 0.25s;

display: flex;
flex-direction: column-reverse;
Expand All @@ -41,7 +42,9 @@

position: relative;
width: var(--button-size);
min-width: var(--button-size);
height: var(--button-size);
min-height: var(--button-size);
border-radius: 50%;
border: 2px solid transparent;
padding: 0;
Expand All @@ -51,27 +54,29 @@
var(--ai-border-linear-gradient) border-box;
align-self: flex-end;
pointer-events: auto;
visibility: visible;
transition: visibility 0s linear
calc(var(--opening-transition-duration) * 0.9);

&:hover {
--background-color: #f0f0f0;
}

&.hidden {
visibility: hidden;
transition: visibility 0s linear;
}
}

/*
* MARK: Chat Window
*/
.ai-assistant-panel .chat-window {
--transition-duration: 0.25s;
width: var(--button-size);
height: var(--button-size);
border-radius: calc(var(--button-size) / 2);
background:
linear-gradient(#ffffff, #ffffff) padding-box,
var(--ai-border-linear-gradient) border-box;
--chat-window-width: 460px;
width: var(--chat-window-width);
height: 100%;
border-radius: 8px;
background: #fff;
/* Drop shadow/elevated (pretty much copy pasta from Figma) */
box-shadow:
0 0 2px 0 rgba(0, 0, 0, 0.12),
Expand All @@ -80,48 +85,25 @@
display: flex;
flex-direction: column;
overflow: hidden;
transform: translateY(var(--button-size));
transform: scale(0);
transform-origin: calc(100% - var(--button-size) / 2)
calc(100% - var(--button-size) / 2);
translate: 0 var(--button-size);
visibility: hidden;
border: solid transparent;
border-width: 2px;
border: 0;

transition:
width var(--transition-duration) ease-out var(--transition-duration),
height var(--transition-duration) ease-out var(--transition-duration),
border-radius var(--transition-duration) ease-out,
border-width var(--transition-duration) linear,
visibility 0s linear calc(var(--transition-duration) * 2);

.chat-window-header,
.chat-window-content,
.chat-window-input-section {
opacity: 0;
transition: opacity var(--transition-duration) ease-out 0s;
}
transform var(--opening-transition-duration) cubic-bezier(0.5, 0, 1, 1),
visibility 0s linear var(--opening-transition-duration);

&.show {
width: 400px;
height: 100%;
border-radius: 8px;
visibility: visible;
transition:
width var(--transition-duration) ease-out,
height var(--transition-duration) ease-out,
border-radius var(--transition-duration) ease-out
var(--transition-duration),
border-width var(--transition-duration) linear
var(--transition-duration),
visibility 0s linear 0s;
transform var(--opening-transition-duration)
cubic-bezier(0, 0, 0.4, 1),
visibility 0s linear;
pointer-events: auto;
border-width: 0px;

.chat-window-header,
.chat-window-content,
.chat-window-input-section {
opacity: 1;
transition: opacity var(--transition-duration) ease-out
calc(var(--transition-duration) * 2);
}
transform: scale(1);
}

.chat-ai-avatar {
Expand Down Expand Up @@ -151,8 +133,21 @@
margin: 0;
font-size: 18px;
font-weight: 700;
flex: 1;
margin-left: 12px;
margin-inline: 12px;
}

.chat-window-badge {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
padding: 2px 11px;
background-color: rgb(255, 232, 240);
color: black;
border-radius: 7px;
font-size: 12px;
min-height: 24px;
line-height: 14px;
}

.chat-window-close,
Expand Down Expand Up @@ -734,4 +729,4 @@
max-width: 400px;
}
}
}
}
16 changes: 16 additions & 0 deletions hlx_statics/blocks/ai-assistant/ai-assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {

import { aiApiClient } from "./ai-assistant_api-client.js";
import {
onUserScroll,
restoreChatHistory,
toggleChatWindow,
} from "./ai-assistant_chat-controller.js";
Expand Down Expand Up @@ -34,6 +35,20 @@ export default async function decorate(block) {
document.body,
"https://unpkg.com/marked@^17/lib/marked.umd.js",
() => {
// @ts-expect-error - marked is not on the Window object
window.marked.use({
renderer: {
/**
* @param {Object} options
* @param {string} options.href
* @param {string} options.title
* @param {string} options.text
*/
link({ href, title, text }) {
return `<a href="${href}" title="${title || text}" daa-ll="DevsiteAI Assistant:Message:Link:${title || text}|${href}" target="_blank" rel="noopener noreferrer">${text}</a>`;
},
},
});
addExtraScriptWithLoad(
document.body,
"https://unpkg.com/dompurify@^3/dist/purify.min.js",
Expand Down Expand Up @@ -67,6 +82,7 @@ export default async function decorate(block) {

block.appendChild(panel);

ELEMENTS.CHAT_WINDOW_CONTENT?.addEventListener("scroll", onUserScroll);
ELEMENTS.CHAT_BUTTON?.addEventListener("click", toggleChatWindow);
ELEMENTS.CHAT_WINDOW_CLEAR_BUTTON?.addEventListener("click", () =>
chatWindow.appendChild(createClearDialog()),
Expand Down
23 changes: 16 additions & 7 deletions hlx_statics/blocks/ai-assistant/ai-assistant_api-client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check
import { AI_API_BASE_URL, AI_API_KEY } from "./ai-assistant_constants.js";

import { isProdEnvironment } from "../../scripts/lib-adobeio.js";

/**
* @typedef {Object} RequestBody
Expand Down Expand Up @@ -87,11 +88,19 @@ import { AI_API_BASE_URL, AI_API_KEY } from "./ai-assistant_constants.js";
* @property {(error: unknown) => void} onError
*/

const STAGE_API_URL =
"https://devsite-rag.stg.app-builder.corp.adp.adobe.io/v1/inference";
const PROD_API_URL =
"https://devsite-rag.app-builder.adp.adobe.io/v1/inference";
const STAGE_API_KEY = "ai-assistant-devsite-rag-demo-01";
const PROD_API_KEY = "devsite-rag";
const IS_PROD = isProdEnvironment(window.location.host);

export class AiApiClient {
static STREAMING_ENDPOINT = "/v1/inference/retrieve/generate/stream";
static NON_STREAMING_ENDPOINT = "/v1/inference/retrieve/generate";
static COLLECTIONS_ENDPOINT = "/v1/inference/collections";
static FEEDBACK_ENDPOINT = "/v1/inference/feedback";
static STREAMING_ENDPOINT = "/retrieve/generate/stream";
static NON_STREAMING_ENDPOINT = "/retrieve/generate";
static COLLECTIONS_ENDPOINT = "/collections";
static FEEDBACK_ENDPOINT = "/feedback";
static LOCAL_STORAGE_COLLECTIONS_KEY = "ai-assistant__collections";
static LOCAL_STORAGE_COLLECTION_TTL = 1 * 24 * 60 * 60 * 1000; // 1 day

Expand Down Expand Up @@ -414,6 +423,6 @@ export class AiApiClient {
}

export const aiApiClient = new AiApiClient({
baseUrl: AI_API_BASE_URL,
apiKey: AI_API_KEY,
baseUrl: IS_PROD ? PROD_API_URL : STAGE_API_URL,
apiKey: IS_PROD ? PROD_API_KEY : STAGE_API_KEY,
});
17 changes: 14 additions & 3 deletions hlx_statics/blocks/ai-assistant/ai-assistant_chat-bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export class ChatBubble {
*/
#_init() {
const bubble = createTag("div", { class: "chat-bubble" });
const contentElement = createTag("div", { class: "chat-bubble-content" });
const contentElement = createTag("div", {
class: "chat-bubble-content",
});

if (this.source === "ai") {
if (!this.isContinuingConversation) {
Expand Down Expand Up @@ -111,6 +113,7 @@ export class ChatBubble {
class: "chat-bubble-copy",
type: "button",
"aria-label": COPY_BUTTON_LABEL,
"daa-ll": "DevsiteAI Assistant:Message:Button:Copy",
})
);
button.innerHTML = COPY_ICON_SVG;
Expand Down Expand Up @@ -180,6 +183,7 @@ export class ChatBubble {
class: "chat-bubble-feedback",
type: "button",
"aria-label": THUMB_UP_LABEL,
"daa-ll": "DevsiteAI Assistant:Message:Button:Upvote",
})
);
thumbUpButton.innerHTML = THUMB_UP_ICON_SVG;
Expand All @@ -192,6 +196,7 @@ export class ChatBubble {
class: "chat-bubble-feedback",
type: "button",
"aria-label": THUMB_DOWN_LABEL,
"daa-ll": "DevsiteAI Assistant:Message:Button:Downvote",
})
);
thumbDownButton.innerHTML = THUMB_DOWN_ICON_SVG;
Expand Down Expand Up @@ -324,7 +329,9 @@ export class ChatBubble {

this.references = references;

const wrapper = createTag("div", { class: "chat-bubble-sources" });
const wrapper = createTag("div", {
class: "chat-bubble-sources",
});
const heading = createTag("p", { class: "chat-bubble-sources-heading" });
heading.textContent = "Sources:";
wrapper.appendChild(heading);
Expand All @@ -338,10 +345,14 @@ export class ChatBubble {
rel: "noopener noreferrer",
});
a.textContent = title || url;
a.setAttribute(
"daa-ll",
`DevsiteAI Assistant:Message:Sources:Link:${a.textContent}|${url}`,
);
li.appendChild(a);
list.appendChild(li);
});
wrapper.appendChild(list);
this.element.appendChild(wrapper);
}
}
}
Loading
Loading