Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAI-134] Hotfix/chatbot/cai 134 unauthenticated user chatbot message #1113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silent-bobcats-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": minor
---

Guest chatbot message
11 changes: 9 additions & 2 deletions apps/nextjs-website/src/components/molecules/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { compact } from 'lodash';
import { useTranslations } from 'next-intl';
import { ChatCatbotWriting } from '@/components/atoms/ChatChatbotWriting/ChatChatbotWriting';
import { ChatSkeleton } from '@/components/atoms/ChatSkeleton/ChatSkeleton';
import { useUser } from '@/helpers/user.helper';
import { baseUrl } from '@/config';
import AlertPart from '@/components/atoms/AlertPart/AlertPart';
import { ChatbotErrorsType } from '@/helpers/chatbot.helper';

Expand All @@ -35,9 +37,14 @@ const Chat = ({
const t = useTranslations();
const { palette } = useTheme();
const [instantScroll, setInstantScroll] = useState(scrollToBottom);
const { user } = useUser();
const messages = useMemo(
() => [
firstMessage(t('chatBot.welcomeMessage')),
firstMessage(
user
? t('chatBot.welcomeMessage')
: t('chatBot.guestMessage', { host: baseUrl })
),
...compact(
queries.flatMap((q) => [
q.question && q.queriedAt
Expand All @@ -61,7 +68,7 @@ const Chat = ({
])
),
],
[queries, t]
[queries, t, user]
) satisfies Message[];

const scrollRef = useRef<HTMLDivElement>(null);
Expand Down
1 change: 1 addition & 0 deletions apps/nextjs-website/src/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@
"feedbackGiven": "Feedback\nregistrato",
"copied": "Copiato",
"welcomeMessage": "**Benvenuto nel Dev Portal!**\n\nSono _Discovery_, il tuo assistente virtuale per la documentazione tecnica. Posso aiutarti con informazioni su API, guide, e altro.\n\n_Nota_: Discovery è in versione beta, quindi alcune risposte potrebbero non essere accurate. Verifica sempre le informazioni importanti con la documentazione ufficiale.\n\nCome posso aiutarti oggi?",
"guestMessage": "Ciao sono _Discovery_ , il chatbot di DevPortal!\n\nPosso aiutarti a trovare in modo semplice e rapido le informazioni presenti nella documentazione del Portale.\n\nPer poter accedere al servizio, ti invito a [iscriverti a PagoPA DevPortal]({host}/auth/login)",
"errors": {
"title": "Errore",
"serviceDown": "Il chatbot al momento non è disponibile. Riprovare più tardi.",
Expand Down
Loading