@@ -45,16 +45,15 @@ export default function Chatbot() {
45
45
const response = await fetch ( "/api/chat" , {
46
46
method : "POST" ,
47
47
body : JSON . stringify ( `
48
-
48
+ As an AI bot for a travel airline,
49
+ your purpose is to answer questions related to flights and traveling.
50
+ Act as customer representative.
51
+ Only answer queries related to traveling and airlines.
52
+ Remove quotation in response.
49
53
Limit response to 100 characters.
50
54
Here is the user prompt: ${ userInput } .` ) ,
51
55
} ) ;
52
56
53
- // As an AI bot for a travel airline,
54
- // your purpose is to answer questions related to flights and traveling.
55
- // Act as customer representative.
56
- // Only answer queries related to traveling and airlines.
57
- // Remove quotation in response.
58
57
59
58
60
59
const data = await response . json ( ) ;
@@ -74,7 +73,6 @@ export default function Chatbot() {
74
73
content : aiAnswer ,
75
74
id : uuidv4 ( ) . slice ( 0 , 4 ) ,
76
75
} ;
77
- //TODO: remove loader if you get don't aiAnswer
78
76
79
77
if ( aiAnswer === undefined ) {
80
78
assistantMessage . content = "I'm sorry. Please try again."
@@ -90,10 +88,11 @@ export default function Chatbot() {
90
88
useEffect ( ( ) => {
91
89
console . log ( "aiChatBot" , flags [ "ai-chatbot" ] )
92
90
console . log ( messages ) ;
93
- console . log ( "aiChaaweftBot" , client ?. getContext ( ) ) ;
94
91
} , [ messages ] ) ;
95
92
96
- const surveyResponseNotification = ( ) => {
93
+ const surveyResponseNotification = ( surveyResponse :string ) => {
94
+ client ?. track ( surveyResponse , client . getContext ( ) ) ;
95
+ client ?. flush ( ) ;
97
96
toast ( {
98
97
title : `Thank you for your response!` ,
99
98
wrapperStyle : "bg-green-600 text-white font-sohne text-base border-none" ,
@@ -135,34 +134,32 @@ export default function Chatbot() {
135
134
title = "How was our service today?"
136
135
className = "rounded-full bg-[#55efc4] text-gray-900 hover:bg-[#00b894] dark:bg-[#55efc4] dark:text-gray-900 dark:hover:bg-[#00b894]"
137
136
onClick = { ( ) => {
138
- surveyResponseNotification ( ) ;
139
- client ?. track ( "ai-chatbot-good-service" , client . getContext ( ) ) ;
137
+ surveyResponseNotification ( "AI chatbot good service" ) ;
140
138
} }
141
139
>
142
140
< SmileIcon className = "h-6 w-6" />
143
141
< span className = "sr-only" > Good</ span >
144
142
</ Button >
145
- < Button
143
+ { /* <Button
146
144
variant="ghost"
147
145
size="icon"
148
146
title="How was our service today?"
149
147
className="rounded-full bg-[#ffeaa7] text-gray-900 hover:bg-[#fdcb6e] dark:bg-[#ffeaa7] dark:text-gray-900 dark:hover:bg-[#fdcb6e]"
150
- onClick = { ( ) => {
151
- surveyResponseNotification ( ) ;
152
- client ?. track ( "ai-chatbot-neutral-service" , client . getContext ( ) ) ;
148
+ onClick={(e ) => {
149
+ surveyResponseNotification("AI Chatbot Netural Service" );
150
+ // client?.track("ai-chatbot-neutral-service", client.getContext());
153
151
}}
154
152
>
155
153
<MehIcon className="h-6 w-6" />
156
154
<span className="sr-only">Neutral</span>
157
- </ Button >
155
+ </Button> */ }
158
156
< Button
159
157
variant = "ghost"
160
158
size = "icon"
161
159
title = "How was our service today?"
162
160
className = "rounded-full bg-[#ff7675] text-gray-50 hover:bg-[#d63031] dark:bg-[#ff7675] dark:text-gray-50 dark:hover:bg-[#d63031]"
163
161
onClick = { ( ) => {
164
- surveyResponseNotification ( ) ;
165
- client ?. track ( "ai-chatbot-bad-service" , client . getContext ( ) ) ;
162
+ surveyResponseNotification ( "AI Chatbot Bad Service" ) ;
166
163
} }
167
164
>
168
165
< FrownIcon className = "h-6 w-6" />
@@ -347,24 +344,24 @@ function FrownIcon(props) {
347
344
) ;
348
345
}
349
346
350
- function MehIcon ( props ) {
351
- return (
352
- < svg
353
- { ...props }
354
- xmlns = "http://www.w3.org/2000/svg"
355
- width = "24"
356
- height = "24"
357
- viewBox = "0 0 24 24"
358
- fill = "none"
359
- stroke = "currentColor"
360
- strokeWidth = "2"
361
- strokeLinecap = "round"
362
- strokeLinejoin = "round"
363
- >
364
- < circle cx = "12" cy = "12" r = "10" />
365
- < line x1 = "8" x2 = "16" y1 = "15" y2 = "15" />
366
- < line x1 = "9" x2 = "9.01" y1 = "9" y2 = "9" />
367
- < line x1 = "15" x2 = "15.01" y1 = "9" y2 = "9" />
368
- </ svg >
369
- ) ;
370
- }
347
+ // function MehIcon(props) {
348
+ // return (
349
+ // <svg
350
+ // {...props}
351
+ // xmlns="http://www.w3.org/2000/svg"
352
+ // width="24"
353
+ // height="24"
354
+ // viewBox="0 0 24 24"
355
+ // fill="none"
356
+ // stroke="currentColor"
357
+ // strokeWidth="2"
358
+ // strokeLinecap="round"
359
+ // strokeLinejoin="round"
360
+ // >
361
+ // <circle cx="12" cy="12" r="10" />
362
+ // <line x1="8" x2="16" y1="15" y2="15" />
363
+ // <line x1="9" x2="9.01" y1="9" y2="9" />
364
+ // <line x1="15" x2="15.01" y1="9" y2="9" />
365
+ // </svg>
366
+ // );
367
+ // }
0 commit comments