@visual-framework/vf-chatbot-standalone
v1.0.0-beta.4
Published
Visual Framework Standalone Chatbot component
Readme
About
The vf-chatbot-standalone component provides a full-screen conversational interface between a user and an AI system. It is typically accessed through a dedicated route or external site. Designed for more complex interactions, it supports extended dialogues, exploration of multiple topics, and access to documents or detailed support resources.
Usage
When to use this component
Only use the chatbot standalone if there's evidence it helps users:
- Engage in longer sessions or structured tasks such as report generation, data analysis, or learning journeys
- Focus in a distraction-free environment optimized for dialogue
- Interact with the bot as primary interface, rather than a secondary support layer
- Access rich responses such as cards, file previews, or dynamic visualizations
For example, the standalone chatbot works well when users need to complete complex workflows or explore content across multiple interactions. It is also effective when the conversation itself drives the experience, rather than supporting it. Test with users to ensure the dedicated interface supports their goals and provides clear value over embedded alternatives.
When not to use this component
The chatbot standalone opens in a dedicated interface and removes users from their current context. This can interrupt active tasks or create unnecessary friction for users who only need quick or simple guidance.
Avoid using the standalone chatbot for brief interactions, especially when users benefit from staying within the current page or task flow. A chatbot modal or embedded support is usually more appropriate in these cases.
Do not use the standalone chatbot when:
- The task can be resolved with a simple search or static content
- The chatbot does not offer a clear improvement over lighter support mechanisms
- Accessing the chatbot disrupts processes that require deep concentration or formal
- The chatbot lacks the intelligence or depth to sustain a meaningful experience
- The target audience expects or benefits more from traditional, structured interfaces
Test your design without a standalone chatbot first. Well-written content, embedded guidance, or contextual help may meet user needs more effectively without introducing unnecessary complexity.
Deciding between modal vs standalone
The chatbot modal and chatbot standalone are two distinct variants for delivering conversational interfaces. Choose between them based on use case needs and task complexity.
Modal
- For in-context support (e.g. help with current page or workflow)
- Access point is via a floating action button on the page
- Supports simple tasks such as getting information
Standalone
- Suitable for exploratory or focused workflows (e.g. discovering genetic variants)
- Launched via a link (such as "Talk to our AI chat assistant")
- Supports more complex tasks that benefit from sustained engagement
Anatomy
| Element | Description | |---------|-------------| | Title bar | Shows the chatbot name, minimise button and close button. The title bar may include a dropdown for selecting categories. | | Dialogue section | Scrollable chat window showing the conversation log. | | Intro message | A brief onboarding message explaining the purpose and capabilities of the chatbot. Shows the icon, title and short message (Max. 2 lines of text). | | Banner | Used to show optional disclaimers or alerts (Max. 3 lines of text). For cases that require user consent, use a blur overlay on the background or a pre-access popup instead, as banners may be missed. | | Text input area | Open input field for typing and sending queries. Expands up to 5 lines, after which it becomes scrollable. |
Flows
| Flow | Details | |------|---------| | Suggested prompts | Appear on the initial screen. Provide a quick-start to users with clickable queries. They help to provide context on the type of questions the user can ask on the platform. (Max. 60 characters) | | Closing the chat dialogue | Clicking on the close icon "X" triggers a confirmation prompt to prevent accidental loss of the chat log. | | Error management | If the chatbot is unable to provide a response to the query, display a clear error message and provide an alternative way for them to get their answers. | | Links | Displayed in a clear underlined style. They can be shown inline or as a list. | | Source attribution | Chips are shown in relevant paragraphs which cite the sources. Links to the sources and more details can be accessed via a "View sources" button. | | Feedback on a query level | Users can assess the AI responses with a thumbs up/thumbs down or optional close/open response fields to give more details. | | Category selection | A dropdown in the title bar lets users switch focus areas (e.g LLM version or data source). Single or multi-selection variants can be used depending on the use case. |
Working example
You can access working example of standalone version here: Visual Framework Chatbot - Standalone
Visual branding elements and content
The Chatbot branding elements follow EMBL brand guidelines but can be updated to suit your use case. For advice on branding updates please contact the EMBL Communications Team.
Texts shown in the examples are placeholder content. Please review and update all wording to fit your your project needs and ensure it meets legal, accessibility and organisational requirements.
Accessibility
The component targets WCAG 2.1 AA accessibility standard.
Install
This repository is distributed with npm. After installing npm and yarn, you can install vf-chatbot-standalone and other dependant components with this command.
yarn add @visual-framework/vf-chatbot @visual-framework/vf-chatbot-standaloneSass/CSS
@import "@visual-framework/vf-chatbot-standalone/index.scss";JavaScript
import { initVFChatbot } from 'vf-chatbot/vf-chatbot.js';
window.addEventListener("load", function() {
initVFChatbot(config);
});where config is the configuration object with different options as described below
Core Configuration Options
const config = {
type: "standalone",
title: "AI Assistant",
welcome_logo: true,
welcome_message: "Welcome! I'm here to help",
welcome_logo_alt: "AI Assistant",
welcome_suggestions_title: "Try asking me:",
input_placeholder: "Ask me ...",
welcome_max_suggestions: 4,
disclaimer: 'Disclaimer: This chatbot is designed to assist you with general information and basic inquiries. See our <a class="vf-banner__link" target="_blank" rel="noopener noreferrer" aria-label="disclaimer notes (opens in new tab)" href="https://www.ebi.ac.uk/data-protection/privacy-notice/embl-ebi-public-website/">disclaimer notes</a>.',
footnote: 'Review AI generated content for accuracy. <a class="vf-link" target="_blank" rel="noopener noreferrer" aria-label="Leave feedback (opens in new tab)" href="https://embl.service-now.com/esc?id=sc_cat_item&sys_id=5eeb8eb91b92e650b376da88b04bcbc1">Leave feedback</a>.',
icons: {
assistant_avatar: "../../assets/vf-chatbot/assets/vf-chatbot--icon-16x16-dark-green.svg",
user_avatar: "../../assets/vf-chatbot/assets/vf-chatbot--avatar-user.svg",
send_button: "../../assets/vf-chatbot/assets/vf-chatbot--icon-send.svg",
main_logo_url: "../../assets/vf-chatbot/assets/vf-chatbot--icon-32x32-dark-green.svg",
minimize: "../../assets/vf-chatbot/assets/vf-chatbot--icon-minimize.svg",
close: "../../assets/vf-chatbot/assets/vf-chatbot--icon-close.svg"
},
api: {
chat_endpoint: false,
feedback_endpoint: false,
qa_data_url: "../../assets/vf-chatbot/assets/vf-chatbot-qa.json",
headers:{
"Content-Type": "application/json",
"Authorization": "Bearer your-token"
},
timeout: 10000
},
features: {
enable_welcome: true,
enable_feedback: true,
enable_sources: true,
enable_welcome_suggestions: true,
enable_typing_indicator: true,
enable_disclaimer: true,
enable_predefined_qa: true,
enable_fallback_responses: true,
enable_qa_data_loading: true,
enable_instant_feedback: false
},
behavior: {
auto_scroll: true,
typing_delay: 800,
show_scrollbar: false
},
selectorContext: {
chatbotRoutes: {
multiSelect: true,
maxMultiSelect: 3,
showSearch: true,
showSearchThreshold: 5,
showAllServices: true,
showAllServicesSelected: true,
routes: "../../assets/vf-chatbot/assets/vf-chatbot-selector-services.json",
placeholder: "Select services",
title: "Services",
selector_logo_url: "../../assets/vf-chatbot/assets/vf-chatbot--icon-24x24-dark-green.svg",
selector_logo_title: "AI Assistant"
}
},
handlers: {
on_message_send: "handleMessageSend",
on_response_receive: "handleResponseReceive",
on_feedback_submit: "handleFeedbackSubmit",
on_suggestion_click: "handleSuggestionClick",
on_error: "handleError",
on_conversation_start: "handleConversationStart",
on_conversation_end: "handleConversationEnd"
},
feedback_options: {
positive: [
{ id: "accurate", label: "Accurate" },
{ id: "easy", label: "Easy to understand" },
{ id: "formatted", label: "Well formatted" }
],
negative: [
{ id: "inaccurate", label: "Inaccurate" },
{ id: "nocontext", label: "Did not use context" },
{ id: "poorformat", label: "Poorly formatted" }
]
}
};Service Selector Configuration
The chatbot includes an integrated selector component which can be configured to present different selection options to user:
const selectorConfig = {
selectorContext: {
chatbotRoutes: {
// Multi-selection settings
multiSelect: true,
maxMultiSelect: 3,
// Search functionality
showSearch: true,
showSearchThreshold: 5,
// "All Services" option
showAllServices: true,
showAllServicesSelected: true,
// Data source
routes: "assets/vf-chatbot-selector-services.json",
// UI labels and logo
placeholder: "Select services",
title: "Available Services",
selector_logo_url: "../../assets/vf-chatbot/assets/vf-chatbot--icon-24x24-dark-green.svg",
selector_logo_title: "AI Assistant"
}
}
};
Please note that if you want to opt for a single selection option version of the selector dropdown, you need to omit the multiSelect, maxMultiSelect, showAllServices and showAllServicesSelected properties from the selectorConfig above.Selector Data Format (JSON):
{
"routes": [
{
"id": "service-1",
"title": "Service 1 title"
},
{
"id": "service-2",
"title": "Service 2 title"
}
]
}Event Handling
Built-in Event Handlers
Chatbot comes with a provision to allow custom event handlers. These handlers can be defined in your code to handle specific actions for different events triggered during interaction with chatbot. Configure custom handlers for chatbot events:
const config = {
handlers: {
on_message_send: "handleMessageSend",
on_response_receive: "handleResponseReceive",
on_feedback_submit: "handleFeedbackSubmit",
on_suggestion_click: "handleSuggestionClick",
on_error: "handleError",
on_conversation_start: "handleConversationStart",
on_conversation_end: "handleConversationEnd"
}
};
// Implement handler functions
function handleMessageSend(message, conversationId) {
console.log('User sent:', message);
// Track analytics, log conversations, etc.
}
function handleResponseReceive(response, sources, prompts) {
console.log('Assistant responded:', response);
// Process response, update UI, etc.
}
function handleFeedbackSubmit(feedbackData) {
console.log('Feedback received:', feedbackData);
// Send to analytics, update models, etc.
}Custom Event Listeners
Likewise you can also listen to events emitted by the chatbot for specific interactions:
// Listen for specific chatbot events
document.addEventListener('vf-chatbot:message-send', (event) => {
const { message, conversationId } = event.detail;
// Handle message send
});
document.addEventListener('vf-chatbot:message-receive', (event) => {
const { message, conversationId } = event.detail;
// Handle message send
});
document.addEventListener('vf-chatbot-feedback:submit', (event) => {
const { messageId, feedbackType, feedbackText, feedbackComment } = event.detail;
// Handle feedback submission
});
document.addEventListener('vf-chatbot-welcome:suggestion-click', (event) => {
const { question } = event.detail;
// Handle suggestion clicks
});
document.addEventListener('vf-chatbot:assistant-change', (obj) => {
const { selectedRoutes } = obj.selectedAssistants;
const { conversationId } = obj.conversationId;
// Handle service selection
});
document.addEventListener('vf-chatbot:error', (event) => {
const { message, conversationId } = event.detail;
// Handle message send
});
document.addEventListener('vf-chatbot:conversation-start', (event) => {
const { message, conversationId } = event.detail;
// Handle conversation start
});
document.addEventListener('vf-chatbot:conversation-end', (event) => {
const { message, conversationId } = event.detail;
// Handle conversation end
});
Feedback System Configuration
Feedback (with form)
const config = {
features: {
enable_feedback: true,
enable_instant_feedback: false // Default
},
feedback_options: {
positive: [
{ id: "accurate", label: "Accurate" },
{ id: "easy", label: "Easy to understand" },
{ id: "formatted", label: "Well formatted" }
],
negative: [
{ id: "inaccurate", label: "Inaccurate answer" },
{ id: "nocontext", label: "Did not use context" },
{ id: "poorformat", label: "Poorly formatted" }
]
}
};Instant Feedback (one-click)
const config = {
features: {
enable_feedback: true,
enable_instant_feedback: true // Thumbs up/down only
}
};Q&A Data Configuration
Load predefined questions and answers:
const config = {
features: {
enable_predefined_qa: true,
enable_qa_data_loading: true
},
api: {
qa_data_url: "path/to/qa-data.json"
}
};Q&A Data Format:
{
"predefinedQA": {
"How can I submit genomic data to EMBL-EBI?": {
"answer": "To submit genomic data, visit the EMBL-EBI submission portal, where you’ll find step-by-step guides and tools for submitting sequencing data, assemblies, annotations, and more.",
"sources": [
{
"domain": "ebi.ac.uk",
"title": "EMBL's European Bioinformatics Institute",
"url": "https://www.ebi.ac.uk/",
"description": "Run BLAST searches against comprehensive sequence databases at EMBL-EBI."
},
{
"domain": "ena-docs.readthedocs.io",
"title": "ENA Documentation",
"url": "https://ena-docs.readthedocs.io/en/latest/",
"description": "ENA Documentation"
}
]
}
},
"fallbackResponses": [
{
"answer": "I'm sorry, I'm having trouble connecting to my knowledge base right now. Could you try again in a moment?",
"prompts": [
{
"action_text": "Contact support team",
"action_url": "tel:+44 1223 494 444"
},
{
"action_text": "Submit a support request",
"action_url": "https://www.ebi.ac.uk/about/contact/support/"
}
]
}
]
}API Integration
Chat Endpoint
Your chat API should accept POST requests:
// Request format
{
"message": "User's question",
"conversationId": "unique-id",
"context": {
"selectedServices": ["service-1", "service-2"]
}
}
// Response format
{
"response": "Assistant's answer",
"sources": [
{
"title": "Documentation Link",
"url": "https://example.com/docs"
}
],
"prompts": [
{
"action_text": "Learn More",
"action_url": "https://example.com/learn"
}
]
}Custom Welcome Screen
const config = {
features: {
enable_welcome: true,
enable_welcome_suggestions: true
},
welcome_logo: true,
welcome_message: "Welcome to our AI assistant!",
welcome_suggestions_title: "Popular questions:",
welcome_max_suggestions: 6
};Source Citations
const config = {
features: {
enable_sources: true
enable_sources_custom_format: true,
}
};
// Sources in API response (predefined format)
{
"response": "Here's the information...",
"sources": [
{
"title": "Official Documentation",
"url": "https://docs.example.com",
"description": "Complete guide to the platform"
}
]
}
// Sources in API response (custom format)
{
"response": "Here's the information...",
"sources": `<nav>
<ul>
<li><a href="#nowhere" title="Lorum ipsum dolor sit amet">Lorem</a></li>
<li><a href="#nowhere" title="Aliquam tincidunt mauris eu risus">Aliquam</a></li>
<li><a href="#nowhere" title="Morbi in sem quis dui placerat ornare">Morbi</a></li>
<li><a href="#nowhere" title="Praesent dapibus, neque id cursus faucibus">Praesent</a></li>
<li><a href="#nowhere" title="Pellentesque fermentum dolor">Pellentesque</a></li>
</ul>
</nav>`
}Action Prompts
// Action prompts in API response
{
"response": "I can help you with that...",
"prompts": [
{
"action_text": "Start Tutorial",
"action_url": "https://example.com/tutorial"
},
{
"action_text": "Contact Support",
"action_url": "mailto:[email protected]"
}
]
}React
This component now has React support which has been tested on react version 18.2.0
Install
yarn add @visual-framework/vf-chatbot @visual-framework/vf-chatbot-standaloneImport in the JS file where you want to include this component
import VFChatbot from '@visual-framework/vf-chatbot/vf-chatbot.react'; Make sure you have the jsx support enabled with babel. Alternatively, you can also copy the vf-chatbot.react.js file from below to your react project and import as per the location.Can be used as
<VFChatbot config={chatbotConfig} /> where chatbotConfig is defined as above. Please make sure to specify paths appended with `${process.env.PUBLIC_URL}` e.g. assistant_avatar: `${process.env.PUBLIC_URL}/assets/vf-chatbot/assets/vf-chatbot--icon-16x16-dark-green.svg`,Styling changes
You should install vf-sass-starter for the styles and then add below code in your main SCSS file
$vf-font-plex-mono-prefix: '~@visual-framework/vf-font-plex-mono/assets'; $vf-font-plex-sans-prefix: '~@visual-framework/vf-font-plex-sans/assets'; @import '~@visual-framework//vf-sass-starter/index.scss'; @import "~@visual-framework/vf-link/vf-link.scss"; @import "~@visual-framework/vf-chatbot/vf-chatbot.scss"; @import "~@visual-framework/vf-chatbot-modal/index.scss"; @import "~@visual-framework/vf-chatbot-standalone/index.scss";Usage:
<VFChatbot config={chatbotConfig} />
