From ba8ce271bfdc272cfff290faa85e44eba3cd30c0 Mon Sep 17 00:00:00 2001 From: Zach Lasiuk Date: Wed, 29 Jan 2025 14:22:31 -0600 Subject: [PATCH] updated RAG demo to only save last prompt and improve spacing --- assets/css/demo.css | 7 +++++++ .../partials/demo-components/config-rag.html | 7 +++---- .../llm-chatbot/javascript--llm-chatbot.html | 18 ++++++++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/assets/css/demo.css b/assets/css/demo.css index 738441e6f5..c6cf166059 100644 --- a/assets/css/demo.css +++ b/assets/css/demo.css @@ -264,6 +264,13 @@ margin-bottom: 8px; line-height: 1.3; } +.chatbot-response-text li { + margin-bottom: 0; +} +.chatbot-response-text ul, .chatbot-response-text ol { + line-height: 0.4; +} + diff --git a/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/config-rag.html b/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/config-rag.html index 369b63bc5f..6b0a22b060 100644 --- a/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/config-rag.html +++ b/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/config-rag.html @@ -23,10 +23,9 @@

RAG Vector Store Details

This application uses all data on learn.arm.com - as the RAG dataset. The content across Learning Paths and Install Guides is segmented into labeled chunks, - and vector embeddings are generated. - This LLM demo references the FAISS vector store to answer your query.

-

Note: Data was sourced on {{.Params.rag_data_cutoff_date}}.

+ as the RAG dataset as of {{.Params.rag_data_cutoff_date}}. + The content is segmented into labeled chunks, and vector embeddings are generated. This LLM demo references the FAISS vector store to answer your query. +

Conversation history is not saved, with only your most recent query being used in the system.

diff --git a/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/llm-chatbot/javascript--llm-chatbot.html b/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/llm-chatbot/javascript--llm-chatbot.html index fdbefbf28c..2c183ce6db 100644 --- a/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/llm-chatbot/javascript--llm-chatbot.html +++ b/themes/arm-design-system-hugo-theme/layouts/partials/demo-components/llm-chatbot/javascript--llm-chatbot.html @@ -186,6 +186,12 @@ } function updateLLMMetrics(metrics_object) { + + if (metrics_object['tps'] == 0) { + // No metrics to show + return; + } + // Show stats if they are not already shown document.getElementById('stats-populated').hidden = false; document.getElementById('stats-initial').hidden = true; @@ -428,10 +434,16 @@ } - all_messages_div.insertBefore(user_div, all_messages_div.firstChild); - + {{ if eq .Params.demo_template_name "llm_chatbot_rag_demo" }} + while (all_messages_div.firstChild) { + all_messages_div.removeChild(all_messages_div.firstChild); + } + {{ else if eq .Params.demo_template_name "llm_chatbot_first_demo" }} + {{ else }} + {{ end }} + all_messages_div.insertBefore(user_div, all_messages_div.firstChild); const chatbot_div = document.createElement('div'); chatbot_div.classList.add('chatbot-message'); @@ -453,6 +465,8 @@ chatbot_div.appendChild(chatbot_span_for_message); all_messages_div.insertBefore(chatbot_div, all_messages_div.firstChild); + + } // Check textarea content and enable/disable the button