@smart-cloud/ai-kit-ui 1.5.11 → 1.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-kit-ui.css +7 -0
- package/dist/doc-search/DocSearch.d.ts +1 -0
- package/dist/index.cjs +9 -9
- package/dist/index.js +9 -9
- package/package.json +2 -2
- package/src/ai-chatbot/AiChatbot.tsx +26 -2
- package/src/doc-search/DocSearch.tsx +14 -0
- package/src/i18n/ar.ts +4 -0
- package/src/i18n/de.ts +4 -0
- package/src/i18n/en.ts +4 -0
- package/src/i18n/es.ts +4 -0
- package/src/i18n/fr.ts +4 -0
- package/src/i18n/he.ts +4 -0
- package/src/i18n/hi.ts +4 -0
- package/src/i18n/hu.ts +4 -0
- package/src/i18n/id.ts +4 -0
- package/src/i18n/it.ts +4 -0
- package/src/i18n/ja.ts +4 -0
- package/src/i18n/ko.ts +4 -0
- package/src/i18n/nb.ts +4 -0
- package/src/i18n/nl.ts +4 -0
- package/src/i18n/pl.ts +4 -0
- package/src/i18n/pt.ts +4 -0
- package/src/i18n/ru.ts +4 -0
- package/src/i18n/sv.ts +4 -0
- package/src/i18n/th.ts +4 -0
- package/src/i18n/tr.ts +4 -0
- package/src/i18n/ua.ts +4 -0
- package/src/i18n/zh.ts +4 -0
- package/src/styles/ai-kit-ui.css +7 -0
- package/tests/ai-disclosures.test.ts +76 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-cloud/ai-kit-ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@emotion/cache": "^11.14.0",
|
|
23
23
|
"@emotion/react": "^11.14.0",
|
|
24
24
|
"@mantine/colors-generator": "^8.3.18",
|
|
25
|
-
"@smart-cloud/ai-kit-core": "^1.5.
|
|
25
|
+
"@smart-cloud/ai-kit-core": "^1.5.7",
|
|
26
26
|
"@smart-cloud/wpsuite-core": "^2.3.2",
|
|
27
27
|
"@tabler/icons-react": "^3.46.0",
|
|
28
28
|
"chroma-js": "^3.2.0",
|
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
} from "@tabler/icons-react";
|
|
26
26
|
|
|
27
27
|
import {
|
|
28
|
+
DEFAULT_CHATBOT_AI_DISCLOSURE,
|
|
29
|
+
formatAiDisclosure,
|
|
28
30
|
getStoreSelect,
|
|
29
31
|
sendChatMessage,
|
|
30
32
|
sendFeedbackMessage,
|
|
@@ -72,6 +74,8 @@ const HISTORY_STORAGE_KEY = `ai-kit-chatbot-history-v1:${
|
|
|
72
74
|
export const DEFAULT_CHATBOT_LABELS: Required<AiChatbotLabels> = {
|
|
73
75
|
modalTitle: "AI Assistant",
|
|
74
76
|
|
|
77
|
+
aiDisclosureLabel: DEFAULT_CHATBOT_AI_DISCLOSURE,
|
|
78
|
+
|
|
75
79
|
userLabel: "User",
|
|
76
80
|
assistantLabel: "Assistant",
|
|
77
81
|
assistantThinkingLabel: "Assistant is thinking...",
|
|
@@ -574,8 +578,11 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
|
|
|
574
578
|
}, [openButtonTitle, labels.askMeLabel, language]);
|
|
575
579
|
|
|
576
580
|
const modalTitle = useMemo(() => {
|
|
577
|
-
const raw =
|
|
578
|
-
|
|
581
|
+
const raw =
|
|
582
|
+
title?.trim() ||
|
|
583
|
+
labels.modalTitle?.trim() ||
|
|
584
|
+
DEFAULT_CHATBOT_LABELS.modalTitle;
|
|
585
|
+
return I18n.get(raw).trim() || I18n.get(DEFAULT_CHATBOT_LABELS.modalTitle);
|
|
579
586
|
}, [title, labels.modalTitle, language]);
|
|
580
587
|
|
|
581
588
|
const textareaPlaceholder = useMemo(() => {
|
|
@@ -583,6 +590,13 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
|
|
|
583
590
|
return I18n.get(raw);
|
|
584
591
|
}, [placeholder, labels.placeholder, language]);
|
|
585
592
|
|
|
593
|
+
const aiDisclosure = useMemo(() => {
|
|
594
|
+
const template = I18n.get(
|
|
595
|
+
labels.aiDisclosureLabel?.trim() || DEFAULT_CHATBOT_AI_DISCLOSURE,
|
|
596
|
+
);
|
|
597
|
+
return formatAiDisclosure(template, modalTitle);
|
|
598
|
+
}, [labels.aiDisclosureLabel, language, modalTitle]);
|
|
599
|
+
|
|
586
600
|
const rootClassName = useMemo(() => {
|
|
587
601
|
const base = "ai-docs-ask";
|
|
588
602
|
const pos = `ai-open-btn--${openButtonPosition}`;
|
|
@@ -2024,6 +2038,16 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
|
|
|
2024
2038
|
)}
|
|
2025
2039
|
|
|
2026
2040
|
<Stack className="ai-box ai-box-open">
|
|
2041
|
+
<Text
|
|
2042
|
+
className="ai-generated-content-disclosure"
|
|
2043
|
+
size="xs"
|
|
2044
|
+
c="dimmed"
|
|
2045
|
+
role="note"
|
|
2046
|
+
data-ai-kit-ai-disclosure
|
|
2047
|
+
>
|
|
2048
|
+
{aiDisclosure}
|
|
2049
|
+
</Text>
|
|
2050
|
+
|
|
2027
2051
|
{/* Reset confirmation dialog (Yes/No) */}
|
|
2028
2052
|
<Modal
|
|
2029
2053
|
opened={resetDialogOpen}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
AiKitDocSearchIcon,
|
|
21
21
|
CapabilityDecision,
|
|
22
|
+
DEFAULT_DOC_SEARCH_AI_DISCLOSURE,
|
|
22
23
|
type ContextKind,
|
|
23
24
|
dispatchBackend,
|
|
24
25
|
resolveBackend,
|
|
@@ -183,6 +184,7 @@ function escapeCssId(id: string) {
|
|
|
183
184
|
const DocSearchBase: FC<Props> = (props) => {
|
|
184
185
|
const {
|
|
185
186
|
autoRun = true,
|
|
187
|
+
aiDisclosure,
|
|
186
188
|
context,
|
|
187
189
|
title,
|
|
188
190
|
showOpenButton = false,
|
|
@@ -213,6 +215,9 @@ const DocSearchBase: FC<Props> = (props) => {
|
|
|
213
215
|
} = props;
|
|
214
216
|
|
|
215
217
|
const [featureOpen, setFeatureOpen] = useState<boolean>(!showOpenButton);
|
|
218
|
+
const resolvedAiDisclosure = I18n.get(
|
|
219
|
+
aiDisclosure?.trim() || DEFAULT_DOC_SEARCH_AI_DISCLOSURE,
|
|
220
|
+
);
|
|
216
221
|
const [query, setQuery] = useState<string>("");
|
|
217
222
|
const [recording, setRecording] = useState<boolean>(false);
|
|
218
223
|
const [audioBlob, setAudioBlob] = useState<Blob | null>(null);
|
|
@@ -1166,6 +1171,15 @@ const DocSearchBase: FC<Props> = (props) => {
|
|
|
1166
1171
|
>
|
|
1167
1172
|
{annotatedSummary || summaryText}
|
|
1168
1173
|
</ReactMarkdown>
|
|
1174
|
+
<Text
|
|
1175
|
+
className="ai-generated-content-disclosure"
|
|
1176
|
+
size="xs"
|
|
1177
|
+
c="dimmed"
|
|
1178
|
+
role="note"
|
|
1179
|
+
data-ai-kit-ai-disclosure
|
|
1180
|
+
>
|
|
1181
|
+
{resolvedAiDisclosure}
|
|
1182
|
+
</Text>
|
|
1169
1183
|
</Stack>
|
|
1170
1184
|
</>
|
|
1171
1185
|
) : null}
|
package/src/i18n/ar.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const arDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "نص بديل",
|
|
12
12
|
"An error occurred.": "حدث خطأ.",
|
|
13
13
|
"An unknown error occurred.": "حدث خطأ غير معروف.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"تُنشأ إجابات {name} بواسطة الذكاء الاصطناعي وقد تتضمن أخطاء. تحقّق من المعلومات المهمة.",
|
|
14
16
|
Arabic: "عربي",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"هل أنت متأكد أنك تريد إعادة ضبط المحادثة؟",
|
|
@@ -212,6 +214,8 @@ export const arDict: Record<string, string> = {
|
|
|
212
214
|
"النبرة أو الأسلوب الذي سيستخدمه الذكاء الاصطناعي.",
|
|
213
215
|
"The topic or subject for the AI to write about.":
|
|
214
216
|
"الموضوع أو الفكرة التي سيكتب عنها الذكاء الاصطناعي.",
|
|
217
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
218
|
+
"أُنشئ هذا الملخص بواسطة الذكاء الاصطناعي وقد يتضمن أخطاء. تحقّق من المعلومات المهمة.",
|
|
215
219
|
Title: "عنوان",
|
|
216
220
|
"TL;DR": "باختصار شديد",
|
|
217
221
|
tldr: "باختصار",
|
package/src/i18n/de.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const deDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alt-Text",
|
|
12
12
|
"An error occurred.": "Ein Fehler ist aufgetreten.",
|
|
13
13
|
"An unknown error occurred.": "Ein unbekannter Fehler ist aufgetreten.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Die Antworten von {name} werden von KI erstellt und können Fehler enthalten. Überprüfen Sie wichtige Informationen.",
|
|
14
16
|
Arabic: "Arabisch",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Möchten Sie die Konversation wirklich zurücksetzen?",
|
|
@@ -213,6 +215,8 @@ export const deDict: Record<string, string> = {
|
|
|
213
215
|
"Tonfall bzw. Stil, den die KI verwenden soll.",
|
|
214
216
|
"The topic or subject for the AI to write about.":
|
|
215
217
|
"Thema bzw. Gegenstand, über den die KI schreiben soll.",
|
|
218
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
219
|
+
"Diese Zusammenfassung wurde von KI erstellt und kann Fehler enthalten. Überprüfen Sie wichtige Informationen.",
|
|
216
220
|
Title: "Titel",
|
|
217
221
|
"TL;DR": "Kurzfassung",
|
|
218
222
|
tldr: "Kurzfassung",
|
package/src/i18n/en.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const enDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alt Text",
|
|
12
12
|
"An error occurred.": "An error occurred.",
|
|
13
13
|
"An unknown error occurred.": "An unknown error occurred.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.",
|
|
14
16
|
Arabic: "Arabic",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Are you sure you want to reset the conversation?",
|
|
@@ -227,6 +229,8 @@ export const enDict: Record<string, string> = {
|
|
|
227
229
|
"The tone or style for the AI to use.",
|
|
228
230
|
"The topic or subject for the AI to write about.":
|
|
229
231
|
"The topic or subject for the AI to write about.",
|
|
232
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
233
|
+
"This summary was generated by AI and may contain mistakes. Check important information.",
|
|
230
234
|
Title: "Title",
|
|
231
235
|
"TL;DR": "TL;DR",
|
|
232
236
|
tldr: "tldr",
|
package/src/i18n/es.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const esDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Texto alternativo",
|
|
12
12
|
"An error occurred.": "Se produjo un error.",
|
|
13
13
|
"An unknown error occurred.": "Se produjo un error desconocido.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Las respuestas de {name} son generadas por IA y pueden contener errores. Verifica la información importante.",
|
|
14
16
|
Arabic: "árabe",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"¿Seguro que quieres restablecer la conversación?",
|
|
@@ -214,6 +216,8 @@ export const esDict: Record<string, string> = {
|
|
|
214
216
|
"El tono o estilo que utilizará la IA.",
|
|
215
217
|
"The topic or subject for the AI to write about.":
|
|
216
218
|
"El tema o asunto sobre el cual escribirá la IA.",
|
|
219
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
220
|
+
"Este resumen fue generado por IA y puede contener errores. Verifica la información importante.",
|
|
217
221
|
Title: "Título",
|
|
218
222
|
"TL;DR": "Resumen",
|
|
219
223
|
tldr: "Resumen",
|
package/src/i18n/fr.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const frDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Texte alternatif",
|
|
12
12
|
"An error occurred.": "Une erreur s’est produite.",
|
|
13
13
|
"An unknown error occurred.": "Une erreur inconnue s'est produite.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Les réponses de {name} sont générées par l’IA et peuvent contenir des erreurs. Vérifiez les informations importantes.",
|
|
14
16
|
Arabic: "arabe",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Voulez-vous vraiment réinitialiser la conversation ?",
|
|
@@ -214,6 +216,8 @@ export const frDict: Record<string, string> = {
|
|
|
214
216
|
"Le ton ou le style que l'IA doit utiliser.",
|
|
215
217
|
"The topic or subject for the AI to write about.":
|
|
216
218
|
"Le sujet ou le thème sur lequel l'IA doit écrire.",
|
|
219
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
220
|
+
"Ce résumé a été généré par l’IA et peut contenir des erreurs. Vérifiez les informations importantes.",
|
|
217
221
|
Title: "Titre",
|
|
218
222
|
"TL;DR": "TL;DR",
|
|
219
223
|
tldr: "en bref",
|
package/src/i18n/he.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const heDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "טקסט חלופי",
|
|
12
12
|
"An error occurred.": "אירעה שגיאה.",
|
|
13
13
|
"An unknown error occurred.": "אירעה שגיאה לא ידועה.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"התשובות של {name} נוצרות באמצעות בינה מלאכותית ועלולות לכלול טעויות. מומלץ לבדוק מידע חשוב.",
|
|
14
16
|
Arabic: "עֲרָבִית",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"האם אתה בטוח שברצונך לאפס את השיחה?",
|
|
@@ -209,6 +211,8 @@ export const heDict: Record<string, string> = {
|
|
|
209
211
|
"הטון או הסגנון שבו הבינה המלאכותית תשתמש.",
|
|
210
212
|
"The topic or subject for the AI to write about.":
|
|
211
213
|
"הנושא או התחום שעליו הבינה המלאכותית תכתוב.",
|
|
214
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
215
|
+
"הסיכום הזה נוצר באמצעות בינה מלאכותית ועלול לכלול טעויות. מומלץ לבדוק מידע חשוב.",
|
|
212
216
|
Title: "כּוֹתֶרֶת",
|
|
213
217
|
"TL;DR": "בקצרה",
|
|
214
218
|
tldr: "tldr",
|
package/src/i18n/hi.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const hiDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alt टेक्स्ट",
|
|
12
12
|
"An error occurred.": "एक त्रुटि हुई।",
|
|
13
13
|
"An unknown error occurred.": "एक अज्ञात त्रुटि हुई।",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"{name} के उत्तर AI द्वारा तैयार किए जाते हैं और उनमें गलतियाँ हो सकती हैं। महत्वपूर्ण जानकारी की जाँच करें।",
|
|
14
16
|
Arabic: "अरबी",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"क्या आप वाकई बातचीत रीसेट करना चाहते हैं?",
|
|
@@ -212,6 +214,8 @@ export const hiDict: Record<string, string> = {
|
|
|
212
214
|
"एआई द्वारा उपयोग की जाने वाली शैली या लहजा।",
|
|
213
215
|
"The topic or subject for the AI to write about.":
|
|
214
216
|
"एआई द्वारा लिखे जाने वाला विषय या टॉपिक।",
|
|
217
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
218
|
+
"यह सारांश AI द्वारा तैयार किया गया है और इसमें गलतियाँ हो सकती हैं। महत्वपूर्ण जानकारी की जाँच करें।",
|
|
215
219
|
Title: "शीर्षक",
|
|
216
220
|
"TL;DR": "संक्षेप में",
|
|
217
221
|
tldr: "संक्षेप में",
|
package/src/i18n/hu.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const huDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alt szöveg",
|
|
12
12
|
"An error occurred.": "Hiba történt.",
|
|
13
13
|
"An unknown error occurred.": "Ismeretlen hiba történt.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"A {name} válaszait mesterséges intelligencia állítja elő, ezért hibákat tartalmazhatnak. Ellenőrizd a fontos információkat.",
|
|
14
16
|
Arabic: "arab",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Biztosan alaphelyzetbe állítod a beszélgetést?",
|
|
@@ -227,6 +229,8 @@ export const huDict: Record<string, string> = {
|
|
|
227
229
|
"A modell által használandó hangnem vagy stílus.",
|
|
228
230
|
"The topic or subject for the AI to write about.":
|
|
229
231
|
"A téma vagy tárgykör, amiről a modell ír.",
|
|
232
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
233
|
+
"Ezt az összefoglalót mesterséges intelligencia állította össze, ezért hibákat tartalmazhat. Ellenőrizd a fontos információkat.",
|
|
230
234
|
Title: "Cím",
|
|
231
235
|
"TL;DR": "TL;DR",
|
|
232
236
|
tldr: "tldr",
|
package/src/i18n/id.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const idDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Teks Alternatif",
|
|
12
12
|
"An error occurred.": "Terjadi kesalahan.",
|
|
13
13
|
"An unknown error occurred.": "Terjadi kesalahan yang tidak diketahui.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Jawaban dari {name} dibuat oleh AI dan mungkin mengandung kesalahan. Periksa informasi penting.",
|
|
14
16
|
Arabic: "Arab",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Yakin ingin mereset percakapan?",
|
|
@@ -213,6 +215,8 @@ export const idDict: Record<string, string> = {
|
|
|
213
215
|
"Nada atau gaya yang akan digunakan oleh AI.",
|
|
214
216
|
"The topic or subject for the AI to write about.":
|
|
215
217
|
"Topik atau subjek yang akan ditulis oleh AI.",
|
|
218
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
219
|
+
"Ringkasan ini dibuat oleh AI dan mungkin mengandung kesalahan. Periksa informasi penting.",
|
|
216
220
|
Title: "Judul",
|
|
217
221
|
"TL;DR": "Singkatnya",
|
|
218
222
|
tldr: "tldr",
|
package/src/i18n/it.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const itDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Testo alternativo",
|
|
12
12
|
"An error occurred.": "Si è verificato un errore.",
|
|
13
13
|
"An unknown error occurred.": "Si è verificato un errore sconosciuto.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Le risposte di {name} sono generate dall'IA e possono contenere errori. Verifica le informazioni importanti.",
|
|
14
16
|
Arabic: "arabo",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Sei sicuro di voler reimpostare la conversazione?",
|
|
@@ -215,6 +217,8 @@ export const itDict: Record<string, string> = {
|
|
|
215
217
|
"Il tono o lo stile che l'IA deve utilizzare.",
|
|
216
218
|
"The topic or subject for the AI to write about.":
|
|
217
219
|
"L'argomento o il soggetto su cui l'IA deve scrivere.",
|
|
220
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
221
|
+
"Questo riepilogo è stato generato dall'IA e può contenere errori. Verifica le informazioni importanti.",
|
|
218
222
|
Title: "Titolo",
|
|
219
223
|
"TL;DR": "In breve",
|
|
220
224
|
tldr: "breve",
|
package/src/i18n/ja.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const jaDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "代替テキスト",
|
|
12
12
|
"An error occurred.": "エラーが発生しました。",
|
|
13
13
|
"An unknown error occurred.": "不明なエラーが発生しました。",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"{name} の回答はAIによって生成されており、誤りを含む場合があります。重要な情報は確認してください。",
|
|
14
16
|
Arabic: "アラビア語",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"会話をリセットしてもよろしいですか?",
|
|
@@ -213,6 +215,8 @@ export const jaDict: Record<string, string> = {
|
|
|
213
215
|
"The tone or style for the AI to use.": "AI が使用するトーンまたはスタイル。",
|
|
214
216
|
"The topic or subject for the AI to write about.":
|
|
215
217
|
"AI が書き込むトピックまたは主題。",
|
|
218
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
219
|
+
"この要約はAIによって生成されており、誤りを含む場合があります。重要な情報は確認してください。",
|
|
216
220
|
Title: "タイトル",
|
|
217
221
|
"TL;DR": "要約",
|
|
218
222
|
tldr: "要約",
|
package/src/i18n/ko.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const koDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "대체 텍스트",
|
|
12
12
|
"An error occurred.": "오류가 발생했습니다.",
|
|
13
13
|
"An unknown error occurred.": "알 수 없는 오류가 발생했습니다.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"{name}의 답변은 AI가 생성하므로 오류가 있을 수 있습니다. 중요한 정보는 확인하세요.",
|
|
14
16
|
Arabic: "아라비아 말",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"대화를 재설정하시겠습니까?",
|
|
@@ -211,6 +213,8 @@ export const koDict: Record<string, string> = {
|
|
|
211
213
|
"The tone or style for the AI to use.": "AI가 사용할 어조 또는 스타일.",
|
|
212
214
|
"The topic or subject for the AI to write about.":
|
|
213
215
|
"인공지능이 글을 쓸 주제 또는 소재.",
|
|
216
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
217
|
+
"이 요약은 AI가 생성했으며 오류가 있을 수 있습니다. 중요한 정보는 확인하세요.",
|
|
214
218
|
Title: "제목",
|
|
215
219
|
"TL;DR": "요약",
|
|
216
220
|
tldr: "요약",
|
package/src/i18n/nb.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const nbDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alternativ tekst",
|
|
12
12
|
"An error occurred.": "En feil oppstod.",
|
|
13
13
|
"An unknown error occurred.": "Det oppsto en ukjent feil.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Svar fra {name} genereres av KI og kan inneholde feil. Kontroller viktig informasjon.",
|
|
14
16
|
Arabic: "Arabisk",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Er du sikker på at du vil tilbakestille samtalen?",
|
|
@@ -212,6 +214,8 @@ export const nbDict: Record<string, string> = {
|
|
|
212
214
|
"Tonen eller stilen som AI-en skal bruke.",
|
|
213
215
|
"The topic or subject for the AI to write about.":
|
|
214
216
|
"Emnet eller emnet AI-en skal skrive om.",
|
|
217
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
218
|
+
"Dette sammendraget ble generert av KI og kan inneholde feil. Kontroller viktig informasjon.",
|
|
215
219
|
Title: "Tittel",
|
|
216
220
|
"TL;DR": "TL;DR",
|
|
217
221
|
tldr: "tldr",
|
package/src/i18n/nl.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const nlDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alternatieve tekst",
|
|
12
12
|
"An error occurred.": "Er is een fout opgetreden.",
|
|
13
13
|
"An unknown error occurred.": "Er is een onbekende fout opgetreden.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Antwoorden van {name} worden gegenereerd door AI en kunnen fouten bevatten. Controleer belangrijke informatie.",
|
|
14
16
|
Arabic: "Arabisch",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Weet je zeker dat je het gesprek wilt resetten?",
|
|
@@ -213,6 +215,8 @@ export const nlDict: Record<string, string> = {
|
|
|
213
215
|
"De toon of stijl die de AI moet gebruiken.",
|
|
214
216
|
"The topic or subject for the AI to write about.":
|
|
215
217
|
"Het onderwerp waarover de AI moet schrijven.",
|
|
218
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
219
|
+
"Deze samenvatting is gegenereerd door AI en kan fouten bevatten. Controleer belangrijke informatie.",
|
|
216
220
|
Title: "Titel",
|
|
217
221
|
"TL;DR": "Kort samengevat:",
|
|
218
222
|
tldr: "tldr",
|
package/src/i18n/pl.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const plDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Tekst alternatywny",
|
|
12
12
|
"An error occurred.": "Wystąpił błąd.",
|
|
13
13
|
"An unknown error occurred.": "Wystąpił nieznany błąd.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Odpowiedzi od {name} są generowane przez AI i mogą zawierać błędy. Sprawdź ważne informacje.",
|
|
14
16
|
Arabic: "arabski",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Czy na pewno chcesz zresetować rozmowę?",
|
|
@@ -215,6 +217,8 @@ export const plDict: Record<string, string> = {
|
|
|
215
217
|
"Ton lub styl, którego ma używać sztuczna inteligencja.",
|
|
216
218
|
"The topic or subject for the AI to write about.":
|
|
217
219
|
"Temat lub przedmiot, o którym będzie pisać sztuczna inteligencja.",
|
|
220
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
221
|
+
"To podsumowanie zostało wygenerowane przez AI i może zawierać błędy. Sprawdź ważne informacje.",
|
|
218
222
|
Title: "Tytuł",
|
|
219
223
|
"TL;DR": "Krótko mówiąc",
|
|
220
224
|
tldr: "tldr",
|
package/src/i18n/pt.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const ptDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Texto alternativo",
|
|
12
12
|
"An error occurred.": "Ocorreu um erro.",
|
|
13
13
|
"An unknown error occurred.": "Ocorreu um erro desconhecido.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"As respostas de {name} são geradas por IA e podem conter erros. Verifique informações importantes.",
|
|
14
16
|
Arabic: "árabe",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Tem a certeza de que pretende repor a conversa?",
|
|
@@ -211,6 +213,8 @@ export const ptDict: Record<string, string> = {
|
|
|
211
213
|
"The tone or style for the AI to use.": "O tom ou estilo que a IA deve usar.",
|
|
212
214
|
"The topic or subject for the AI to write about.":
|
|
213
215
|
"O tema ou assunto sobre o qual a IA deve escrever.",
|
|
216
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
217
|
+
"Este resumo foi gerado por IA e pode conter erros. Verifique informações importantes.",
|
|
214
218
|
Title: "Título",
|
|
215
219
|
"TL;DR": "Resumindo:",
|
|
216
220
|
tldr: "Resumindo",
|
package/src/i18n/ru.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const ruDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Альтернативный текст",
|
|
12
12
|
"An error occurred.": "Произошла ошибка.",
|
|
13
13
|
"An unknown error occurred.": "Произошла неизвестная ошибка.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Ответы {name} создаются ИИ и могут содержать ошибки. Проверяйте важную информацию.",
|
|
14
16
|
Arabic: "арабский",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Вы уверены, что хотите сбросить беседу?",
|
|
@@ -212,6 +214,8 @@ export const ruDict: Record<string, string> = {
|
|
|
212
214
|
"Тон или стиль, который должен использовать ИИ.",
|
|
213
215
|
"The topic or subject for the AI to write about.":
|
|
214
216
|
"Тема или предмет, о котором должен написать ИИ.",
|
|
217
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
218
|
+
"Это резюме создано ИИ и может содержать ошибки. Проверяйте важную информацию.",
|
|
215
219
|
Title: "Заголовок",
|
|
216
220
|
"TL;DR": "Кратко",
|
|
217
221
|
tldr: "краткое содержание",
|
package/src/i18n/sv.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const svDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alternativtext",
|
|
12
12
|
"An error occurred.": "Ett fel inträffade.",
|
|
13
13
|
"An unknown error occurred.": "Ett okänt fel uppstod.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Svar från {name} genereras av AI och kan innehålla fel. Kontrollera viktig information.",
|
|
14
16
|
Arabic: "Arabiska",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Är du säker på att du vill återställa konversationen?",
|
|
@@ -211,6 +213,8 @@ export const svDict: Record<string, string> = {
|
|
|
211
213
|
"Tonen eller stilen som AI:n ska använda.",
|
|
212
214
|
"The topic or subject for the AI to write about.":
|
|
213
215
|
"Ämnet eller ämnet som AI:n ska skriva om.",
|
|
216
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
217
|
+
"Den här sammanfattningen genererades av AI och kan innehålla fel. Kontrollera viktig information.",
|
|
214
218
|
Title: "Titel",
|
|
215
219
|
"TL;DR": "TL;DR",
|
|
216
220
|
tldr: "tdr",
|
package/src/i18n/th.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const thDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "ข้อความแสดงแทน (Alt Text)",
|
|
12
12
|
"An error occurred.": "เกิดข้อผิดพลาด",
|
|
13
13
|
"An unknown error occurred.": "เกิดข้อผิดพลาดที่ไม่ทราบสาเหตุ",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"คำตอบจาก {name} สร้างโดย AI และอาจมีข้อผิดพลาด โปรดตรวจสอบข้อมูลสำคัญ",
|
|
14
16
|
Arabic: "ภาษาอาหรับ",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"คุณแน่ใจหรือไม่ว่าต้องการรีเซ็ตการสนทนา?",
|
|
@@ -210,6 +212,8 @@ export const thDict: Record<string, string> = {
|
|
|
210
212
|
"The tone or style for the AI to use.": "โทนหรือสไตล์ที่ AI จะใช้",
|
|
211
213
|
"The topic or subject for the AI to write about.":
|
|
212
214
|
"หัวข้อหรือเรื่องที่ AI จะเขียนถึง",
|
|
215
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
216
|
+
"ข้อมูลสรุปนี้สร้างโดย AI และอาจมีข้อผิดพลาด โปรดตรวจสอบข้อมูลสำคัญ",
|
|
213
217
|
Title: "ชื่อ",
|
|
214
218
|
"TL;DR": "สรุปสั้นๆ",
|
|
215
219
|
tldr: "สรุปสั้นๆ",
|
package/src/i18n/tr.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const trDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Alternatif Metin",
|
|
12
12
|
"An error occurred.": "Bir hata oluştu.",
|
|
13
13
|
"An unknown error occurred.": "Bilinmeyen bir hata oluştu.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"{name} yanıtları yapay zekâ tarafından oluşturulur ve hata içerebilir. Önemli bilgileri kontrol edin.",
|
|
14
16
|
Arabic: "Arapça",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Konuşmayı sıfırlamak istediğinizden emin misiniz?",
|
|
@@ -214,6 +216,8 @@ export const trDict: Record<string, string> = {
|
|
|
214
216
|
"Yapay zekanın kullanacağı üslup veya tarz.",
|
|
215
217
|
"The topic or subject for the AI to write about.":
|
|
216
218
|
"Yapay zekanın hakkında yazacağı konu veya başlık.",
|
|
219
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
220
|
+
"Bu özet yapay zekâ tarafından oluşturulmuştur ve hata içerebilir. Önemli bilgileri kontrol edin.",
|
|
217
221
|
Title: "Başlık",
|
|
218
222
|
"TL;DR": "Özetle",
|
|
219
223
|
tldr: "özet",
|
package/src/i18n/ua.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const uaDict: Record<string, string> = {
|
|
|
11
11
|
"Alt Text": "Альтернативний текст",
|
|
12
12
|
"An error occurred.": "Сталася помилка.",
|
|
13
13
|
"An unknown error occurred.": "Сталася невідома помилка.",
|
|
14
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
15
|
+
"Відповіді від {name} створюються ШІ та можуть містити помилки. Перевіряйте важливу інформацію.",
|
|
14
16
|
Arabic: "Арабська",
|
|
15
17
|
"Are you sure you want to reset the conversation?":
|
|
16
18
|
"Ви впевнені, що хочете скинути розмову?",
|
|
@@ -213,6 +215,8 @@ export const uaDict: Record<string, string> = {
|
|
|
213
215
|
"Тон або стиль, який використовуватиме ШІ.",
|
|
214
216
|
"The topic or subject for the AI to write about.":
|
|
215
217
|
"Тема або предмет, про яку має написати ШІ.",
|
|
218
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
219
|
+
"Цей підсумок створено ШІ, тому він може містити помилки. Перевіряйте важливу інформацію.",
|
|
216
220
|
Title: "Назва",
|
|
217
221
|
"TL;DR": "Коротко",
|
|
218
222
|
tldr: "tldr",
|
package/src/i18n/zh.ts
CHANGED
|
@@ -10,6 +10,8 @@ export const zhDict: Record<string, string> = {
|
|
|
10
10
|
"Alt Text": "替代文字",
|
|
11
11
|
"An error occurred.": "发生错误。",
|
|
12
12
|
"An unknown error occurred.": "发生未知错误。",
|
|
13
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.":
|
|
14
|
+
"{name} 的回答由 AI 生成,可能包含错误。请核实重要信息。",
|
|
13
15
|
Arabic: "阿拉伯",
|
|
14
16
|
"Are you sure you want to reset the conversation?": "确定要重置对话吗?",
|
|
15
17
|
"As-Is": "不变",
|
|
@@ -205,6 +207,8 @@ export const zhDict: Record<string, string> = {
|
|
|
205
207
|
"The tone or style for the AI to use.": "人工智能使用的语气或风格。",
|
|
206
208
|
"The topic or subject for the AI to write about.":
|
|
207
209
|
"人工智能要撰写的主题或题目。",
|
|
210
|
+
"This summary was generated by AI and may contain mistakes. Check important information.":
|
|
211
|
+
"此摘要由 AI 生成,可能包含错误。请核实重要信息。",
|
|
208
212
|
Title: "标题",
|
|
209
213
|
"TL;DR": "简述",
|
|
210
214
|
tldr: "太长不看",
|
package/src/styles/ai-kit-ui.css
CHANGED
|
@@ -208,6 +208,13 @@
|
|
|
208
208
|
background-color: transparent;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
.ai-generated-content-disclosure {
|
|
212
|
+
font-size: 0.75rem;
|
|
213
|
+
line-height: 1.4;
|
|
214
|
+
opacity: 0.78;
|
|
215
|
+
text-align: center;
|
|
216
|
+
}
|
|
217
|
+
|
|
211
218
|
.ai-feature-title-icon,
|
|
212
219
|
.doc-search-title-icon {
|
|
213
220
|
width: 24px;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import ts from "typescript";
|
|
7
|
+
|
|
8
|
+
const CHATBOT_DISCLOSURE =
|
|
9
|
+
"Answers from {name} are generated by AI and may contain mistakes. Check important information.";
|
|
10
|
+
const DOC_SEARCH_DISCLOSURE =
|
|
11
|
+
"This summary was generated by AI and may contain mistakes. Check important information.";
|
|
12
|
+
|
|
13
|
+
const importTypeScript = async (fileUrl: URL) => {
|
|
14
|
+
const source = await fs.readFile(fileUrl, "utf8");
|
|
15
|
+
const compiled = ts.transpileModule(source, {
|
|
16
|
+
compilerOptions: {
|
|
17
|
+
module: ts.ModuleKind.ESNext,
|
|
18
|
+
target: ts.ScriptTarget.ES2022,
|
|
19
|
+
},
|
|
20
|
+
}).outputText;
|
|
21
|
+
return import(
|
|
22
|
+
`data:text/javascript;base64,${Buffer.from(compiled).toString("base64")}`
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
test("formats every chatbot name placeholder", async () => {
|
|
27
|
+
const disclosures = await importTypeScript(
|
|
28
|
+
new URL("../../core/src/ai-disclosures.ts", import.meta.url),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
assert.equal(disclosures.DEFAULT_CHATBOT_AI_DISCLOSURE, CHATBOT_DISCLOSURE);
|
|
32
|
+
assert.equal(
|
|
33
|
+
disclosures.formatAiDisclosure("{name}: ask {name}", "Support Bot"),
|
|
34
|
+
"Support Bot: ask Support Bot",
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("all supported languages contain alphabetized AI disclosures", async () => {
|
|
39
|
+
const directory = fileURLToPath(new URL("../src/i18n", import.meta.url));
|
|
40
|
+
const files = (await fs.readdir(directory))
|
|
41
|
+
.filter((file) => file.endsWith(".ts") && file !== "index.ts")
|
|
42
|
+
.sort();
|
|
43
|
+
|
|
44
|
+
assert.equal(files.length, 22);
|
|
45
|
+
|
|
46
|
+
for (const file of files) {
|
|
47
|
+
const module = await importTypeScript(
|
|
48
|
+
new URL(`../src/i18n/${file}`, import.meta.url),
|
|
49
|
+
);
|
|
50
|
+
const dictionary = Object.values(module).find(
|
|
51
|
+
(value) => typeof value === "object" && value !== null,
|
|
52
|
+
) as Record<string, string> | undefined;
|
|
53
|
+
|
|
54
|
+
assert.ok(dictionary, `${file} must export a dictionary`);
|
|
55
|
+
assert.ok(
|
|
56
|
+
dictionary[CHATBOT_DISCLOSURE]?.includes("{name}"),
|
|
57
|
+
`${file} must preserve the chatbot name placeholder`,
|
|
58
|
+
);
|
|
59
|
+
assert.ok(
|
|
60
|
+
dictionary[DOC_SEARCH_DISCLOSURE]?.trim(),
|
|
61
|
+
`${file} must translate the DocSearch disclosure`,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const keys = Object.keys(dictionary);
|
|
65
|
+
assert.equal(
|
|
66
|
+
keys.indexOf(CHATBOT_DISCLOSURE),
|
|
67
|
+
keys.indexOf("An unknown error occurred.") + 1,
|
|
68
|
+
`${file} must keep the chatbot disclosure alphabetized`,
|
|
69
|
+
);
|
|
70
|
+
assert.equal(
|
|
71
|
+
keys.indexOf(DOC_SEARCH_DISCLOSURE),
|
|
72
|
+
keys.indexOf("Title") - 1,
|
|
73
|
+
`${file} must keep the DocSearch disclosure alphabetized`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
});
|