|
10 | 10 | <body> |
11 | 11 | <!-- <flowise-fullchatbot style="font-family: 'Open Sans', sans-serif !important;"></flowise-fullchatbot> --> |
12 | 12 | <script type="module"> |
13 | | - import Chatbot from "https://cdn.jsdelivr.net/gh/intershop/ai-flowise-chat-embed@website/docs-intershop/dist/web.js" |
14 | | - //import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js" |
15 | | - const welcome = { |
16 | | - en: "Hi! Need help with Intershop documentation? I'm the AI assistant specializing in the latest versions of ICM, IOM, CEC, IAC, SMC, and OMA. Feel free to ask me your questions.", |
17 | | - fr: "Bonjour ! Besoin d'aide avec la documentation Intershop ? Je suis l'assistant IA spécialisé dans les dernières versions d'ICM, IOM, CEC, IAC, SMC et OMA. N'hésitez pas à me poser vos questions.", |
18 | | - de: "Hallo! Brauchen Sie Hilfe mit der Intershop-Dokumentation? Ich bin der KI-Assistent, der auf die neuesten Versionen von ICM, IOM, CEC, IAC, SMC und OMA spezialisiert ist. Stellen Sie mir gerne Ihre Fragen." |
19 | | - }; |
20 | | - var welcomeMessage=welcome.en; |
21 | | - Chatbot.init({ |
22 | | - chatflowid: "8fba968e-f8ed-4401-8a9f-57eaa5f45535", |
23 | | - apiHost: "https://ish-flowise-app.azurewebsites.net", |
24 | | - chatflowConfig: { |
25 | | - vars: { |
26 | | - currentUrl: window.location.href, |
27 | | - lang: (() => { |
| 13 | +//import Chatbot from 'https://cdn.jsdelivr.net/gh/intershop/ai-flowise-chat-embed@website/docs-intershop/dist/web.js'; |
| 14 | +//import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js" |
| 15 | +import chatWindow from 'http://localhost:5678/web.js' |
| 16 | +const welcome = { |
| 17 | + en: "Hi! Need help with Intershop documentation? I'm the AI assistant specializing in the latest versions of ICM, IOM, CEC, IAC, SMC, and OMA. Feel free to ask me your questions.", |
| 18 | + fr: "Bonjour ! Besoin d'aide avec la documentation Intershop ? Je suis l'assistant IA spécialisé dans les dernières versions d'ICM, IOM, CEC, IAC, SMC et OMA. N'hésitez pas à me poser vos questions.", |
| 19 | + de: 'Hallo! Brauchen Sie Hilfe mit der Intershop-Dokumentation? Ich bin der AI-Assistent, der auf die neuesten Versionen von ICM, IOM, CEC, IAC, SMC und OMA spezialisiert ist. Stellen Sie mir gerne Ihre Fragen.', |
| 20 | +}; |
| 21 | +var welcomeMessage = welcome.en; |
28 | 22 |
|
| 23 | +Chatbot.init({ |
| 24 | + chatflowid: '8fba968e-f8ed-4401-8a9f-57eaa5f45535', |
| 25 | + apiHost: 'https://ish-flowise-app.azurewebsites.net', |
| 26 | + chatflowConfig: { |
| 27 | + vars: { |
| 28 | + currentUrl: window.location.href, |
| 29 | + lang: (() => { |
| 30 | + function getLangFromUrl(url) { |
| 31 | + const validLangCodes = ['en', 'de', 'fr']; |
| 32 | + const match = url.match(/\/([a-z]{2})(\/|$)/); // Slightly simplified regex |
29 | 33 |
|
30 | | - function getLangFromUrl(url) { |
31 | | - const validLangCodes = ["en", "de", "fr"]; |
32 | | - const match = url.match(/\/([a-z]{2})(\/|$)/); // Slightly simplified regex |
| 34 | + return match ? (validLangCodes.includes(match[1]) ? match[1] : null) : null; |
| 35 | + } |
| 36 | + const url = window.location.href; |
| 37 | + var extracted_lang = getLangFromUrl(url) || 'en'; |
| 38 | + console.log(extracted_lang); |
| 39 | + welcomeMessage = welcome[extracted_lang] || welcome.en; // Default to English if the language key is missing. |
| 40 | + })(), |
| 41 | + service: (() => { |
| 42 | + // Access the current URL from the vars |
| 43 | + // const currentUrl = 'https://docs.intershop.com/iap/olh/cec/en/'; |
| 44 | + |
| 45 | + // Function to extract the service identifier |
| 46 | + function getServiceFromUrl(url) { |
| 47 | + // Match the pattern after the domain or path |
| 48 | + const regex = /(?:docs\.intershop\.com|file:\/\/\/D:\/documentation-online-help-(icm|iap|iom)\/src)/; |
| 49 | + const regex2 = /(?:docs\.intershop\.com|file:\/\/\/D:\/(documentation-online-help-icm|documentation-online-help-iap)\/src)\/(\w+)/; |
| 50 | + const match = url.match(regex); |
| 51 | + console.log(match); |
| 52 | + // Return the matched group if found; otherwise, default to 'icm' |
| 53 | + return match ? match[1] : 'icm'; |
| 54 | + } |
33 | 55 |
|
34 | | - return match ? (validLangCodes.includes(match[1]) ? match[1] : null) : null; |
35 | | - } |
36 | | - const url = window.location.href; |
37 | | - var extracted_lang=getLangFromUrl(url)|| "de"; |
38 | | - console.log(extracted_lang) |
39 | | - welcomeMessage = welcome[extracted_lang] || welcome.en; // Default to English if the language key is missing. |
| 56 | + const url = window.location.href; |
| 57 | + // Execute the function to extract the service |
| 58 | + return getServiceFromUrl('https://docs.intershop.com/icm/latest/olh/icm/de/'); |
| 59 | + })(), |
| 60 | + }, |
| 61 | + }, |
| 62 | + observersConfig: {}, |
| 63 | + theme: { |
| 64 | + button: { |
| 65 | + backgroundColor: '#008e87', |
| 66 | + right: 20, |
| 67 | + bottom: 20, |
| 68 | + size: 48, // small | medium | large | number |
| 69 | + dragAndDrop: true, |
| 70 | + iconColor: 'white', |
| 71 | + autoWindowOpen: { |
| 72 | + autoOpen: true, //parameter to control automatic window opening |
| 73 | + openDelay: 2, // Optional parameter for delay time in seconds |
| 74 | + autoOpenOnMobile: false, //parameter to control automatic window opening in mobile |
| 75 | + }, |
| 76 | + }, |
40 | 77 |
|
41 | | - })(), |
42 | | - service: (() => { |
43 | | - // Access the current URL from the vars |
44 | | - // const currentUrl = 'https://docs.intershop.com/iap/olh/cec/en/'; |
| 78 | + customCSS: ``, |
| 79 | + chatWindow: { |
| 80 | + showTitle: true, |
| 81 | + showAgentMessages: true, |
| 82 | + title: 'Intershop Documentation Copilot', |
| 83 | + //titleAvatarSrc: " https://amisamyra99.github.io/chatbot-flowise-js-hosting/images/bot24.png", |
45 | 84 |
|
46 | | - // Function to extract the service identifier |
47 | | - function getServiceFromUrl(url) { |
48 | | - // Match the pattern after the domain or path |
49 | | - const regex = /(?:docs\.intershop\.com|file:\/\/\/D:\/documentation-online-help-(icm|iap|iom)\/src)/; |
50 | | - const regex2 = /(?:docs\.intershop\.com|file:\/\/\/D:\/(documentation-online-help-icm|documentation-online-help-iap)\/src)\/(\w+)/; |
51 | | - const match = url.match(regex); |
52 | | - console.log(match) |
53 | | - // Return the matched group if found; otherwise, default to 'icm' |
54 | | - return match ? match[1] : 'icm'; |
55 | | - } |
| 85 | + welcomeMessage: welcomeMessage, |
56 | 86 |
|
57 | | - const url = window.location.href; |
58 | | - // Execute the function to extract the service |
59 | | - return getServiceFromUrl('https://docs.intershop.com/icm/latest/olh/icm/de/'); |
60 | | - })() |
61 | | - } |
| 87 | + errorMessage: 'It seems that we are encountering a problem.', |
| 88 | + backgroundColor: '#ffffff', |
| 89 | + //set a pixel value |
| 90 | + //height: 1000, |
| 91 | + //width: 600, |
| 92 | + fontSize: 16, |
| 93 | + clearChatOnReload: false, |
| 94 | + sourceDocsTitle: 'Sources:', |
| 95 | + botMessage: { |
| 96 | + backgroundColor: '#f7f8ff', |
| 97 | + textColor: '#303235', |
| 98 | + // showAvatar: true, |
| 99 | + //avatarSrc: 'https://amisamyra99.github.io/chatbot-flowise-js-hosting/images/bot24.png', |
62 | 100 | }, |
63 | | - observersConfig: {}, |
64 | | - theme: { |
65 | | - button: { |
66 | | - backgroundColor: '#008e87', |
67 | | - right: 20, |
68 | | - bottom: 20, |
69 | | - size: 48, // small | medium | large | number |
70 | | - dragAndDrop: true, |
71 | | - iconColor: 'white', |
72 | | - autoWindowOpen: { |
73 | | - autoOpen: true, //parameter to control automatic window opening |
74 | | - openDelay: 2, // Optional parameter for delay time in seconds |
75 | | - autoOpenOnMobile: false, //parameter to control automatic window opening in mobile |
76 | | - }, |
77 | | - }, |
78 | | - |
79 | | - customCSS: ``, |
80 | | - chatWindow: { |
81 | | - showTitle: true, |
82 | | - showAgentMessages: true, |
83 | | - title: 'Intershop Documentation Chatbot', |
84 | | - //titleAvatarSrc: " https://amisamyra99.github.io/chatbot-flowise-js-hosting/images/bot24.png", |
| 101 | + userMessage: { |
| 102 | + backgroundColor: '#008e87', |
| 103 | + textColor: '#ffffff', |
| 104 | + //showAvatar: true, |
| 105 | + //avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png', |
| 106 | + }, |
| 107 | + textInput: { |
| 108 | + placeholder: 'Type your question', |
| 109 | + backgroundColor: '#ffffff', |
| 110 | + textColor: '#303235', |
| 111 | + sendButtonColor: '#008e87', |
| 112 | + maxChars: 50, |
| 113 | + maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.', |
| 114 | + autoFocus: true, |
| 115 | + sendMessageSound: false, |
| 116 | + receiveMessageSound: false, |
| 117 | + }, |
| 118 | + feedback: { |
| 119 | + color: '#303235', |
| 120 | + backgroundColor: '#ffffff', |
| 121 | + buttonColor: '#ffffff' |
85 | 122 |
|
86 | | - welcomeMessage: welcomeMessage, |
87 | | - |
88 | | - |
89 | | - errorMessage: 'It seems that we are encountering a problem.', |
90 | | - backgroundColor: '#ffffff', |
91 | | - //set a pixel value |
92 | | - height: 700, |
93 | | - width: 600, |
94 | | - fontSize: 16, |
95 | | - clearChatOnReload: false, |
96 | | - sourceDocsTitle: 'Sources:', |
97 | | - botMessage: { |
98 | | - backgroundColor: '#f7f8ff', |
99 | | - textColor: '#303235', |
100 | | - // showAvatar: true, |
101 | | - //avatarSrc: 'https://amisamyra99.github.io/chatbot-flowise-js-hosting/images/bot24.png', |
102 | | - }, |
103 | | - userMessage: { |
104 | | - backgroundColor: '#008e87', |
105 | | - textColor: '#ffffff', |
106 | | - //showAvatar: true, |
107 | | - //avatarSrc: 'https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png', |
108 | | - }, |
109 | | - textInput: { |
110 | | - placeholder: 'Type your question', |
111 | | - backgroundColor: '#ffffff', |
112 | | - textColor: '#303235', |
113 | | - sendButtonColor: '#008e87', |
114 | | - maxChars: 50, |
115 | | - maxCharsWarningMessage: 'You exceeded the characters limit. Please input less than 50 characters.', |
116 | | - autoFocus: true, |
117 | | - sendMessageSound: false, |
118 | | - receiveMessageSound: false, |
119 | | - }, |
120 | | - feedback: { |
121 | | - color: '#303235', |
122 | | - backgroundColor: '#008e87', |
123 | | - }, |
124 | | - footer: { |
125 | | - textColor: '#303235', |
126 | | - text: 'Powered by', |
127 | | - company: 'Intershop Gmbh', |
128 | | - companyLink: 'https://docs.intershop.com/index.php', |
129 | | - }, |
130 | | - }, |
131 | | - disclaimer: { |
132 | | - title: 'Disclaimer', |
133 | | - message: 'By using this chatbot, you agree to the <a target="_blank" style="color: #008e87;" href="https://www.intershop.com/en/privacy-policy" >Terms & Condition</a>', |
134 | | - textColor: 'black', |
135 | | - buttonColor: '#008e87', |
136 | | - buttonText: 'Start Chatting', |
137 | | - buttonTextColor: 'white', |
138 | | - blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)', //The color of the blurred background that overlays the chat interface |
139 | | - backgroundColor: 'white', |
140 | | - } |
141 | | - } |
142 | | - }); |
| 123 | + }, |
| 124 | + footer: { |
| 125 | + textColor: '#303235', |
| 126 | + text: 'Powered by', |
| 127 | + company: 'Intershop', |
| 128 | + companyLink: 'https://docs.intershop.com/index.php', |
| 129 | + }, |
| 130 | + }, |
| 131 | + disclaimer: { |
| 132 | + title: 'Disclaimer', |
| 133 | + message: |
| 134 | + 'By using this chatbot, you agree to the <a target="_blank" style="color: #008e87;" href="https://www.intershop.com/en/privacy-policy" >Terms & Condition</a>', |
| 135 | + textColor: 'black', |
| 136 | + buttonColor: '#008e87', |
| 137 | + buttonText: 'Start Chatting', |
| 138 | + buttonTextColor: 'white', |
| 139 | + blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)', //The color of the blurred background that overlays the chat interface |
| 140 | + backgroundColor: 'white', |
| 141 | + }, |
| 142 | + }, |
| 143 | +}); |
143 | 144 |
|
144 | 145 | </script> |
145 | 146 | </body> |
|
0 commit comments