mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-11 21:39:22 +00:00
feat: add greeting customization to AI chat (#4483)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Support localized custom AI Assistant greeting subtitles.
|
||||
@@ -360,7 +360,7 @@
|
||||
"react-dom": "catalog:",
|
||||
},
|
||||
"catalog": {
|
||||
"@gitbook/api": "0.192.0",
|
||||
"@gitbook/api": "0.195.0",
|
||||
"@scalar/api-client-react": "^1.3.46",
|
||||
"@tsconfig/node20": "^20.1.6",
|
||||
"@tsconfig/strictest": "^2.0.6",
|
||||
@@ -760,7 +760,7 @@
|
||||
|
||||
"@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.2.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.2.0" } }, "sha512-6639htZMjEkwskf3J+e6/iar+4cTNM9qhoWuRfj9F3eJD6r7iCzV1SWnQr2Mdv0QT0suuqU8BoJCZUyCtP9R4Q=="],
|
||||
|
||||
"@gitbook/api": ["@gitbook/api@0.192.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-S9ceF3XspgSqXb7JH5feSHSytVkq1jRDwOKeEK4nnZs9pSiKFxHZMj/LnHi8k8anaue/FeLwWYo+Vk08Pdl0+g=="],
|
||||
"@gitbook/api": ["@gitbook/api@0.195.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-66OGIiiKUfHB7dF8fb9Ai8PkhQldD4SSQXHZ+X+SSEki2WXpgn6ze+PEXRQvDsJj2JKEvD9A7FfaGzUYiYn9hA=="],
|
||||
|
||||
"@gitbook/browser-types": ["@gitbook/browser-types@workspace:packages/browser-types"],
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
"catalog": {
|
||||
"@tsconfig/strictest": "^2.0.6",
|
||||
"@tsconfig/node20": "^20.1.6",
|
||||
"@gitbook/api": "0.192.0",
|
||||
"@gitbook/api": "0.195.0",
|
||||
"@scalar/api-client-react": "^1.3.46",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
|
||||
@@ -20,7 +20,7 @@ export type AIConfig = {
|
||||
trademark: boolean;
|
||||
assistantName?: string;
|
||||
greeting?: {
|
||||
title: string;
|
||||
title?: string;
|
||||
subtitle: string;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -121,6 +121,7 @@ export function AIChat() {
|
||||
suggestions={config.suggestions}
|
||||
trademark={config.trademark}
|
||||
assistantName={config.assistantName}
|
||||
greeting={config.greeting}
|
||||
/>
|
||||
</EmbeddableFrameBody>
|
||||
</EmbeddableFrameMain>
|
||||
@@ -212,7 +213,7 @@ export function AIChatBody(props: {
|
||||
/** Custom assistant name override; falls back to the branded/unbranded default name. */
|
||||
assistantName?: string;
|
||||
greeting?: {
|
||||
title: string;
|
||||
title?: string;
|
||||
subtitle: string;
|
||||
};
|
||||
}) {
|
||||
|
||||
@@ -30,6 +30,8 @@ export async function SiteLayout(props: {
|
||||
const { context, forcedTheme, withTracking, visitorAuthClaims, children } = props;
|
||||
|
||||
const { customization } = context;
|
||||
const { ai } = customization;
|
||||
const aiGreeting = (context.locale && ai?.localizedGreeting?.[context.locale]) ?? ai?.greeting;
|
||||
// Scripts are disabled when tracking is disabled
|
||||
const scripts = withTracking ? context.scripts : [];
|
||||
|
||||
@@ -73,6 +75,7 @@ export async function SiteLayout(props: {
|
||||
aiMode={customization.ai?.mode}
|
||||
suggestions={context.customization.ai?.suggestions}
|
||||
trademark={customization.trademark.enabled}
|
||||
greeting={aiGreeting ? { subtitle: aiGreeting } : undefined}
|
||||
>
|
||||
<SpaceLayout
|
||||
context={context}
|
||||
|
||||
Reference in New Issue
Block a user