feat(embed): add widget, visitor chat, and management UI (#1657)
Add embed.html entrypoint, floating widget SDK, secure-mode snippets, management panel with preview, visitor chat composables, citation rendering, and integration docs for subdomain and server-side token exchange.
This commit is contained in:
@@ -28,7 +28,16 @@ export default {
|
||||
expandSidebar: 'Expand Sidebar',
|
||||
logoutSuccess: 'Logged out successfully',
|
||||
myChats: 'My chats',
|
||||
embedChats: 'Web embed',
|
||||
embedChannelNamed: 'Web embed · {name}',
|
||||
groupBy: 'Group by',
|
||||
groupNone: 'None',
|
||||
groupDate: 'Date',
|
||||
channelsSection: 'Channel chats',
|
||||
chatsSection: 'Web chats',
|
||||
otherSources: 'Other sources',
|
||||
noSessions: 'No conversations yet',
|
||||
loadMoreSessions: 'Load more',
|
||||
},
|
||||
newUserGuide: {
|
||||
stepOf: '{current} / {total}',
|
||||
@@ -357,6 +366,7 @@ export default {
|
||||
description: 'Description',
|
||||
files: 'Files',
|
||||
settings: 'Settings',
|
||||
publishToWeb: 'Publish to Web',
|
||||
documentCategoryTitle: 'Document Categories',
|
||||
tagUpdateSuccess: 'Tag updated successfully',
|
||||
category: 'Category',
|
||||
@@ -970,15 +980,17 @@ export default {
|
||||
createTitle: 'Create Agent',
|
||||
editTitle: 'Edit Agent',
|
||||
basicInfo: 'Basic Info',
|
||||
basicInfoDesc: 'Configure agent basic information',
|
||||
basicInfoDesc: 'Configure agent name, description, and run mode',
|
||||
promptsConfig: 'Prompts',
|
||||
promptsConfigDesc: 'Configure system, context, intent, rewrite, and fallback prompts',
|
||||
modelConfig: 'Model Config',
|
||||
modelConfigDesc: 'Configure agent model parameters',
|
||||
modelConfigDesc: 'Configure chat model, auxiliary models (ReRank), and generation parameters',
|
||||
capabilities: 'Capabilities',
|
||||
capabilitiesDesc: 'Configure agent capabilities and tools',
|
||||
toolsConfig: 'Tools',
|
||||
toolsConfigDesc: 'Configure tools available to the Agent',
|
||||
knowledgeConfig: 'Knowledge Base',
|
||||
knowledgeConfigDesc: 'Configure knowledge bases for the agent',
|
||||
knowledgeConfigDesc: 'Configure knowledge base scope and FAQ strategy for the agent',
|
||||
webSearchConfig: 'Web Search',
|
||||
webSearchConfigDesc: 'Configure web search capabilities for the agent',
|
||||
configuration: 'Configuration',
|
||||
@@ -2265,9 +2277,167 @@ export default {
|
||||
unknownKb: 'Knowledge Base {id}',
|
||||
}
|
||||
},
|
||||
embedPublish: {
|
||||
title: 'Web Page Embed',
|
||||
description: 'Embed this agent on your website so visitors can chat via an in-page window or a floating launcher.',
|
||||
create: 'New embed channel',
|
||||
channelsTitle: 'Embed channels',
|
||||
disabled: 'Disabled',
|
||||
empty: 'No embed channels yet',
|
||||
unnamed: 'Unnamed channel',
|
||||
agent: 'Agent',
|
||||
rateLimit: 'Rate limit',
|
||||
rateLimitUnit: '/min',
|
||||
allowedOrigins: 'Allowed origins',
|
||||
embedCode: 'Embed code',
|
||||
widgetCode: 'Widget script',
|
||||
copyCode: 'Copy code',
|
||||
rotateToken: 'Rotate token',
|
||||
rotatePublishToken: 'Rotate publish token',
|
||||
channelKey: 'Channel key',
|
||||
channelKeyDesc: 'Long-lived secret for third-party site integration—store it safely',
|
||||
channelKeyHint: 'For security, channel keys are not returned in list APIs. If you did not save it, reset to generate a new key (stored for this browser session).',
|
||||
channelKeyUnavailable: 'Key unavailable',
|
||||
resetKeyTitle: 'Reset channel key',
|
||||
resetKeyConfirmOk: 'Reset',
|
||||
resetKeyConfirmBody: 'After reset, the old channel key is revoked immediately. Every deployed embed snippet must use the new key to keep working. This cannot be undone.',
|
||||
resetKeySuccess: 'Channel key reset—the new key is shown in the input field',
|
||||
resetKeyFailed: 'Failed to reset channel key',
|
||||
copyChannelKeyTitle: 'Copy channel key',
|
||||
revealKey: 'Reveal key',
|
||||
hideKey: 'Hide key',
|
||||
delete: 'Delete',
|
||||
edit: 'Edit',
|
||||
createTitle: 'New embed channel',
|
||||
editTitle: 'Edit embed channel',
|
||||
name: 'Name',
|
||||
nameDesc: 'For admin lists and channel identification',
|
||||
namePlaceholder: 'e.g. Website support',
|
||||
welcomeMessage: 'Welcome message',
|
||||
welcomePlaceholder: 'Hi! How can I help you?',
|
||||
showSuggestedQuestions: 'Suggested questions',
|
||||
showSuggestedQuestionsDesc: 'Show starter prompts before the first visitor message, from agent config and linked knowledge bases',
|
||||
originsLabel: 'Allowed origins (one per line, at least one required)',
|
||||
originsHint: 'One full origin per line (e.g. https://shop.example.com), at least one required; *.example.com subdomain wildcards supported',
|
||||
originsRequired: 'At least one allowed origin is required',
|
||||
originsInvalid: 'Invalid origin: {origin}',
|
||||
originsWildcardProd: "Wildcard origin '*' is not allowed in production",
|
||||
originsCount: '{n} allowed origins',
|
||||
originsPlaceholder: 'https://shop.example.com',
|
||||
rateLimitLabel: 'Requests per minute',
|
||||
rateLimitDesc: 'Per visitor IP, max embed API requests per minute; excess requests are temporarily rejected. Default 30.',
|
||||
rateLimitDayLabel: 'Daily request cap',
|
||||
rateLimitDayDesc: 'Channel-wide total requests allowed per day (across all visitor IPs); bounds abuse cost if the publish token is copied. Default 10000.',
|
||||
publishTokenWarning: 'The publish token appears in plain text in the embed page source — anyone visiting the host site can read it. Treat it as a publishable key, not a secret: never embed an agent that exposes sensitive data, always configure the origin allowlist and request caps, and rotate the token immediately if it leaks.',
|
||||
debug: 'Debug preview',
|
||||
createdDebugHint: 'Embed channel created — use Debug preview to open it in a new tab',
|
||||
primaryColor: 'Primary color',
|
||||
pageTitle: 'Page title',
|
||||
pageTitleDesc: 'Shown to visitors in chat header and browser tab; takes priority over name',
|
||||
pageTitlePlaceholder: 'AI Assistant',
|
||||
headerTitleMode: 'Header title',
|
||||
headerTitleModeChannel: 'Fixed channel title',
|
||||
headerTitleModeSession: 'Follow session title',
|
||||
headerTitleModeDesc: 'Fixed: always show the page title. Session: auto-title from the first message; falls back to page title until generated.',
|
||||
tokenHint: 'For security, channel keys are not returned in list APIs. Save the key when creating or resetting before copying the widget snippet (stored for this browser session).',
|
||||
createdWithToken: 'Embed channel created — the new key is shown in the input field; copy and store it now',
|
||||
created: 'Embed channel created',
|
||||
updated: 'Embed channel updated',
|
||||
saveFailed: 'Save failed',
|
||||
deleted: 'Deleted',
|
||||
tokenRotated: 'Channel key reset',
|
||||
copied: 'Embed code copied',
|
||||
loadError: 'Failed to load',
|
||||
missingChannel: 'Missing embed channel or token',
|
||||
invalidChannel: 'Invalid embed channel',
|
||||
sessionFailed: 'Failed to create chat session, please try again',
|
||||
channelDisabled: 'This embed channel is disabled. Re-enable it under Agent editor → Web Page Embed',
|
||||
loading: 'Loading...',
|
||||
tabIframe: 'iframe',
|
||||
tabWidget: 'Widget',
|
||||
tabSecure: 'Secure mode',
|
||||
widgetPosition: 'Widget position',
|
||||
widgetPreview: 'Widget preview',
|
||||
positionBottomRight: 'Bottom right',
|
||||
positionBottomLeft: 'Bottom left',
|
||||
positionTopRight: 'Top right',
|
||||
positionTopLeft: 'Top left',
|
||||
publishToken: 'Channel key',
|
||||
publishTokenHelp: 'The channel key (em_…) is a long-lived secret for this embed channel—like an API key. It is shown only when created or reset and must be placed in the host site widget script; list APIs never return it.',
|
||||
sessionTokenHelp: 'After a visitor opens chat, the iframe exchanges the channel key for a short-lived session credential (ems_…, ~30 min). Later API calls use the session credential so the channel key is not kept in the URL.',
|
||||
rotateTokenHelp: 'Resetting invalidates the previous channel key. Every deployed embed snippet must be updated or third-party sites will lose access.',
|
||||
revealToken: 'Reveal',
|
||||
hideToken: 'Hide',
|
||||
copyToken: 'Copy channel key',
|
||||
tokenCopied: 'Channel key copied',
|
||||
awaitingToken: 'Waiting for host page to provide token…',
|
||||
preview: 'Preview',
|
||||
previewIframeHint: 'Shows how the iframe embed looks on a third-party page (same as the copied snippet).',
|
||||
previewWidgetHint: 'Shows the floating widget on a mock host page. On a real site the host passes the token via postMessage.',
|
||||
previewMockPage: 'Mock host page',
|
||||
previewLoading: 'Loading preview…',
|
||||
previewUnavailable: 'Preview is unavailable. Ensure the channel is enabled and Redis is available.',
|
||||
defaultChatTitle: 'AI Assistant',
|
||||
newChat: 'New chat',
|
||||
channelsPanelIntro: 'Create embed channels for this agent, configure appearance and security, then deploy to third-party sites.',
|
||||
sectionChannel: 'Channel info',
|
||||
sectionSecurity: 'Security & rate limit',
|
||||
sectionCapabilities: 'Chat capabilities',
|
||||
allowWebSearch: 'Show web search toggle',
|
||||
allowWebSearchDesc: 'When enabled, visitors see a web search button in the input area and can turn it on or off themselves; it stays off by default. The button appears only if the bound agent has web search enabled.',
|
||||
allowMemory: 'Allow memory',
|
||||
allowMemoryDesc: 'When enabled, anonymous visitors retain context within the same session; memory is lost when they clear browser data or start a new chat. Off by default.',
|
||||
allowFileUpload: 'Show file upload',
|
||||
allowFileUploadDesc: 'When enabled, visitors can upload images and document attachments. Requires the bound agent to support image upload.',
|
||||
webhookUrl: 'Webhook URL',
|
||||
webhookUrlPlaceholder: 'https://your-server.example.com/weknora/embed-events',
|
||||
webhookUrlDesc: 'Optional. WeKnora POSTs message_sent / message_received events to this HTTPS endpoint.',
|
||||
webhookSecret: 'Webhook secret',
|
||||
webhookSecretPlaceholder: 'HMAC-SHA256 secret (X-WeKnora-Signature header)',
|
||||
webhookSecretKeep: 'Leave blank to keep the saved secret',
|
||||
webhookSecretDesc: 'Optional. When set, request bodies are signed for verification on your server.',
|
||||
secureModeDocHint: 'See docs/embed-secure-mode.md for the full integration guide',
|
||||
agentWebSearchDisabledHint: 'This agent does not have web search enabled. Visitors will not see the web search button until you enable it in agent settings.',
|
||||
agentImageUploadDisabledHint: 'This agent does not have image upload enabled. Visitors will not see the upload button until you enable it in agent settings.',
|
||||
sectionAppearance: 'Appearance',
|
||||
sectionDeploy: 'Deploy to site',
|
||||
sectionWebhook: 'Event callbacks',
|
||||
deployIntro: 'After saving, follow these two steps to embed chat on your website.',
|
||||
deployStepToken: 'Channel key',
|
||||
deployStepTokenDesc: 'Long-lived secret (em_…), like an API key. Shown on this page only when created or reset—store it safely.',
|
||||
deployStepEmbed: 'Copy embed code',
|
||||
deployStepEmbedDesc: 'Pick an embed style and paste the snippet into your site.',
|
||||
embedIframeDesc: 'Embed the full chat in a fixed page area.',
|
||||
embedWidgetDesc: 'Floating launcher in a corner; click to open the chat panel.',
|
||||
embedSecureDesc: 'Recommended: the publish token stays on your own backend and the page only receives short-lived tokens, so the long-lived secret never reaches the browser.',
|
||||
deployAfterSaveHint: 'After saving, you can copy the channel key and embed code here.',
|
||||
widgetTokenNote: 'Widget scripts must include the channel key; iframe embeds exchange credentials automatically on load.',
|
||||
secureTokenNote: 'The page no longer carries the publish token; it points at a token endpoint on your backend (data-token-endpoint). Your backend exchanges the publish token for a 30-minute short-lived token and returns it to the page; the widget auto-refreshes before expiry.',
|
||||
secureServerLabel: 'Server-side token endpoint example (publish token stays on the server)',
|
||||
secureServerCode: 'Server example',
|
||||
tabServerNode: 'Node.js',
|
||||
tabServerGo: 'Go',
|
||||
sectionBasic: 'Basic settings',
|
||||
sectionToken: 'Channel key',
|
||||
sectionEmbed: 'Embed code',
|
||||
enabled: 'Enable channel',
|
||||
deleteConfirm: 'Delete this embed channel? Deployed snippets will stop working.',
|
||||
rotateConfirmTitle: 'Reset channel key?',
|
||||
rotateConfirmBody: 'The old channel key stops working immediately. Update every deployed embed snippet.',
|
||||
defaultLocale: 'Default language',
|
||||
defaultLocaleDesc: 'Visitor UI language when chat opens; empty follows the browser or host Widget setLocale().',
|
||||
defaultLocaleBrowser: 'Browser / host default',
|
||||
sessionCountLabel: '{n} sessions',
|
||||
},
|
||||
knowledgeEditor: {
|
||||
titleCreate: 'Create Knowledge Base',
|
||||
titleEdit: 'Knowledge Base Settings',
|
||||
navGroups: {
|
||||
basic: 'Basics',
|
||||
processing: 'Indexing & Parsing',
|
||||
data: 'Storage & Data',
|
||||
integration: 'Publishing',
|
||||
},
|
||||
sidebar: {
|
||||
basic: 'Basic Information',
|
||||
models: 'Model Configuration',
|
||||
@@ -4765,6 +4935,12 @@ export default {
|
||||
},
|
||||
agentEditor: {
|
||||
builtinHint: 'This is a built-in agent. Name and description cannot be modified, but configuration parameters can be adjusted.',
|
||||
navGroups: {
|
||||
basic: 'Basics',
|
||||
knowledge: 'Knowledge & Retrieval',
|
||||
capability: 'Extensions',
|
||||
integration: 'Publish & Integrate',
|
||||
},
|
||||
placeholders: {
|
||||
available: 'Available variables: ',
|
||||
clickToInsert: '(click to insert)',
|
||||
@@ -4779,6 +4955,19 @@ export default {
|
||||
customized: 'Customized',
|
||||
empty: 'No intent templates available',
|
||||
},
|
||||
promptNav: {
|
||||
ariaLabel: 'Prompt outline',
|
||||
itemCount: '{n} items',
|
||||
groupCore: 'Core prompts',
|
||||
groupConversation: 'Conversation understanding',
|
||||
groupFallback: 'Retrieval fallback',
|
||||
system: 'System prompt',
|
||||
context: 'Context template',
|
||||
intent: 'Intent prompts',
|
||||
rewriteSystem: 'Rewrite · System',
|
||||
rewriteUser: 'Rewrite · User',
|
||||
fallback: 'Retrieval fallback',
|
||||
},
|
||||
selection: {
|
||||
all: 'All',
|
||||
selected: 'Selected',
|
||||
@@ -4809,7 +4998,7 @@ export default {
|
||||
webSearchMaxResults: 'Maximum number of results returned per search',
|
||||
webFetchEnabled: 'After reranking, auto-fetch full page content from top web results for better answers',
|
||||
webFetchTopN: 'Maximum number of web pages to fetch after reranking',
|
||||
retrievalSection: 'Configure knowledge base retrieval and ranking parameters',
|
||||
retrievalSection: 'Configure knowledge base retrieval, ranking, and FAQ priority strategy',
|
||||
queryExpansion: 'Automatically expand query terms to improve recall',
|
||||
embeddingTopK: 'Maximum number of results from vector retrieval',
|
||||
keywordThreshold: 'Minimum relevance score for keyword retrieval',
|
||||
@@ -4890,6 +5079,10 @@ export default {
|
||||
effectiveDesc: 'Computed from the current config — these are the tools the agent will actually be able to call',
|
||||
effectiveEmpty: 'No tool available — the agent will fall back to plain model chat',
|
||||
},
|
||||
embed: {
|
||||
title: 'Web Page Embed',
|
||||
description: 'Embed this agent on your website so visitors can chat via an in-page window or floating launcher. Knowledge scope follows this agent.',
|
||||
},
|
||||
im: {
|
||||
title: 'IM Integration',
|
||||
description: 'Connect agent to instant messaging platforms like WeCom, Feishu, Slack, Telegram, DingTalk, Mattermost and WeChat',
|
||||
@@ -4901,6 +5094,8 @@ export default {
|
||||
wecom: 'WeCom',
|
||||
wechat: 'WeChat',
|
||||
addChannel: 'Add Channel',
|
||||
channelsTitle: 'IM Channels',
|
||||
disabled: 'Disabled',
|
||||
editChannel: 'Edit Channel',
|
||||
deleteConfirm: 'Are you sure you want to delete this channel? This action cannot be undone.',
|
||||
channelName: 'Channel Name',
|
||||
@@ -4911,7 +5106,7 @@ export default {
|
||||
outputStream: 'Streaming',
|
||||
outputFull: 'Full Response',
|
||||
callbackUrl: 'Callback URL',
|
||||
empty: 'No IM channels yet. Click the button below to add one.',
|
||||
empty: 'No IM channels yet',
|
||||
unnamed: 'Unnamed Channel',
|
||||
docLink: 'Integration Guide',
|
||||
feishuConsole: 'Feishu Open Platform',
|
||||
@@ -4974,7 +5169,7 @@ export default {
|
||||
imageUpload: {
|
||||
navLabel: 'Multimodal',
|
||||
sectionTitle: 'Multimodal Configuration',
|
||||
sectionDesc: 'Configure image upload and vision-language model for multimodal conversations',
|
||||
sectionDesc: 'Configure image/audio upload and their VLM and ASR models',
|
||||
label: 'Image Upload',
|
||||
desc: 'Allow users to upload images for multimodal Q&A in conversations',
|
||||
vlmModel: 'VLM Model',
|
||||
@@ -5065,6 +5260,7 @@ export default {
|
||||
datasource: {
|
||||
title: 'Data Sources',
|
||||
description: 'Configure external data sources to sync content into this knowledge base',
|
||||
channelsTitle: 'Data sources',
|
||||
add: 'Add Data Source',
|
||||
addFirst: 'Add your first data source',
|
||||
empty: 'No data sources configured',
|
||||
|
||||
Reference in New Issue
Block a user