@clubmed/usg-chat-ui 1.3.0 → 1.4.0
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/assets/style.css +1 -1
- package/config/chatLabels.d.ts +40 -0
- package/organisms/chat/Chat.js +65 -64
- package/organisms/chat/Chat.js.map +1 -1
- package/organisms/chat/ChatHeader.d.ts +1 -2
- package/organisms/chat/ChatHeader.js +15 -20
- package/organisms/chat/ChatHeader.js.map +1 -1
- package/organisms/chat/ChatHeader.test.js +12 -12
- package/organisms/chat/ChatHeader.test.js.map +1 -1
- package/organisms/chat/ChatSettingsButton.js +6 -5
- package/organisms/chat/ChatSettingsButton.js.map +1 -1
- package/organisms/chat/ConversationSidebar.js +8 -8
- package/organisms/chat/ConversationSidebar.js.map +1 -1
- package/organisms/chat/MessageActions.js +157 -133
- package/organisms/chat/MessageActions.js.map +1 -1
- package/organisms/chat/PromptComposer.js +19 -14
- package/organisms/chat/PromptComposer.js.map +1 -1
- package/organisms/chat/SidebarToggleButton.d.ts +2 -1
- package/organisms/chat/SidebarToggleButton.js +13 -12
- package/organisms/chat/SidebarToggleButton.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as r, Fragment as f, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { useState as i } from "react";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { useToast as
|
|
6
|
-
import { useCanvasStore as
|
|
7
|
-
import { useChatApiClient as
|
|
8
|
-
import { Modal as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { Textarea as
|
|
11
|
-
import { useChatLabels as
|
|
12
|
-
import { C as
|
|
13
|
-
import { C as
|
|
14
|
-
import { R as
|
|
15
|
-
import { M as
|
|
16
|
-
import { c as
|
|
17
|
-
import { X as
|
|
4
|
+
import { cn as n } from "../../utils/cn.js";
|
|
5
|
+
import { useToast as de } from "../../molecules/Notifications/useToast.js";
|
|
6
|
+
import { useCanvasStore as me } from "../../utils/canvas-store.js";
|
|
7
|
+
import { useChatApiClient as ue } from "../../contexts/ChatContext.js";
|
|
8
|
+
import { Modal as ge } from "../../molecules/Modals/Modal.js";
|
|
9
|
+
import { Button as A } from "../../molecules/Buttons/Button.js";
|
|
10
|
+
import { Textarea as pe } from "../../molecules/Textareas/Textarea.js";
|
|
11
|
+
import { useChatLabels as fe } from "../../contexts/ChatLabelsContext.js";
|
|
12
|
+
import { C as be } from "../../chunks/check.js";
|
|
13
|
+
import { C as he } from "../../chunks/copy.js";
|
|
14
|
+
import { R as xe } from "../../chunks/refresh-cw.js";
|
|
15
|
+
import { M as ve } from "../../chunks/maximize-2.js";
|
|
16
|
+
import { c as D } from "../../chunks/createLucideIcon.js";
|
|
17
|
+
import { X as ke } from "../../chunks/x.js";
|
|
18
18
|
/**
|
|
19
19
|
* @license lucide-react v0.545.0 - ISC
|
|
20
20
|
*
|
|
21
21
|
* This source code is licensed under the ISC license.
|
|
22
22
|
* See the LICENSE file in the root directory of this source tree.
|
|
23
23
|
*/
|
|
24
|
-
const
|
|
24
|
+
const Te = [
|
|
25
25
|
["path", { d: "M17 14V2", key: "8ymqnk" }],
|
|
26
26
|
[
|
|
27
27
|
"path",
|
|
@@ -30,14 +30,14 @@ const te = [
|
|
|
30
30
|
key: "m61m77"
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
|
-
],
|
|
33
|
+
], S = D("thumbs-down", Te);
|
|
34
34
|
/**
|
|
35
35
|
* @license lucide-react v0.545.0 - ISC
|
|
36
36
|
*
|
|
37
37
|
* This source code is licensed under the ISC license.
|
|
38
38
|
* See the LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
|
-
const
|
|
40
|
+
const Ce = [
|
|
41
41
|
["path", { d: "M7 10v12", key: "1qc93n" }],
|
|
42
42
|
[
|
|
43
43
|
"path",
|
|
@@ -46,85 +46,109 @@ const oe = [
|
|
|
46
46
|
key: "emmmcr"
|
|
47
47
|
}
|
|
48
48
|
]
|
|
49
|
-
],
|
|
50
|
-
function
|
|
49
|
+
], E = D("thumbs-up", Ce);
|
|
50
|
+
function je({
|
|
51
51
|
content: b,
|
|
52
|
-
messageId:
|
|
53
|
-
storyId:
|
|
52
|
+
messageId: B,
|
|
53
|
+
storyId: R,
|
|
54
54
|
onRegenerate: h,
|
|
55
|
-
responseType:
|
|
56
|
-
canvasData:
|
|
57
|
-
className:
|
|
55
|
+
responseType: d,
|
|
56
|
+
canvasData: m,
|
|
57
|
+
className: P
|
|
58
58
|
}) {
|
|
59
|
-
const [
|
|
59
|
+
const [z, x] = i(!1), [s, O] = i(null), [_, u] = i(!1), [a, v] = i(null), [g, p] = i(""), [c, k] = i(!1), { toast: l } = de(), { openApiDocsCanvas: j } = me(), I = ue(), { get: e } = fe(), T = e("messageCopyAriaLabel", "Copier le message"), C = e("messageRegenerateAriaLabel", "Régénérer la réponse"), y = e("messageOpenCanvasAriaLabel", "Ouvrir Canva"), w = e("messageThumbsUpAriaLabel", "Réponse utile"), N = e("messageThumbsDownAriaLabel", "Réponse non utile"), U = e("messageCloseFeedbackAriaLabel", "Fermer"), H = e("messageCopyButtonText", "Copier"), V = e("messageCopySuccessText", "Copié"), q = e("messageCopyToastTitle", "Copié"), G = e(
|
|
60
|
+
"messageCopyToastDescription",
|
|
61
|
+
"Message copié dans le presse-papiers"
|
|
62
|
+
), Z = e("messageCopyErrorTitle", "Erreur"), X = e(
|
|
63
|
+
"messageCopyErrorDescription",
|
|
64
|
+
"Impossible de copier le message"
|
|
65
|
+
), $ = e("messageRegenerateButtonText", "Régénérer"), J = e("messageOpenCanvasButtonText", "Ouvrir Canva"), K = e(
|
|
66
|
+
"messageFeedbackPositiveTitle",
|
|
67
|
+
"Merci pour votre feedback !"
|
|
68
|
+
), Q = e(
|
|
69
|
+
"messageFeedbackNegativeTitle",
|
|
70
|
+
"Aidez-nous à nous améliorer"
|
|
71
|
+
), W = e(
|
|
72
|
+
"messageFeedbackPromptText",
|
|
73
|
+
"Un commentaire pour nous aider ?"
|
|
74
|
+
), Y = e(
|
|
75
|
+
"messageFeedbackTextareaPlaceholder",
|
|
76
|
+
"Votre commentaire (optionnel)..."
|
|
77
|
+
), ee = e("messageFeedbackSkipButtonText", "Passer"), te = e("messageFeedbackSubmitButtonText", "Envoyer"), oe = e("messageFeedbackSubmittingText", "Envoi..."), re = e("messageFeedbackToastTitle", "Merci !"), se = e(
|
|
78
|
+
"messageFeedbackToastDescription",
|
|
79
|
+
"Votre feedback a été enregistré"
|
|
80
|
+
), ae = e("messageFeedbackToastErrorTitle", "Erreur"), ne = e(
|
|
81
|
+
"messageFeedbackToastErrorDescription",
|
|
82
|
+
"Impossible d'enregistrer le feedback"
|
|
83
|
+
), ie = async () => {
|
|
60
84
|
try {
|
|
61
|
-
await navigator.clipboard.writeText(b), x(!0),
|
|
62
|
-
title:
|
|
63
|
-
description:
|
|
85
|
+
await navigator.clipboard.writeText(b), x(!0), l({
|
|
86
|
+
title: q,
|
|
87
|
+
description: G
|
|
64
88
|
}), setTimeout(() => x(!1), 2e3);
|
|
65
|
-
} catch (
|
|
66
|
-
console.error("Failed to copy:",
|
|
67
|
-
title:
|
|
68
|
-
description:
|
|
89
|
+
} catch (o) {
|
|
90
|
+
console.error("Failed to copy:", o), l({
|
|
91
|
+
title: Z,
|
|
92
|
+
description: X,
|
|
69
93
|
variant: "destructive"
|
|
70
94
|
});
|
|
71
95
|
}
|
|
72
|
-
},
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
(
|
|
76
|
-
answer:
|
|
77
|
-
sources:
|
|
96
|
+
}, ce = () => {
|
|
97
|
+
if (m && d === "api_answer") {
|
|
98
|
+
const o = m;
|
|
99
|
+
(o.answer || o.sources) && j({
|
|
100
|
+
answer: o.answer || b,
|
|
101
|
+
sources: o.sources || []
|
|
78
102
|
});
|
|
79
103
|
}
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
if (
|
|
104
|
+
}, F = (o) => {
|
|
105
|
+
s || (v(o), u(!0));
|
|
106
|
+
}, L = async (o) => {
|
|
107
|
+
if (a) {
|
|
84
108
|
k(!0);
|
|
85
109
|
try {
|
|
86
|
-
await
|
|
87
|
-
messageId:
|
|
88
|
-
storyId:
|
|
89
|
-
rating:
|
|
90
|
-
comment:
|
|
91
|
-
responseType:
|
|
92
|
-
}),
|
|
93
|
-
title:
|
|
94
|
-
description:
|
|
110
|
+
await I.submitFeedback({
|
|
111
|
+
messageId: B,
|
|
112
|
+
storyId: R,
|
|
113
|
+
rating: a,
|
|
114
|
+
comment: o ? g : void 0,
|
|
115
|
+
responseType: d
|
|
116
|
+
}), O(a), u(!1), p(""), l({
|
|
117
|
+
title: re,
|
|
118
|
+
description: se
|
|
95
119
|
});
|
|
96
|
-
} catch (
|
|
97
|
-
console.error("Failed to submit feedback:",
|
|
98
|
-
title:
|
|
99
|
-
description:
|
|
120
|
+
} catch (le) {
|
|
121
|
+
console.error("Failed to submit feedback:", le), l({
|
|
122
|
+
title: ae,
|
|
123
|
+
description: ne,
|
|
100
124
|
variant: "destructive"
|
|
101
125
|
});
|
|
102
126
|
} finally {
|
|
103
127
|
k(!1);
|
|
104
128
|
}
|
|
105
129
|
}
|
|
106
|
-
},
|
|
107
|
-
|
|
130
|
+
}, M = () => {
|
|
131
|
+
u(!1), v(null), p("");
|
|
108
132
|
};
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */
|
|
133
|
+
return /* @__PURE__ */ r(f, { children: [
|
|
134
|
+
/* @__PURE__ */ r("div", { className: n("flex items-center gap-1.5 mt-3 pt-2 border-t border-border", P), children: [
|
|
135
|
+
/* @__PURE__ */ t(
|
|
112
136
|
"button",
|
|
113
137
|
{
|
|
114
|
-
onClick:
|
|
138
|
+
onClick: ie,
|
|
115
139
|
className: "group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
|
|
116
|
-
title:
|
|
117
|
-
"aria-label":
|
|
118
|
-
children:
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
] }) : /* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */
|
|
140
|
+
title: T,
|
|
141
|
+
"aria-label": T,
|
|
142
|
+
children: z ? /* @__PURE__ */ r(f, { children: [
|
|
143
|
+
/* @__PURE__ */ t(be, { className: "h-3.5 w-3.5 text-positive-foreground" }),
|
|
144
|
+
/* @__PURE__ */ t("span", { className: "text-xs font-medium text-positive-foreground", children: V })
|
|
145
|
+
] }) : /* @__PURE__ */ r(f, { children: [
|
|
146
|
+
/* @__PURE__ */ t(he, { className: "h-3.5 w-3.5" }),
|
|
147
|
+
/* @__PURE__ */ t("span", { className: "text-xs font-medium hidden sm:inline", children: H })
|
|
124
148
|
] })
|
|
125
149
|
}
|
|
126
150
|
),
|
|
127
|
-
h && /* @__PURE__ */
|
|
151
|
+
h && /* @__PURE__ */ r(
|
|
128
152
|
"button",
|
|
129
153
|
{
|
|
130
154
|
onClick: h,
|
|
@@ -132,128 +156,128 @@ function ke({
|
|
|
132
156
|
title: C,
|
|
133
157
|
"aria-label": C,
|
|
134
158
|
children: [
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ t(xe, { className: "h-3.5 w-3.5 group-hover:rotate-180 transition-transform duration-500" }),
|
|
160
|
+
/* @__PURE__ */ t("span", { className: "text-xs font-medium hidden sm:inline", children: $ })
|
|
137
161
|
]
|
|
138
162
|
}
|
|
139
163
|
),
|
|
140
|
-
|
|
164
|
+
d === "api_answer" && m && /* @__PURE__ */ r(
|
|
141
165
|
"button",
|
|
142
166
|
{
|
|
143
|
-
onClick:
|
|
167
|
+
onClick: ce,
|
|
144
168
|
className: "group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
|
|
145
|
-
title:
|
|
146
|
-
"aria-label":
|
|
169
|
+
title: y,
|
|
170
|
+
"aria-label": y,
|
|
147
171
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5 group-hover:scale-110 transition-transform duration-200" }),
|
|
173
|
+
/* @__PURE__ */ t("span", { className: "text-xs font-medium hidden sm:inline", children: J })
|
|
150
174
|
]
|
|
151
175
|
}
|
|
152
176
|
),
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ t("div", { className: "mx-1 h-4 w-px bg-muted-foreground/20" }),
|
|
178
|
+
/* @__PURE__ */ t(
|
|
155
179
|
"button",
|
|
156
180
|
{
|
|
157
|
-
onClick: () =>
|
|
158
|
-
disabled:
|
|
159
|
-
className:
|
|
181
|
+
onClick: () => F("positive"),
|
|
182
|
+
disabled: s !== null,
|
|
183
|
+
className: n(
|
|
160
184
|
"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
|
|
161
|
-
|
|
185
|
+
s === "positive" ? "bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400" : s !== null ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-muted/60 text-muted-foreground hover:text-green-600 dark:hover:text-green-400 hover:scale-105"
|
|
162
186
|
),
|
|
163
|
-
title:
|
|
164
|
-
"aria-label":
|
|
165
|
-
children: /* @__PURE__ */
|
|
187
|
+
title: w,
|
|
188
|
+
"aria-label": w,
|
|
189
|
+
children: /* @__PURE__ */ t(E, { className: n(
|
|
166
190
|
"h-3.5 w-3.5",
|
|
167
|
-
|
|
191
|
+
s === "positive" && "fill-current"
|
|
168
192
|
) })
|
|
169
193
|
}
|
|
170
194
|
),
|
|
171
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ t(
|
|
172
196
|
"button",
|
|
173
197
|
{
|
|
174
|
-
onClick: () =>
|
|
175
|
-
disabled:
|
|
176
|
-
className:
|
|
198
|
+
onClick: () => F("negative"),
|
|
199
|
+
disabled: s !== null,
|
|
200
|
+
className: n(
|
|
177
201
|
"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background",
|
|
178
|
-
|
|
202
|
+
s === "negative" ? "bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400" : s !== null ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-muted/60 text-muted-foreground hover:text-red-600 dark:hover:text-red-400 hover:scale-105"
|
|
179
203
|
),
|
|
180
|
-
title:
|
|
181
|
-
"aria-label":
|
|
182
|
-
children: /* @__PURE__ */
|
|
204
|
+
title: N,
|
|
205
|
+
"aria-label": N,
|
|
206
|
+
children: /* @__PURE__ */ t(S, { className: n(
|
|
183
207
|
"h-3.5 w-3.5",
|
|
184
|
-
|
|
208
|
+
s === "negative" && "fill-current"
|
|
185
209
|
) })
|
|
186
210
|
}
|
|
187
211
|
)
|
|
188
212
|
] }),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
213
|
+
/* @__PURE__ */ t(
|
|
214
|
+
ge,
|
|
191
215
|
{
|
|
192
|
-
isOpen:
|
|
193
|
-
onClose:
|
|
216
|
+
isOpen: _,
|
|
217
|
+
onClose: M,
|
|
194
218
|
size: "small",
|
|
195
219
|
showCloseButton: !1,
|
|
196
220
|
className: "w-[calc(100vw-2rem)] max-w-md",
|
|
197
|
-
children: /* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
221
|
+
children: /* @__PURE__ */ r("div", { className: "relative space-y-4", children: [
|
|
222
|
+
/* @__PURE__ */ t(
|
|
199
223
|
"button",
|
|
200
224
|
{
|
|
201
225
|
type: "button",
|
|
202
|
-
onClick:
|
|
226
|
+
onClick: M,
|
|
203
227
|
className: "absolute right-0 top-0 text-muted-foreground hover:text-foreground transition-colors",
|
|
204
|
-
"aria-label":
|
|
205
|
-
children: /* @__PURE__ */
|
|
228
|
+
"aria-label": U,
|
|
229
|
+
children: /* @__PURE__ */ t(ke, { className: "h-4 w-4" })
|
|
206
230
|
}
|
|
207
231
|
),
|
|
208
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ r(
|
|
209
233
|
"div",
|
|
210
234
|
{
|
|
211
|
-
className:
|
|
235
|
+
className: n(
|
|
212
236
|
"flex items-start gap-3 rounded-lg border px-4 py-3 sm:px-5 sm:py-4 pt-4",
|
|
213
|
-
|
|
237
|
+
a === "positive" ? "border-green-200 bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-300" : "border-red-200 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300"
|
|
214
238
|
),
|
|
215
239
|
children: [
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ t("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-white/70 dark:bg-background/30", children: a === "positive" ? /* @__PURE__ */ t(E, { className: "h-4 w-4 fill-current" }) : /* @__PURE__ */ t(S, { className: "h-4 w-4 fill-current" }) }),
|
|
241
|
+
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
242
|
+
/* @__PURE__ */ t("p", { className: "text-sm font-semibold", children: a === "positive" ? K : Q }),
|
|
243
|
+
/* @__PURE__ */ t("p", { className: "text-xs sm:text-sm text-muted-foreground", children: W })
|
|
220
244
|
] })
|
|
221
245
|
]
|
|
222
246
|
}
|
|
223
247
|
),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
|
|
248
|
+
/* @__PURE__ */ t(
|
|
249
|
+
pe,
|
|
226
250
|
{
|
|
227
|
-
placeholder:
|
|
251
|
+
placeholder: Y,
|
|
228
252
|
value: g,
|
|
229
|
-
onChange: (
|
|
253
|
+
onChange: (o) => p(o.target.value),
|
|
230
254
|
className: "min-h-[80px] max-h-[150px] w-full resize-none text-sm box-border",
|
|
231
|
-
disabled:
|
|
255
|
+
disabled: c
|
|
232
256
|
}
|
|
233
257
|
),
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
|
|
258
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", children: [
|
|
259
|
+
/* @__PURE__ */ t(
|
|
260
|
+
A,
|
|
237
261
|
{
|
|
238
262
|
variant: "ghost",
|
|
239
263
|
size: "sm",
|
|
240
|
-
onClick: () =>
|
|
241
|
-
disabled:
|
|
264
|
+
onClick: () => L(!1),
|
|
265
|
+
disabled: c,
|
|
242
266
|
className: "w-full sm:w-auto text-muted-foreground hover:text-foreground",
|
|
243
|
-
children:
|
|
267
|
+
children: ee
|
|
244
268
|
}
|
|
245
269
|
),
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
|
|
270
|
+
/* @__PURE__ */ t(
|
|
271
|
+
A,
|
|
248
272
|
{
|
|
249
273
|
size: "sm",
|
|
250
|
-
onClick: () =>
|
|
251
|
-
disabled:
|
|
252
|
-
className:
|
|
274
|
+
onClick: () => L(!0),
|
|
275
|
+
disabled: c || !g.trim(),
|
|
276
|
+
className: n(
|
|
253
277
|
"w-full sm:w-auto",
|
|
254
|
-
|
|
278
|
+
a === "positive" ? "bg-green-600 hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600" : "bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600"
|
|
255
279
|
),
|
|
256
|
-
children:
|
|
280
|
+
children: c ? oe : te
|
|
257
281
|
}
|
|
258
282
|
)
|
|
259
283
|
] })
|
|
@@ -263,6 +287,6 @@ function ke({
|
|
|
263
287
|
] });
|
|
264
288
|
}
|
|
265
289
|
export {
|
|
266
|
-
|
|
290
|
+
je as MessageActions
|
|
267
291
|
};
|
|
268
292
|
//# sourceMappingURL=MessageActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageActions.js","sources":["../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-down.js","../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-up.js","../../../lib/organisms/chat/MessageActions.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M17 14V2\", key: \"8ymqnk\" }],\n [\n \"path\",\n {\n d: \"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\",\n key: \"m61m77\"\n }\n ]\n];\nconst ThumbsDown = createLucideIcon(\"thumbs-down\", __iconNode);\n\nexport { __iconNode, ThumbsDown as default };\n//# sourceMappingURL=thumbs-down.js.map\n","/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M7 10v12\", key: \"1qc93n\" }],\n [\n \"path\",\n {\n d: \"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\",\n key: \"emmmcr\"\n }\n ]\n];\nconst ThumbsUp = createLucideIcon(\"thumbs-up\", __iconNode);\n\nexport { __iconNode, ThumbsUp as default };\n//# sourceMappingURL=thumbs-up.js.map\n","\"use client\";\n\nimport {useState} from \"react\";\nimport type {ChangeEvent} from \"react\";\nimport {Copy, RefreshCw, Check, Maximize2, ThumbsUp, ThumbsDown, X} from \"lucide-react\";\nimport {cn} from \"@clubmed/usg-chat-ui/utils/cn\";\nimport {useToast} from \"@clubmed/usg-chat-ui/molecules/Notifications/useToast\";\nimport {useCanvasStore} from \"@clubmed/usg-chat-ui/utils/canvas-store\";\nimport {useChatApiClient} from \"@clubmed/usg-chat-ui/contexts/ChatContext\";\nimport {Modal} from \"@clubmed/usg-chat-ui/molecules/Modals/Modal\";\nimport {Button} from \"@clubmed/usg-chat-ui/molecules/Buttons/Button\";\nimport {Textarea} from \"@clubmed/usg-chat-ui/molecules/Textareas/Textarea\";\nimport {useChatLabels} from \"../../contexts/ChatLabelsContext\";\n\ninterface MessageActionsProps {\n content: string;\n messageId?: string;\n storyId?: string;\n onRegenerate?: () => void;\n responseType?: \"message\" | \"story\" | \"api_answer\" | \"followup_questions\" | \"release_note\";\n canvasData?: Record<string, unknown>;\n className?: string;\n}\n\nexport function MessageActions({ \n content, \n messageId,\n storyId,\n onRegenerate, \n responseType,\n canvasData,\n className \n}: MessageActionsProps) {\n const [copied, setCopied] = useState(false);\n const [feedbackGiven, setFeedbackGiven] = useState<\"positive\" | \"negative\" | null>(null);\n const [showFeedbackModal, setShowFeedbackModal] = useState(false);\n const [pendingRating, setPendingRating] = useState<\"positive\" | \"negative\" | null>(null);\n const [feedbackComment, setFeedbackComment] = useState(\"\");\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { toast } = useToast();\n const { openApiDocsCanvas } = useCanvasStore();\n const apiClient = useChatApiClient();\n const {get} = useChatLabels();\n const copyLabel = get(\"messageCopyAriaLabel\", \"Copier le message\");\n const regenerateLabel = get(\"messageRegenerateAriaLabel\", \"Régénérer la réponse\");\n const openCanvasLabel = get(\"messageOpenCanvasAriaLabel\", \"Ouvrir Canva\");\n const thumbsUpLabel = get(\"messageThumbsUpAriaLabel\", \"Réponse utile\");\n const thumbsDownLabel = get(\"messageThumbsDownAriaLabel\", \"Réponse non utile\");\n const closeFeedbackLabel = get(\"messageCloseFeedbackAriaLabel\", \"Fermer\");\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(content);\n setCopied(true);\n toast({\n title: \"Copié\",\n description: \"Message copié dans le presse-papiers\",\n });\n setTimeout(() => setCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy:\", error);\n toast({\n title: \"Erreur\",\n description: \"Impossible de copier le message\",\n variant: \"destructive\",\n });\n }\n };\n\n const handleOpenApiCanvas = () => {\n if (canvasData && responseType === \"api_answer\") {\n const apiData = canvasData as {\n answer?: string;\n sources?: Array<{ title: string; href: string; score?: number }>;\n };\n \n if (apiData.answer || apiData.sources) {\n openApiDocsCanvas({\n answer: apiData.answer || content,\n sources: apiData.sources || [],\n });\n }\n }\n };\n\n const handleFeedbackClick = (rating: \"positive\" | \"negative\") => {\n if (feedbackGiven) return; // Already gave feedback\n setPendingRating(rating);\n setShowFeedbackModal(true);\n };\n\n const submitFeedback = async (withComment: boolean) => {\n if (!pendingRating) return;\n \n setIsSubmitting(true);\n try {\n await apiClient.submitFeedback({\n messageId,\n storyId,\n rating: pendingRating,\n comment: withComment ? feedbackComment : undefined,\n responseType: responseType as \"story\" | \"release_note\" | \"api_answer\" | \"message\" | undefined,\n });\n \n setFeedbackGiven(pendingRating);\n setShowFeedbackModal(false);\n setFeedbackComment(\"\");\n \n toast({\n title: \"Merci !\",\n description: \"Votre feedback a été enregistré\",\n });\n } catch (error) {\n console.error(\"Failed to submit feedback:\", error);\n toast({\n title: \"Erreur\",\n description: \"Impossible d'enregistrer le feedback\",\n variant: \"destructive\",\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleModalClose = () => {\n setShowFeedbackModal(false);\n setPendingRating(null);\n setFeedbackComment(\"\");\n };\n\n return (\n <>\n <div className={cn(\"flex items-center gap-1.5 mt-3 pt-2 border-t border-border\", className)}>\n <button\n onClick={handleCopy}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={copyLabel}\n aria-label={copyLabel}\n >\n {copied ? (\n <>\n <Check className=\"h-3.5 w-3.5 text-positive-foreground\" />\n <span className=\"text-xs font-medium text-positive-foreground\">Copié</span>\n </>\n ) : (\n <>\n <Copy className=\"h-3.5 w-3.5\" />\n <span className=\"text-xs font-medium hidden sm:inline\">Copier</span>\n </>\n )}\n </button>\n \n {onRegenerate && (\n <button\n onClick={onRegenerate}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={regenerateLabel}\n aria-label={regenerateLabel}\n >\n <RefreshCw className=\"h-3.5 w-3.5 group-hover:rotate-180 transition-transform duration-500\" />\n <span className=\"text-xs font-medium hidden sm:inline\">Régénérer</span>\n </button>\n )}\n \n {responseType === \"api_answer\" && canvasData && (\n <button\n onClick={handleOpenApiCanvas}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={openCanvasLabel}\n aria-label={openCanvasLabel}\n >\n <Maximize2 className=\"h-3.5 w-3.5 group-hover:scale-110 transition-transform duration-200\" />\n <span className=\"text-xs font-medium hidden sm:inline\">Ouvrir Canva</span>\n </button>\n )}\n\n {/* Feedback buttons - separator */}\n <div className=\"mx-1 h-4 w-px bg-muted-foreground/20\" />\n\n {/* Thumbs Up */}\n <button\n onClick={() => handleFeedbackClick(\"positive\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"positive\"\n ? \"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-green-600 dark:hover:text-green-400 hover:scale-105\"\n )}\n title={thumbsUpLabel}\n aria-label={thumbsUpLabel}\n >\n <ThumbsUp className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"positive\" && \"fill-current\"\n )} />\n </button>\n\n {/* Thumbs Down */}\n <button\n onClick={() => handleFeedbackClick(\"negative\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"negative\"\n ? \"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-red-600 dark:hover:text-red-400 hover:scale-105\"\n )}\n title={thumbsDownLabel}\n aria-label={thumbsDownLabel}\n >\n <ThumbsDown className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"negative\" && \"fill-current\"\n )} />\n </button>\n </div>\n\n <Modal\n isOpen={showFeedbackModal}\n onClose={handleModalClose}\n size=\"small\"\n showCloseButton={false}\n className=\"w-[calc(100vw-2rem)] max-w-md\"\n >\n <div className=\"relative space-y-4\">\n <button\n type=\"button\"\n onClick={handleModalClose}\n className=\"absolute right-0 top-0 text-muted-foreground hover:text-foreground transition-colors\"\n aria-label={closeFeedbackLabel}\n >\n <X className=\"h-4 w-4\" />\n </button>\n\n <div\n className={cn(\n \"flex items-start gap-3 rounded-lg border px-4 py-3 sm:px-5 sm:py-4 pt-4\",\n pendingRating === \"positive\"\n ? \"border-green-200 bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-300\"\n : \"border-red-200 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300\"\n )}\n >\n <div className=\"flex h-8 w-8 items-center justify-center rounded-full bg-white/70 dark:bg-background/30\">\n {pendingRating === \"positive\" ? (\n <ThumbsUp className=\"h-4 w-4 fill-current\" />\n ) : (\n <ThumbsDown className=\"h-4 w-4 fill-current\" />\n )}\n </div>\n <div className=\"space-y-1\">\n <p className=\"text-sm font-semibold\">\n {pendingRating === \"positive\"\n ? \"Merci pour votre feedback !\"\n : \"Aidez-nous à nous améliorer\"}\n </p>\n <p className=\"text-xs sm:text-sm text-muted-foreground\">\n Un commentaire pour nous aider ?\n </p>\n </div>\n </div>\n\n <Textarea\n placeholder=\"Votre commentaire (optionnel)...\"\n value={feedbackComment}\n onChange={(event: ChangeEvent<HTMLTextAreaElement>) =>\n setFeedbackComment(event.target.value)\n }\n className=\"min-h-[80px] max-h-[150px] w-full resize-none text-sm box-border\"\n disabled={isSubmitting}\n />\n\n <div className=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => submitFeedback(false)}\n disabled={isSubmitting}\n className=\"w-full sm:w-auto text-muted-foreground hover:text-foreground\"\n >\n Passer\n </Button>\n <Button\n size=\"sm\"\n onClick={() => submitFeedback(true)}\n disabled={isSubmitting || !feedbackComment.trim()}\n className={cn(\n \"w-full sm:w-auto\",\n pendingRating === \"positive\"\n ? \"bg-green-600 hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600\"\n : \"bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600\"\n )}\n >\n {isSubmitting ? \"Envoi...\" : \"Envoyer\"}\n </Button>\n </div>\n </div>\n </Modal>\n </>\n );\n}\n"],"names":["__iconNode","ThumbsDown","createLucideIcon","ThumbsUp","MessageActions","content","messageId","storyId","onRegenerate","responseType","canvasData","className","copied","setCopied","useState","feedbackGiven","setFeedbackGiven","showFeedbackModal","setShowFeedbackModal","pendingRating","setPendingRating","feedbackComment","setFeedbackComment","isSubmitting","setIsSubmitting","toast","useToast","openApiDocsCanvas","useCanvasStore","apiClient","useChatApiClient","get","useChatLabels","copyLabel","regenerateLabel","openCanvasLabel","thumbsUpLabel","thumbsDownLabel","closeFeedbackLabel","handleCopy","error","handleOpenApiCanvas","apiData","handleFeedbackClick","rating","submitFeedback","withComment","handleModalClose","jsxs","Fragment","cn","jsx","Check","Copy","RefreshCw","Maximize2","Modal","X","Textarea","event","Button"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,IAAaC,EAAiB,eAAeF,EAAU;ACnB7D;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMG,IAAWD,EAAiB,aAAaF,EAAU;ACKlD,SAASI,GAAe;AAAA,EAC7B,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAA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react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-down.js","../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/thumbs-up.js","../../../lib/organisms/chat/MessageActions.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M17 14V2\", key: \"8ymqnk\" }],\n [\n \"path\",\n {\n d: \"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\",\n key: \"m61m77\"\n }\n ]\n];\nconst ThumbsDown = createLucideIcon(\"thumbs-down\", __iconNode);\n\nexport { __iconNode, ThumbsDown as default };\n//# sourceMappingURL=thumbs-down.js.map\n","/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M7 10v12\", key: \"1qc93n\" }],\n [\n \"path\",\n {\n d: \"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\",\n key: \"emmmcr\"\n }\n ]\n];\nconst ThumbsUp = createLucideIcon(\"thumbs-up\", __iconNode);\n\nexport { __iconNode, ThumbsUp as default };\n//# sourceMappingURL=thumbs-up.js.map\n","\"use client\";\n\nimport {useState} from \"react\";\nimport type {ChangeEvent} from \"react\";\nimport {Copy, RefreshCw, Check, Maximize2, ThumbsUp, ThumbsDown, X} from \"lucide-react\";\nimport {cn} from \"@clubmed/usg-chat-ui/utils/cn\";\nimport {useToast} from \"@clubmed/usg-chat-ui/molecules/Notifications/useToast\";\nimport {useCanvasStore} from \"@clubmed/usg-chat-ui/utils/canvas-store\";\nimport {useChatApiClient} from \"@clubmed/usg-chat-ui/contexts/ChatContext\";\nimport {Modal} from \"@clubmed/usg-chat-ui/molecules/Modals/Modal\";\nimport {Button} from \"@clubmed/usg-chat-ui/molecules/Buttons/Button\";\nimport {Textarea} from \"@clubmed/usg-chat-ui/molecules/Textareas/Textarea\";\nimport {useChatLabels} from \"../../contexts/ChatLabelsContext\";\n\ninterface MessageActionsProps {\n content: string;\n messageId?: string;\n storyId?: string;\n onRegenerate?: () => void;\n responseType?: \"message\" | \"story\" | \"api_answer\" | \"followup_questions\" | \"release_note\";\n canvasData?: Record<string, unknown>;\n className?: string;\n}\n\nexport function MessageActions({ \n content, \n messageId,\n storyId,\n onRegenerate, \n responseType,\n canvasData,\n className \n}: MessageActionsProps) {\n const [copied, setCopied] = useState(false);\n const [feedbackGiven, setFeedbackGiven] = useState<\"positive\" | \"negative\" | null>(null);\n const [showFeedbackModal, setShowFeedbackModal] = useState(false);\n const [pendingRating, setPendingRating] = useState<\"positive\" | \"negative\" | null>(null);\n const [feedbackComment, setFeedbackComment] = useState(\"\");\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { toast } = useToast();\n const { openApiDocsCanvas } = useCanvasStore();\n const apiClient = useChatApiClient();\n const {get} = useChatLabels();\n const copyLabel = get(\"messageCopyAriaLabel\", \"Copier le message\");\n const regenerateLabel = get(\"messageRegenerateAriaLabel\", \"Régénérer la réponse\");\n const openCanvasLabel = get(\"messageOpenCanvasAriaLabel\", \"Ouvrir Canva\");\n const thumbsUpLabel = get(\"messageThumbsUpAriaLabel\", \"Réponse utile\");\n const thumbsDownLabel = get(\"messageThumbsDownAriaLabel\", \"Réponse non utile\");\n const closeFeedbackLabel = get(\"messageCloseFeedbackAriaLabel\", \"Fermer\");\n const copyButtonText = get(\"messageCopyButtonText\", \"Copier\");\n const copySuccessText = get(\"messageCopySuccessText\", \"Copié\");\n const copyToastTitle = get(\"messageCopyToastTitle\", \"Copié\");\n const copyToastDescription = get(\n \"messageCopyToastDescription\",\n \"Message copié dans le presse-papiers\"\n );\n const copyErrorTitle = get(\"messageCopyErrorTitle\", \"Erreur\");\n const copyErrorDescription = get(\n \"messageCopyErrorDescription\",\n \"Impossible de copier le message\"\n );\n const regenerateButtonText = get(\"messageRegenerateButtonText\", \"Régénérer\");\n const openCanvasButtonText = get(\"messageOpenCanvasButtonText\", \"Ouvrir Canva\");\n const feedbackPositiveTitle = get(\n \"messageFeedbackPositiveTitle\",\n \"Merci pour votre feedback !\"\n );\n const feedbackNegativeTitle = get(\n \"messageFeedbackNegativeTitle\",\n \"Aidez-nous à nous améliorer\"\n );\n const feedbackPromptText = get(\n \"messageFeedbackPromptText\",\n \"Un commentaire pour nous aider ?\"\n );\n const feedbackTextareaPlaceholder = get(\n \"messageFeedbackTextareaPlaceholder\",\n \"Votre commentaire (optionnel)...\"\n );\n const feedbackSkipText = get(\"messageFeedbackSkipButtonText\", \"Passer\");\n const feedbackSubmitText = get(\"messageFeedbackSubmitButtonText\", \"Envoyer\");\n const feedbackSubmittingText = get(\"messageFeedbackSubmittingText\", \"Envoi...\");\n const feedbackToastTitle = get(\"messageFeedbackToastTitle\", \"Merci !\");\n const feedbackToastDescription = get(\n \"messageFeedbackToastDescription\",\n \"Votre feedback a été enregistré\"\n );\n const feedbackToastErrorTitle = get(\"messageFeedbackToastErrorTitle\", \"Erreur\");\n const feedbackToastErrorDescription = get(\n \"messageFeedbackToastErrorDescription\",\n \"Impossible d'enregistrer le feedback\"\n );\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(content);\n setCopied(true);\n toast({\n title: copyToastTitle,\n description: copyToastDescription,\n });\n setTimeout(() => setCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy:\", error);\n toast({\n title: copyErrorTitle,\n description: copyErrorDescription,\n variant: \"destructive\",\n });\n }\n };\n\n const handleOpenApiCanvas = () => {\n if (canvasData && responseType === \"api_answer\") {\n const apiData = canvasData as {\n answer?: string;\n sources?: Array<{ title: string; href: string; score?: number }>;\n };\n \n if (apiData.answer || apiData.sources) {\n openApiDocsCanvas({\n answer: apiData.answer || content,\n sources: apiData.sources || [],\n });\n }\n }\n };\n\n const handleFeedbackClick = (rating: \"positive\" | \"negative\") => {\n if (feedbackGiven) return; // Already gave feedback\n setPendingRating(rating);\n setShowFeedbackModal(true);\n };\n\n const submitFeedback = async (withComment: boolean) => {\n if (!pendingRating) return;\n \n setIsSubmitting(true);\n try {\n await apiClient.submitFeedback({\n messageId,\n storyId,\n rating: pendingRating,\n comment: withComment ? feedbackComment : undefined,\n responseType: responseType as \"story\" | \"release_note\" | \"api_answer\" | \"message\" | undefined,\n });\n \n setFeedbackGiven(pendingRating);\n setShowFeedbackModal(false);\n setFeedbackComment(\"\");\n \n toast({\n title: feedbackToastTitle,\n description: feedbackToastDescription,\n });\n } catch (error) {\n console.error(\"Failed to submit feedback:\", error);\n toast({\n title: feedbackToastErrorTitle,\n description: feedbackToastErrorDescription,\n variant: \"destructive\",\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleModalClose = () => {\n setShowFeedbackModal(false);\n setPendingRating(null);\n setFeedbackComment(\"\");\n };\n\n return (\n <>\n <div className={cn(\"flex items-center gap-1.5 mt-3 pt-2 border-t border-border\", className)}>\n <button\n onClick={handleCopy}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={copyLabel}\n aria-label={copyLabel}\n >\n {copied ? (\n <>\n <Check className=\"h-3.5 w-3.5 text-positive-foreground\" />\n <span className=\"text-xs font-medium text-positive-foreground\">{copySuccessText}</span>\n </>\n ) : (\n <>\n <Copy className=\"h-3.5 w-3.5\" />\n <span className=\"text-xs font-medium hidden sm:inline\">{copyButtonText}</span>\n </>\n )}\n </button>\n \n {onRegenerate && (\n <button\n onClick={onRegenerate}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={regenerateLabel}\n aria-label={regenerateLabel}\n >\n <RefreshCw className=\"h-3.5 w-3.5 group-hover:rotate-180 transition-transform duration-500\" />\n <span className=\"text-xs font-medium hidden sm:inline\">{regenerateButtonText}</span>\n </button>\n )}\n \n {responseType === \"api_answer\" && canvasData && (\n <button\n onClick={handleOpenApiCanvas}\n className=\"group flex items-center gap-1.5 px-2.5 py-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\"\n title={openCanvasLabel}\n aria-label={openCanvasLabel}\n >\n <Maximize2 className=\"h-3.5 w-3.5 group-hover:scale-110 transition-transform duration-200\" />\n <span className=\"text-xs font-medium hidden sm:inline\">{openCanvasButtonText}</span>\n </button>\n )}\n\n {/* Feedback buttons - separator */}\n <div className=\"mx-1 h-4 w-px bg-muted-foreground/20\" />\n\n {/* Thumbs Up */}\n <button\n onClick={() => handleFeedbackClick(\"positive\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"positive\"\n ? \"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-green-600 dark:hover:text-green-400 hover:scale-105\"\n )}\n title={thumbsUpLabel}\n aria-label={thumbsUpLabel}\n >\n <ThumbsUp className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"positive\" && \"fill-current\"\n )} />\n </button>\n\n {/* Thumbs Down */}\n <button\n onClick={() => handleFeedbackClick(\"negative\")}\n disabled={feedbackGiven !== null}\n className={cn(\n \"group flex items-center gap-1 px-2 py-1.5 rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n feedbackGiven === \"negative\"\n ? \"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400\"\n : feedbackGiven !== null\n ? \"opacity-50 cursor-not-allowed text-muted-foreground\"\n : \"hover:bg-muted/60 text-muted-foreground hover:text-red-600 dark:hover:text-red-400 hover:scale-105\"\n )}\n title={thumbsDownLabel}\n aria-label={thumbsDownLabel}\n >\n <ThumbsDown className={cn(\n \"h-3.5 w-3.5\",\n feedbackGiven === \"negative\" && \"fill-current\"\n )} />\n </button>\n </div>\n\n <Modal\n isOpen={showFeedbackModal}\n onClose={handleModalClose}\n size=\"small\"\n showCloseButton={false}\n className=\"w-[calc(100vw-2rem)] max-w-md\"\n >\n <div className=\"relative space-y-4\">\n <button\n type=\"button\"\n onClick={handleModalClose}\n className=\"absolute right-0 top-0 text-muted-foreground hover:text-foreground transition-colors\"\n aria-label={closeFeedbackLabel}\n >\n <X className=\"h-4 w-4\" />\n </button>\n\n <div\n className={cn(\n \"flex items-start gap-3 rounded-lg border px-4 py-3 sm:px-5 sm:py-4 pt-4\",\n pendingRating === \"positive\"\n ? \"border-green-200 bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-300\"\n : \"border-red-200 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300\"\n )}\n >\n <div className=\"flex h-8 w-8 items-center justify-center rounded-full bg-white/70 dark:bg-background/30\">\n {pendingRating === \"positive\" ? (\n <ThumbsUp className=\"h-4 w-4 fill-current\" />\n ) : (\n <ThumbsDown className=\"h-4 w-4 fill-current\" />\n )}\n </div>\n <div className=\"space-y-1\">\n <p className=\"text-sm font-semibold\">\n {pendingRating === \"positive\"\n ? feedbackPositiveTitle\n : feedbackNegativeTitle}\n </p>\n <p className=\"text-xs sm:text-sm text-muted-foreground\">\n {feedbackPromptText}\n </p>\n </div>\n </div>\n\n <Textarea\n placeholder={feedbackTextareaPlaceholder}\n value={feedbackComment}\n onChange={(event: ChangeEvent<HTMLTextAreaElement>) =>\n setFeedbackComment(event.target.value)\n }\n className=\"min-h-[80px] max-h-[150px] w-full resize-none text-sm box-border\"\n disabled={isSubmitting}\n />\n\n <div className=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => submitFeedback(false)}\n disabled={isSubmitting}\n className=\"w-full sm:w-auto text-muted-foreground hover:text-foreground\"\n >\n {feedbackSkipText}\n </Button>\n <Button\n size=\"sm\"\n onClick={() => submitFeedback(true)}\n disabled={isSubmitting || !feedbackComment.trim()}\n className={cn(\n \"w-full sm:w-auto\",\n pendingRating === \"positive\"\n ? \"bg-green-600 hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600\"\n : \"bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600\"\n )}\n >\n {isSubmitting ? feedbackSubmittingText : feedbackSubmitText}\n </Button>\n </div>\n </div>\n </Modal>\n </>\n );\n}\n"],"names":["__iconNode","ThumbsDown","createLucideIcon","ThumbsUp","MessageActions","content","messageId","storyId","onRegenerate","responseType","canvasData","className","copied","setCopied","useState","feedbackGiven","setFeedbackGiven","showFeedbackModal","setShowFeedbackModal","pendingRating","setPendingRating","feedbackComment","setFeedbackComment","isSubmitting","setIsSubmitting","toast","useToast","openApiDocsCanvas","useCanvasStore","apiClient","useChatApiClient","get","useChatLabels","copyLabel","regenerateLabel","openCanvasLabel","thumbsUpLabel","thumbsDownLabel","closeFeedbackLabel","copyButtonText","copySuccessText","copyToastTitle","copyToastDescription","copyErrorTitle","copyErrorDescription","regenerateButtonText","openCanvasButtonText","feedbackPositiveTitle","feedbackNegativeTitle","feedbackPromptText","feedbackTextareaPlaceholder","feedbackSkipText","feedbackSubmitText","feedbackSubmittingText","feedbackToastTitle","feedbackToastDescription","feedbackToastErrorTitle","feedbackToastErrorDescription","handleCopy","error","handleOpenApiCanvas","apiData","handleFeedbackClick","rating","submitFeedback","withComment","handleModalClose","jsxs","Fragment","cn","jsx","Check","Copy","RefreshCw","Maximize2","Modal","X","Textarea","event","Button"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,IAAaC,EAAiB,eAAeF,EAAU;ACnB7D;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMG,IAAWD,EAAiB,aAAaF,EAAU;ACKlD,SAASI,GAAe;AAAA,EAC7B,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AACF,GAAwB;AACtB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAeC,CAAgB,IAAIF,EAAyC,IAAI,GACjF,CAACG,GAAmBC,CAAoB,IAAIJ,EAAS,EAAK,GAC1D,CAACK,GAAeC,CAAgB,IAAIN,EAAyC,IAAI,GACjF,CAACO,GAAiB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AA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,SAAS,MAAMf,EAAe,EAAK;AAAA,gBACnC,UAAUzC;AAAA,gBACV,WAAU;AAAA,gBAET,UAAA4B;AAAA,cAAA;AAAA,YAAA;AAAA,YAEH,gBAAAmB;AAAA,cAACS;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,MAAMf,EAAe,EAAI;AAAA,gBAClC,UAAUzC,KAAgB,CAACF,EAAgB,KAAA;AAAA,gBAC3C,WAAWgD;AAAA,kBACT;AAAA,kBACAlD,MAAkB,aACd,8EACA;AAAA,gBAAA;AAAA,gBAGL,cAAekC,KAAyBD;AAAA,cAAA;AAAA,YAAA;AAAA,UAC3C,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;","x_google_ignoreList":[0,1]}
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
3
|
-
import { PromptInput as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { PromptInput as c, PromptInputBody as l, PromptInputTextarea as a, PromptInputFooter as h, PromptInputSubmit as i } from "../../molecules/AiElements/PromptInput.js";
|
|
4
|
+
import { useChatLabels as x } from "../../contexts/ChatLabelsContext.js";
|
|
5
|
+
function g({ value: e, isLoading: o, onChange: s, onSubmit: p }) {
|
|
6
|
+
const { get: d } = x(), m = d(
|
|
7
|
+
"promptComposerPlaceholder",
|
|
8
|
+
"Décrivez votre besoin ou tapez /help pour l'aide..."
|
|
9
|
+
);
|
|
10
|
+
return /* @__PURE__ */ t("div", { className: "p-3 sm:p-4", children: /* @__PURE__ */ n(c, { onSubmit: p, children: [
|
|
11
|
+
/* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(
|
|
12
|
+
a,
|
|
8
13
|
{
|
|
9
14
|
value: e,
|
|
10
15
|
onChange: (r) => {
|
|
11
16
|
s(r.target.value);
|
|
12
17
|
},
|
|
13
|
-
placeholder:
|
|
14
|
-
disabled:
|
|
18
|
+
placeholder: m,
|
|
19
|
+
disabled: o,
|
|
15
20
|
onKeyDown: (r) => {
|
|
16
|
-
r.key === "Enter" && !r.shiftKey && !
|
|
21
|
+
r.key === "Enter" && !r.shiftKey && !o && (e != null && e.trim()) && (r.preventDefault(), p({ text: e }));
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
) }),
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ n(h, { children: [
|
|
26
|
+
/* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground hidden sm:block", children: [
|
|
22
27
|
"Commandes: /settings, /help, /clear •",
|
|
23
28
|
" ",
|
|
24
29
|
/* @__PURE__ */ t("kbd", { className: "px-1.5 py-0.5 rounded bg-muted text-xs font-mono", children: "Enter" }),
|
|
25
30
|
" pour envoyer"
|
|
26
31
|
] }),
|
|
27
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground sm:hidden", children: [
|
|
28
33
|
/* @__PURE__ */ t("kbd", { className: "px-1.5 py-0.5 rounded bg-muted text-xs font-mono", children: "Enter" }),
|
|
29
34
|
" pour envoyer"
|
|
30
35
|
] }),
|
|
31
36
|
/* @__PURE__ */ t("div", { className: "flex-1" }),
|
|
32
|
-
/* @__PURE__ */ t(
|
|
37
|
+
/* @__PURE__ */ t(i, { disabled: o || !(e != null && e.trim()), status: o ? "streaming" : "ready" })
|
|
33
38
|
] })
|
|
34
39
|
] }) });
|
|
35
40
|
}
|
|
36
41
|
export {
|
|
37
|
-
|
|
42
|
+
g as PromptComposer
|
|
38
43
|
};
|
|
39
44
|
//# sourceMappingURL=PromptComposer.js.map
|