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:
@@ -0,0 +1,12 @@
|
||||
/** Prefix host-injected context onto the user query for embed chat. */
|
||||
export function buildQueryWithHostContext(
|
||||
query: string,
|
||||
hostContext?: Record<string, unknown>,
|
||||
): string {
|
||||
if (!hostContext || !Object.keys(hostContext).length) return query
|
||||
const lines = Object.entries(hostContext)
|
||||
.filter(([, v]) => v !== undefined && v !== null && v !== '')
|
||||
.map(([k, v]) => `${k}: ${typeof v === 'string' ? v : JSON.stringify(v)}`)
|
||||
if (!lines.length) return query
|
||||
return `[Host context]\n${lines.join('\n')}\n\n${query}`
|
||||
}
|
||||
Reference in New Issue
Block a user