Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ on:
required: true
HUGO_PHI_ONNX_LLM_API:
required: true
HUGO_CHATBOT_API:
required: true
HUGO_DEV_PROG_SIGNIUP_FORM_MUNCHKIN_ID:
required: true
HUGO_FORM_ID_FOR_PROGRAM_SIGNUP:
Expand Down Expand Up @@ -74,6 +76,7 @@ jobs:
HUGO_RAG_API: ${{ secrets.HUGO_RAG_API }}
HUGO_AUDIO_API: ${{ secrets.HUGO_AUDIO_API }}
HUGO_PHI_ONNX_LLM_API: ${{ secrets.HUGO_PHI_ONNX_LLM_API }}
HUGO_CHATBOT_API: ${{ secrets.HUGO_CHATBOT_API }}
HUGO_DEV_PROG_SIGNIUP_FORM_MUNCHKIN_ID: ${{ secrets.HUGO_DEV_PROG_SIGNIUP_FORM_MUNCHKIN_ID }}
HUGO_FORM_ID_FOR_PROGRAM_SIGNUP: ${{ secrets.HUGO_FORM_ID_FOR_PROGRAM_SIGNUP }}

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ jobs:
HUGO_RAG_API: ${{ secrets.HUGO_RAG_API }}
HUGO_AUDIO_API: ${{ secrets.HUGO_AUDIO_API }}
HUGO_PHI_ONNX_LLM_API: ${{ secrets.HUGO_PHI_ONNX_LLM_API }}
HUGO_CHATBOT_API: ${{ secrets.HUGO_CHATBOT_API }}
HUGO_DEV_PROG_SIGNIUP_FORM_MUNCHKIN_ID: ${{ secrets.HUGO_DEV_PROG_SIGNIUP_FORM_MUNCHKIN_ID }}
HUGO_FORM_ID_FOR_PROGRAM_SIGNUP: ${{ secrets.HUGO_FORM_ID_FOR_PROGRAM_SIGNUP }}
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ jobs:
HUGO_RAG_API: ${{ secrets.HUGO_RAG_API }}
HUGO_AUDIO_API: ${{ secrets.HUGO_AUDIO_API }}
HUGO_PHI_ONNX_LLM_API: ${{ secrets.HUGO_PHI_ONNX_LLM_API }}
HUGO_CHATBOT_API: ${{ secrets.HUGO_CHATBOT_API }}
HUGO_DEV_PROG_SIGNIUP_FORM_MUNCHKIN_ID: ${{ secrets.HUGO_DEV_PROG_SIGNIUP_FORM_MUNCHKIN_ID }}
HUGO_FORM_ID_FOR_PROGRAM_SIGNUP: ${{ secrets.HUGO_FORM_ID_FOR_PROGRAM_SIGNUP }}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@
<script src="/js/globalVarsandPreferences.js" defer></script>
<script src="/js/anonymous-analytics.js" defer></script> <!-- Include javascript to track custom analytics -->
<script src="/js/armid-and-navsearch.js" defer></script>
<script type="text/javascript" src="https://content.dev.bespin.arm.com/VirtualFAE/learnarm/stage/chat-ai.js" defer></script>
<!-- Development/stage chatbot script: https://content.dev.bespin.arm.com/VirtualFAE/learnarm/stage/chat-ai.js -->
<script type="text/javascript" src="https://content.ipexplorer.arm.com/VirtualFAE/learnarm/chat-ai.js" defer></script>
<script src="/vendor/msal-browser.min.js" defer></script> <!-- Authentication -->
<script src="/js/authentication.js" defer></script> <!-- Authentication -->
<script>
{{/* Get the chatbot API location from GitHub Secrets */}}
window.chatbotApiUrlEncoded = '{{ getenv "HUGO_CHATBOT_API" | base64Encode }}';
</script>
<script src="/js/chat-ai-integration.js" defer></script>



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(async () => {
try {
await initAuth();

const account = getAccount();
const claims = await getIdTokenClaimsForAccount(account);
const email = getEmailClaimValue(claims);
const chatbotApiUrl = atob(window.chatbotApiUrlEncoded || "");

if (!chatbotApiUrl) {
throw new Error("HUGO_CHATBOT_API is not configured");
}

if (email) {
// Create and append chat-ai element only after successful auth
const chatAi = document.createElement("chat-ai");
chatAi.id = "chat-ai";
chatAi.setAttribute("theme", "dark");
chatAi.setAttribute("app-name", "learning-paths");
chatAi.setAttribute("api-url", chatbotApiUrl);
chatAi.setAttribute("tnc-url", "https://ipuser.dev.bespin.arm.com/vfae-terms-and-conditions");
chatAi.setAttribute("stream", "false");
chatAi.setAttribute("login-hint", email);
chatAi.setAttribute("redirect-url", window.location.origin + "/");
chatAi.setAttribute("login-on-load", "true");

document.body.appendChild(chatAi);
window.chatAiRef = chatAi;
}
} catch (error) {
console.warn("Unable to authenticate:", error);
}
})();
Loading