llmasaservice-ui 0.7.9 → 0.7.11
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/index.css +25 -37
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +41 -39
- package/dist/index.mjs +41 -39
- package/package.json +1 -1
- package/src/AgentPanel.tsx +20 -28
- package/src/ChatPanel.css +111 -39
- package/src/ChatPanel.tsx +12 -0
- package/src/stories/AgentPanel.stories.ts +0 -1
package/dist/index.css
CHANGED
|
@@ -6,19 +6,17 @@
|
|
|
6
6
|
Helvetica,
|
|
7
7
|
sans-serif;
|
|
8
8
|
font-size: small;
|
|
9
|
-
color: #
|
|
10
|
-
background-color: #
|
|
9
|
+
color: #1a1a1a;
|
|
10
|
+
background-color: #ffffff;
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
|
-
justify-content: space-between;
|
|
14
|
-
padding: 10px;
|
|
15
|
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
|
16
|
-
max-height: 90%;
|
|
17
13
|
}
|
|
18
14
|
.side-panel .title {
|
|
19
|
-
font-size:
|
|
15
|
+
font-size: 1.5rem;
|
|
20
16
|
font-weight: bold;
|
|
21
|
-
|
|
17
|
+
padding: 0.5rem 0.75rem;
|
|
18
|
+
margin-bottom: 0.75rem;
|
|
19
|
+
border-bottom: 1px solid #e5e7eb;
|
|
22
20
|
text-align: center;
|
|
23
21
|
color: #007bff;
|
|
24
22
|
}
|
|
@@ -57,13 +55,13 @@
|
|
|
57
55
|
color: white;
|
|
58
56
|
}
|
|
59
57
|
.side-panel .history-entry {
|
|
60
|
-
background-color:
|
|
58
|
+
background-color: white;
|
|
61
59
|
padding-bottom: 10px;
|
|
62
60
|
border-radius: 10px;
|
|
63
61
|
}
|
|
64
62
|
.side-panel .responseArea {
|
|
65
63
|
flex: 1;
|
|
66
|
-
background-color:
|
|
64
|
+
background-color: white;
|
|
67
65
|
border-radius: 10px;
|
|
68
66
|
overflow-y: auto;
|
|
69
67
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
@@ -91,11 +89,7 @@
|
|
|
91
89
|
margin-left: 5%;
|
|
92
90
|
max-width: 90%;
|
|
93
91
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
94
|
-
background:
|
|
95
|
-
linear-gradient(
|
|
96
|
-
to right,
|
|
97
|
-
#e0f7fa,
|
|
98
|
-
#ffefd5);
|
|
92
|
+
background: #e0f7fa;
|
|
99
93
|
color: #000;
|
|
100
94
|
}
|
|
101
95
|
.side-panel .copy-button {
|
|
@@ -110,20 +104,6 @@
|
|
|
110
104
|
justify-content: center;
|
|
111
105
|
align-items: center;
|
|
112
106
|
}
|
|
113
|
-
.side-panel .icon-svg {
|
|
114
|
-
width: 20px;
|
|
115
|
-
height: 20px;
|
|
116
|
-
}
|
|
117
|
-
.side-panel .icon-svg-large {
|
|
118
|
-
margin-right: 4px;
|
|
119
|
-
margin-top: 5px;
|
|
120
|
-
}
|
|
121
|
-
.side-panel .copy-button:hover,
|
|
122
|
-
.side-panel .thumbs-button:hover {
|
|
123
|
-
color: white;
|
|
124
|
-
border-radius: 50%;
|
|
125
|
-
background-color: #0056b3;
|
|
126
|
-
}
|
|
127
107
|
.side-panel .thumbs-button {
|
|
128
108
|
font-size: 12px;
|
|
129
109
|
border: 0;
|
|
@@ -136,6 +116,20 @@
|
|
|
136
116
|
justify-content: center;
|
|
137
117
|
align-items: center;
|
|
138
118
|
}
|
|
119
|
+
.side-panel .copy-button:hover,
|
|
120
|
+
.side-panel .thumbs-button:hover {
|
|
121
|
+
color: white;
|
|
122
|
+
border-radius: 50%;
|
|
123
|
+
background-color: #0056b3;
|
|
124
|
+
}
|
|
125
|
+
.side-panel .icon-svg {
|
|
126
|
+
width: 20px;
|
|
127
|
+
height: 20px;
|
|
128
|
+
}
|
|
129
|
+
.side-panel .icon-svg-large {
|
|
130
|
+
margin-right: 4px;
|
|
131
|
+
margin-top: 5px;
|
|
132
|
+
}
|
|
139
133
|
.side-panel .button-container {
|
|
140
134
|
display: flex;
|
|
141
135
|
margin-top: 10px;
|
|
@@ -171,10 +165,7 @@
|
|
|
171
165
|
margin-bottom: 1em;
|
|
172
166
|
border: 1px solid #777;
|
|
173
167
|
}
|
|
174
|
-
.side-panel th
|
|
175
|
-
border: 1px solid #777;
|
|
176
|
-
padding: 8px;
|
|
177
|
-
}
|
|
168
|
+
.side-panel th,
|
|
178
169
|
.side-panel td {
|
|
179
170
|
border: 1px solid #777;
|
|
180
171
|
padding: 8px;
|
|
@@ -384,10 +375,7 @@
|
|
|
384
375
|
margin-bottom: 1em;
|
|
385
376
|
border: 1px solid #ddd;
|
|
386
377
|
}
|
|
387
|
-
.side-panel-dark th
|
|
388
|
-
border: 1px solid #ddd;
|
|
389
|
-
padding: 8px;
|
|
390
|
-
}
|
|
378
|
+
.side-panel-dark th,
|
|
391
379
|
.side-panel-dark td {
|
|
392
380
|
border: 1px solid #ddd;
|
|
393
381
|
padding: 8px;
|
package/dist/index.d.mts
CHANGED
|
@@ -21,6 +21,7 @@ interface ChatPanelProps {
|
|
|
21
21
|
thumbsUpClick?: (callId: string) => void;
|
|
22
22
|
thumbsDownClick?: (callId: string) => void;
|
|
23
23
|
theme?: "light" | "dark";
|
|
24
|
+
cssUrl?: string;
|
|
24
25
|
markdownClass?: string;
|
|
25
26
|
width?: string;
|
|
26
27
|
height?: string;
|
|
@@ -65,7 +66,6 @@ interface ExtraProps$1 extends React.HTMLAttributes<HTMLElement> {
|
|
|
65
66
|
declare const ChatPanel: React.FC<ChatPanelProps & ExtraProps$1>;
|
|
66
67
|
|
|
67
68
|
interface AgentPanelProps {
|
|
68
|
-
project_id: string;
|
|
69
69
|
customer?: LLMAsAServiceCustomer;
|
|
70
70
|
messages?: {
|
|
71
71
|
role: "user" | "assistant";
|
|
@@ -77,6 +77,9 @@ interface AgentPanelProps {
|
|
|
77
77
|
}[];
|
|
78
78
|
thumbsUpClick?: (callId: string) => void;
|
|
79
79
|
thumbsDownClick?: (callId: string) => void;
|
|
80
|
+
theme?: "light" | "dark";
|
|
81
|
+
width?: string;
|
|
82
|
+
height?: string;
|
|
80
83
|
url?: string;
|
|
81
84
|
prismStyle?: PrismStyle;
|
|
82
85
|
service?: string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ interface ChatPanelProps {
|
|
|
21
21
|
thumbsUpClick?: (callId: string) => void;
|
|
22
22
|
thumbsDownClick?: (callId: string) => void;
|
|
23
23
|
theme?: "light" | "dark";
|
|
24
|
+
cssUrl?: string;
|
|
24
25
|
markdownClass?: string;
|
|
25
26
|
width?: string;
|
|
26
27
|
height?: string;
|
|
@@ -65,7 +66,6 @@ interface ExtraProps$1 extends React.HTMLAttributes<HTMLElement> {
|
|
|
65
66
|
declare const ChatPanel: React.FC<ChatPanelProps & ExtraProps$1>;
|
|
66
67
|
|
|
67
68
|
interface AgentPanelProps {
|
|
68
|
-
project_id: string;
|
|
69
69
|
customer?: LLMAsAServiceCustomer;
|
|
70
70
|
messages?: {
|
|
71
71
|
role: "user" | "assistant";
|
|
@@ -77,6 +77,9 @@ interface AgentPanelProps {
|
|
|
77
77
|
}[];
|
|
78
78
|
thumbsUpClick?: (callId: string) => void;
|
|
79
79
|
thumbsDownClick?: (callId: string) => void;
|
|
80
|
+
theme?: "light" | "dark";
|
|
81
|
+
width?: string;
|
|
82
|
+
height?: string;
|
|
80
83
|
url?: string;
|
|
81
84
|
prismStyle?: PrismStyle;
|
|
82
85
|
service?: string | null;
|
package/dist/index.js
CHANGED
|
@@ -175,6 +175,7 @@ var ChatPanel = ({
|
|
|
175
175
|
thumbsUpClick,
|
|
176
176
|
thumbsDownClick,
|
|
177
177
|
theme = "light",
|
|
178
|
+
cssUrl = "",
|
|
178
179
|
markdownClass = null,
|
|
179
180
|
width = "300px",
|
|
180
181
|
height = "100vh",
|
|
@@ -240,6 +241,15 @@ var ChatPanel = ({
|
|
|
240
241
|
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
241
242
|
};
|
|
242
243
|
}, []);
|
|
244
|
+
(0, import_react3.useEffect)(() => {
|
|
245
|
+
if (cssUrl && cssUrl !== "") {
|
|
246
|
+
const link = document.createElement("link");
|
|
247
|
+
link.href = cssUrl;
|
|
248
|
+
link.rel = "stylesheet";
|
|
249
|
+
document.head.appendChild(link);
|
|
250
|
+
console.log("Added css link", link);
|
|
251
|
+
}
|
|
252
|
+
}, [cssUrl]);
|
|
243
253
|
(0, import_react3.useEffect)(() => {
|
|
244
254
|
if (response && response.length > 0) {
|
|
245
255
|
setIsLoading(false);
|
|
@@ -1085,7 +1095,7 @@ var import_react4 = __toESM(require("react"));
|
|
|
1085
1095
|
var import_material_dark2 = __toESM(require("react-syntax-highlighter/dist/esm/styles/prism/material-dark.js"));
|
|
1086
1096
|
var import_material_light2 = __toESM(require("react-syntax-highlighter/dist/esm/styles/prism/material-light.js"));
|
|
1087
1097
|
var AgentPanel = ({
|
|
1088
|
-
project_id,
|
|
1098
|
+
//project_id,
|
|
1089
1099
|
//initialPrompt = "",
|
|
1090
1100
|
//title = "Chat",
|
|
1091
1101
|
//placeholder = "Type a message",
|
|
@@ -1095,16 +1105,16 @@ var AgentPanel = ({
|
|
|
1095
1105
|
data = [],
|
|
1096
1106
|
thumbsUpClick,
|
|
1097
1107
|
thumbsDownClick,
|
|
1098
|
-
|
|
1108
|
+
theme,
|
|
1099
1109
|
//markdownClass = null,
|
|
1100
|
-
|
|
1101
|
-
|
|
1110
|
+
width,
|
|
1111
|
+
height,
|
|
1102
1112
|
url = "https://chat.llmasaservice.io/",
|
|
1103
1113
|
//scrollToEnd = false,
|
|
1104
1114
|
//initialMessage = "",
|
|
1105
1115
|
//prismStyle = theme === "light" ? materialLight : materialDark,
|
|
1106
1116
|
service = null,
|
|
1107
|
-
historyChangedCallback =
|
|
1117
|
+
historyChangedCallback = void 0,
|
|
1108
1118
|
//promptTemplate = "",
|
|
1109
1119
|
actions = [],
|
|
1110
1120
|
//showSaveButton = true,
|
|
@@ -1123,7 +1133,7 @@ var AgentPanel = ({
|
|
|
1123
1133
|
//ragQueryLimit = 10,
|
|
1124
1134
|
//ragRankLimit = 5,
|
|
1125
1135
|
}) => {
|
|
1126
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
1136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
1127
1137
|
const [followOnPrompt, setFollowOnPrompt] = (0, import_react4.useState)("");
|
|
1128
1138
|
const searchParams = new URLSearchParams(location.search);
|
|
1129
1139
|
const customer_id = searchParams.get("customer_id") || "";
|
|
@@ -1143,13 +1153,6 @@ var AgentPanel = ({
|
|
|
1143
1153
|
);
|
|
1144
1154
|
const data2 = yield response.json();
|
|
1145
1155
|
if (data2 && data2.length > 0) {
|
|
1146
|
-
if (data2 && data2[0].cssUrl && data2[0].cssUrl !== "") {
|
|
1147
|
-
const link = document.createElement("link");
|
|
1148
|
-
link.rel = "stylesheet";
|
|
1149
|
-
link.href = data2[0].cssUrl;
|
|
1150
|
-
document.head.appendChild(link);
|
|
1151
|
-
console.log("Added css link", link);
|
|
1152
|
-
}
|
|
1153
1156
|
setAgentData(data2[0]);
|
|
1154
1157
|
}
|
|
1155
1158
|
} catch (error) {
|
|
@@ -1181,19 +1184,16 @@ var AgentPanel = ({
|
|
|
1181
1184
|
service: (agentData == null ? void 0 : agentData.groupId) || null,
|
|
1182
1185
|
url,
|
|
1183
1186
|
title: (_a = agentData == null ? void 0 : agentData.displayTitle) != null ? _a : "",
|
|
1184
|
-
theme: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? "light" : "dark",
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1187
|
+
theme: theme ? theme : (agentData == null ? void 0 : agentData.displayTheme) === "light" ? "light" : "dark",
|
|
1188
|
+
cssUrl: (_b = agentData == null ? void 0 : agentData.cssUrl) != null ? _b : "",
|
|
1189
|
+
height: height ? height : (_c = agentData == null ? void 0 : agentData.displayHeight) != null ? _c : "100vh",
|
|
1190
|
+
width: width ? width : (_d = agentData == null ? void 0 : agentData.displayWidth) != null ? _d : "100%",
|
|
1191
|
+
promptTemplate: (_e = agentData == null ? void 0 : agentData.displayPromptTemplate) != null ? _e : "{{prompt}}",
|
|
1192
|
+
initialMessage: (agentData == null ? void 0 : agentData.displayStartMessageOrPrompt) === "message" ? (_f = agentData == null ? void 0 : agentData.displayInitialMessageOrPrompt) != null ? _f : "" : void 0,
|
|
1193
|
+
initialPrompt: (agentData == null ? void 0 : agentData.displayStartMessageOrPrompt) === "prompt" ? (_g = agentData == null ? void 0 : agentData.displayInitialMessageOrPrompt) != null ? _g : "" : void 0,
|
|
1194
|
+
followOnQuestions: followOnQuestions ? followOnQuestions : (_i = (_h = agentData == null ? void 0 : agentData.displayFollowOnPrompts) == null ? void 0 : _h.split("|")) != null ? _i : [],
|
|
1191
1195
|
clearFollowOnQuestionsNextPrompt,
|
|
1192
|
-
historyChangedCallback
|
|
1193
|
-
if (history) {
|
|
1194
|
-
setFollowOnPrompt("");
|
|
1195
|
-
}
|
|
1196
|
-
},
|
|
1196
|
+
historyChangedCallback,
|
|
1197
1197
|
prismStyle: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? import_material_light2.default : import_material_dark2.default,
|
|
1198
1198
|
actions: [
|
|
1199
1199
|
...actions,
|
|
@@ -1201,23 +1201,25 @@ var AgentPanel = ({
|
|
|
1201
1201
|
],
|
|
1202
1202
|
followOnPrompt,
|
|
1203
1203
|
agent,
|
|
1204
|
-
placeholder: (
|
|
1205
|
-
hideInitialPrompt: (
|
|
1204
|
+
placeholder: (_j = agentData == null ? void 0 : agentData.displayPlaceholder) != null ? _j : "Type a message",
|
|
1205
|
+
hideInitialPrompt: (_k = agentData == null ? void 0 : agentData.displayHideInitialPrompt) != null ? _k : true,
|
|
1206
1206
|
data: [...data, { key: "data", data: agentData == null ? void 0 : agentData.data }],
|
|
1207
|
-
showEmailButton: (
|
|
1208
|
-
showSaveButton: (
|
|
1209
|
-
showCallToAction: (
|
|
1210
|
-
callToActionButtonText: (
|
|
1211
|
-
callToActionEmailAddress: (
|
|
1212
|
-
callToActionEmailSubject: (
|
|
1213
|
-
callToActionMustSendEmail: (
|
|
1207
|
+
showEmailButton: (_l = agentData == null ? void 0 : agentData.displayShowEmailButton) != null ? _l : true,
|
|
1208
|
+
showSaveButton: (_m = agentData == null ? void 0 : agentData.displayShowSaveButton) != null ? _m : true,
|
|
1209
|
+
showCallToAction: (_n = agentData == null ? void 0 : agentData.displayShowCallToAction) != null ? _n : false,
|
|
1210
|
+
callToActionButtonText: (_o = agentData == null ? void 0 : agentData.displayCallToActionButtonText) != null ? _o : "Submit",
|
|
1211
|
+
callToActionEmailAddress: (_p = agentData == null ? void 0 : agentData.displayCallToActionEmailAddress) != null ? _p : "",
|
|
1212
|
+
callToActionEmailSubject: (_q = agentData == null ? void 0 : agentData.displayCallToActionEmailSubject) != null ? _q : "Agent CTA Submitted",
|
|
1213
|
+
callToActionMustSendEmail: (_r = agentData == null ? void 0 : agentData.displayCallToActionMustSendEmail) != null ? _r : false,
|
|
1214
1214
|
customer: {
|
|
1215
|
-
customer_id: customer_id != null ? customer_id : "
|
|
1216
|
-
customer_user_email: customer_email != null ? customer_email : ""
|
|
1215
|
+
customer_id: customer ? customer.customer_id : customer_id != null ? customer_id : "",
|
|
1216
|
+
customer_user_email: customer ? customer.customer_user_email : customer_email != null ? customer_email : ""
|
|
1217
1217
|
},
|
|
1218
|
-
scrollToEnd: (
|
|
1219
|
-
ragQueryLimit: (
|
|
1220
|
-
ragRankLimit: (
|
|
1218
|
+
scrollToEnd: (_s = agentData == null ? void 0 : agentData.displayScrollToEnd) != null ? _s : false,
|
|
1219
|
+
ragQueryLimit: (_t = agentData == null ? void 0 : agentData.ragQueryLimit) != null ? _t : 10,
|
|
1220
|
+
ragRankLimit: (_u = agentData == null ? void 0 : agentData.ragRankLimit) != null ? _u : 5,
|
|
1221
|
+
showPoweredBy,
|
|
1222
|
+
messages
|
|
1221
1223
|
}
|
|
1222
1224
|
));
|
|
1223
1225
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -141,6 +141,7 @@ var ChatPanel = ({
|
|
|
141
141
|
thumbsUpClick,
|
|
142
142
|
thumbsDownClick,
|
|
143
143
|
theme = "light",
|
|
144
|
+
cssUrl = "",
|
|
144
145
|
markdownClass = null,
|
|
145
146
|
width = "300px",
|
|
146
147
|
height = "100vh",
|
|
@@ -206,6 +207,15 @@ var ChatPanel = ({
|
|
|
206
207
|
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
207
208
|
};
|
|
208
209
|
}, []);
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (cssUrl && cssUrl !== "") {
|
|
212
|
+
const link = document.createElement("link");
|
|
213
|
+
link.href = cssUrl;
|
|
214
|
+
link.rel = "stylesheet";
|
|
215
|
+
document.head.appendChild(link);
|
|
216
|
+
console.log("Added css link", link);
|
|
217
|
+
}
|
|
218
|
+
}, [cssUrl]);
|
|
209
219
|
useEffect(() => {
|
|
210
220
|
if (response && response.length > 0) {
|
|
211
221
|
setIsLoading(false);
|
|
@@ -1051,7 +1061,7 @@ import React4, { useEffect as useEffect2, useState as useState4 } from "react";
|
|
|
1051
1061
|
import materialDark2 from "react-syntax-highlighter/dist/esm/styles/prism/material-dark.js";
|
|
1052
1062
|
import materialLight2 from "react-syntax-highlighter/dist/esm/styles/prism/material-light.js";
|
|
1053
1063
|
var AgentPanel = ({
|
|
1054
|
-
project_id,
|
|
1064
|
+
//project_id,
|
|
1055
1065
|
//initialPrompt = "",
|
|
1056
1066
|
//title = "Chat",
|
|
1057
1067
|
//placeholder = "Type a message",
|
|
@@ -1061,16 +1071,16 @@ var AgentPanel = ({
|
|
|
1061
1071
|
data = [],
|
|
1062
1072
|
thumbsUpClick,
|
|
1063
1073
|
thumbsDownClick,
|
|
1064
|
-
|
|
1074
|
+
theme,
|
|
1065
1075
|
//markdownClass = null,
|
|
1066
|
-
|
|
1067
|
-
|
|
1076
|
+
width,
|
|
1077
|
+
height,
|
|
1068
1078
|
url = "https://chat.llmasaservice.io/",
|
|
1069
1079
|
//scrollToEnd = false,
|
|
1070
1080
|
//initialMessage = "",
|
|
1071
1081
|
//prismStyle = theme === "light" ? materialLight : materialDark,
|
|
1072
1082
|
service = null,
|
|
1073
|
-
historyChangedCallback =
|
|
1083
|
+
historyChangedCallback = void 0,
|
|
1074
1084
|
//promptTemplate = "",
|
|
1075
1085
|
actions = [],
|
|
1076
1086
|
//showSaveButton = true,
|
|
@@ -1089,7 +1099,7 @@ var AgentPanel = ({
|
|
|
1089
1099
|
//ragQueryLimit = 10,
|
|
1090
1100
|
//ragRankLimit = 5,
|
|
1091
1101
|
}) => {
|
|
1092
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
1102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
1093
1103
|
const [followOnPrompt, setFollowOnPrompt] = useState4("");
|
|
1094
1104
|
const searchParams = new URLSearchParams(location.search);
|
|
1095
1105
|
const customer_id = searchParams.get("customer_id") || "";
|
|
@@ -1109,13 +1119,6 @@ var AgentPanel = ({
|
|
|
1109
1119
|
);
|
|
1110
1120
|
const data2 = yield response.json();
|
|
1111
1121
|
if (data2 && data2.length > 0) {
|
|
1112
|
-
if (data2 && data2[0].cssUrl && data2[0].cssUrl !== "") {
|
|
1113
|
-
const link = document.createElement("link");
|
|
1114
|
-
link.rel = "stylesheet";
|
|
1115
|
-
link.href = data2[0].cssUrl;
|
|
1116
|
-
document.head.appendChild(link);
|
|
1117
|
-
console.log("Added css link", link);
|
|
1118
|
-
}
|
|
1119
1122
|
setAgentData(data2[0]);
|
|
1120
1123
|
}
|
|
1121
1124
|
} catch (error) {
|
|
@@ -1147,19 +1150,16 @@ var AgentPanel = ({
|
|
|
1147
1150
|
service: (agentData == null ? void 0 : agentData.groupId) || null,
|
|
1148
1151
|
url,
|
|
1149
1152
|
title: (_a = agentData == null ? void 0 : agentData.displayTitle) != null ? _a : "",
|
|
1150
|
-
theme: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? "light" : "dark",
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1153
|
+
theme: theme ? theme : (agentData == null ? void 0 : agentData.displayTheme) === "light" ? "light" : "dark",
|
|
1154
|
+
cssUrl: (_b = agentData == null ? void 0 : agentData.cssUrl) != null ? _b : "",
|
|
1155
|
+
height: height ? height : (_c = agentData == null ? void 0 : agentData.displayHeight) != null ? _c : "100vh",
|
|
1156
|
+
width: width ? width : (_d = agentData == null ? void 0 : agentData.displayWidth) != null ? _d : "100%",
|
|
1157
|
+
promptTemplate: (_e = agentData == null ? void 0 : agentData.displayPromptTemplate) != null ? _e : "{{prompt}}",
|
|
1158
|
+
initialMessage: (agentData == null ? void 0 : agentData.displayStartMessageOrPrompt) === "message" ? (_f = agentData == null ? void 0 : agentData.displayInitialMessageOrPrompt) != null ? _f : "" : void 0,
|
|
1159
|
+
initialPrompt: (agentData == null ? void 0 : agentData.displayStartMessageOrPrompt) === "prompt" ? (_g = agentData == null ? void 0 : agentData.displayInitialMessageOrPrompt) != null ? _g : "" : void 0,
|
|
1160
|
+
followOnQuestions: followOnQuestions ? followOnQuestions : (_i = (_h = agentData == null ? void 0 : agentData.displayFollowOnPrompts) == null ? void 0 : _h.split("|")) != null ? _i : [],
|
|
1157
1161
|
clearFollowOnQuestionsNextPrompt,
|
|
1158
|
-
historyChangedCallback
|
|
1159
|
-
if (history) {
|
|
1160
|
-
setFollowOnPrompt("");
|
|
1161
|
-
}
|
|
1162
|
-
},
|
|
1162
|
+
historyChangedCallback,
|
|
1163
1163
|
prismStyle: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? materialLight2 : materialDark2,
|
|
1164
1164
|
actions: [
|
|
1165
1165
|
...actions,
|
|
@@ -1167,23 +1167,25 @@ var AgentPanel = ({
|
|
|
1167
1167
|
],
|
|
1168
1168
|
followOnPrompt,
|
|
1169
1169
|
agent,
|
|
1170
|
-
placeholder: (
|
|
1171
|
-
hideInitialPrompt: (
|
|
1170
|
+
placeholder: (_j = agentData == null ? void 0 : agentData.displayPlaceholder) != null ? _j : "Type a message",
|
|
1171
|
+
hideInitialPrompt: (_k = agentData == null ? void 0 : agentData.displayHideInitialPrompt) != null ? _k : true,
|
|
1172
1172
|
data: [...data, { key: "data", data: agentData == null ? void 0 : agentData.data }],
|
|
1173
|
-
showEmailButton: (
|
|
1174
|
-
showSaveButton: (
|
|
1175
|
-
showCallToAction: (
|
|
1176
|
-
callToActionButtonText: (
|
|
1177
|
-
callToActionEmailAddress: (
|
|
1178
|
-
callToActionEmailSubject: (
|
|
1179
|
-
callToActionMustSendEmail: (
|
|
1173
|
+
showEmailButton: (_l = agentData == null ? void 0 : agentData.displayShowEmailButton) != null ? _l : true,
|
|
1174
|
+
showSaveButton: (_m = agentData == null ? void 0 : agentData.displayShowSaveButton) != null ? _m : true,
|
|
1175
|
+
showCallToAction: (_n = agentData == null ? void 0 : agentData.displayShowCallToAction) != null ? _n : false,
|
|
1176
|
+
callToActionButtonText: (_o = agentData == null ? void 0 : agentData.displayCallToActionButtonText) != null ? _o : "Submit",
|
|
1177
|
+
callToActionEmailAddress: (_p = agentData == null ? void 0 : agentData.displayCallToActionEmailAddress) != null ? _p : "",
|
|
1178
|
+
callToActionEmailSubject: (_q = agentData == null ? void 0 : agentData.displayCallToActionEmailSubject) != null ? _q : "Agent CTA Submitted",
|
|
1179
|
+
callToActionMustSendEmail: (_r = agentData == null ? void 0 : agentData.displayCallToActionMustSendEmail) != null ? _r : false,
|
|
1180
1180
|
customer: {
|
|
1181
|
-
customer_id: customer_id != null ? customer_id : "
|
|
1182
|
-
customer_user_email: customer_email != null ? customer_email : ""
|
|
1181
|
+
customer_id: customer ? customer.customer_id : customer_id != null ? customer_id : "",
|
|
1182
|
+
customer_user_email: customer ? customer.customer_user_email : customer_email != null ? customer_email : ""
|
|
1183
1183
|
},
|
|
1184
|
-
scrollToEnd: (
|
|
1185
|
-
ragQueryLimit: (
|
|
1186
|
-
ragRankLimit: (
|
|
1184
|
+
scrollToEnd: (_s = agentData == null ? void 0 : agentData.displayScrollToEnd) != null ? _s : false,
|
|
1185
|
+
ragQueryLimit: (_t = agentData == null ? void 0 : agentData.ragQueryLimit) != null ? _t : 10,
|
|
1186
|
+
ragRankLimit: (_u = agentData == null ? void 0 : agentData.ragRankLimit) != null ? _u : 5,
|
|
1187
|
+
showPoweredBy,
|
|
1188
|
+
messages
|
|
1187
1189
|
}
|
|
1188
1190
|
));
|
|
1189
1191
|
};
|
package/package.json
CHANGED
package/src/AgentPanel.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { LLMAsAServiceCustomer } from "llmasaservice-client";
|
|
|
6
6
|
import PrismStyle from "react-syntax-highlighter";
|
|
7
7
|
|
|
8
8
|
export interface AgentPanelProps {
|
|
9
|
-
project_id: string;
|
|
9
|
+
//project_id: string;
|
|
10
10
|
//initialPrompt?: string;
|
|
11
11
|
//initialMessage?: string;
|
|
12
12
|
//title?: string;
|
|
@@ -17,10 +17,10 @@ export interface AgentPanelProps {
|
|
|
17
17
|
data?: { key: string; data: string }[];
|
|
18
18
|
thumbsUpClick?: (callId: string) => void;
|
|
19
19
|
thumbsDownClick?: (callId: string) => void;
|
|
20
|
-
|
|
20
|
+
theme?: "light" | "dark";
|
|
21
21
|
//markdownClass?: string;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
width?: string;
|
|
23
|
+
height?: string;
|
|
24
24
|
url?: string;
|
|
25
25
|
//scrollToEnd?: boolean;
|
|
26
26
|
prismStyle?: PrismStyle;
|
|
@@ -58,7 +58,7 @@ interface ExtraProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
|
|
61
|
-
project_id,
|
|
61
|
+
//project_id,
|
|
62
62
|
//initialPrompt = "",
|
|
63
63
|
//title = "Chat",
|
|
64
64
|
//placeholder = "Type a message",
|
|
@@ -68,16 +68,16 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
|
|
|
68
68
|
data = [],
|
|
69
69
|
thumbsUpClick,
|
|
70
70
|
thumbsDownClick,
|
|
71
|
-
|
|
71
|
+
theme,
|
|
72
72
|
//markdownClass = null,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
width,
|
|
74
|
+
height,
|
|
75
75
|
url = "https://chat.llmasaservice.io/",
|
|
76
76
|
//scrollToEnd = false,
|
|
77
77
|
//initialMessage = "",
|
|
78
78
|
//prismStyle = theme === "light" ? materialLight : materialDark,
|
|
79
79
|
service = null,
|
|
80
|
-
historyChangedCallback =
|
|
80
|
+
historyChangedCallback = undefined,
|
|
81
81
|
//promptTemplate = "",
|
|
82
82
|
actions = [],
|
|
83
83
|
//showSaveButton = true,
|
|
@@ -119,15 +119,6 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
|
|
|
119
119
|
|
|
120
120
|
const data = await response.json();
|
|
121
121
|
if (data && data.length > 0) {
|
|
122
|
-
//console.log("data", data);
|
|
123
|
-
if (data && data[0].cssUrl && data[0].cssUrl !== "") {
|
|
124
|
-
const link = document.createElement("link");
|
|
125
|
-
link.rel = "stylesheet";
|
|
126
|
-
link.href = data[0].cssUrl; // "https://dev.llmasaservice.io/themes/simple.css";
|
|
127
|
-
document.head.appendChild(link);
|
|
128
|
-
console.log("Added css link", link);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
122
|
setAgentData(data[0]);
|
|
132
123
|
}
|
|
133
124
|
} catch (error) {
|
|
@@ -167,9 +158,10 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
|
|
|
167
158
|
service={agentData?.groupId || null}
|
|
168
159
|
url={url}
|
|
169
160
|
title={agentData?.displayTitle ?? ""}
|
|
170
|
-
theme={agentData?.displayTheme === "light" ? "light" : "dark"}
|
|
171
|
-
|
|
172
|
-
|
|
161
|
+
theme={theme ? theme : agentData?.displayTheme === "light" ? "light" : "dark"}
|
|
162
|
+
cssUrl={agentData?.cssUrl ?? ""}
|
|
163
|
+
height={height ? height : agentData?.displayHeight ?? "100vh"}
|
|
164
|
+
width={width ? width : agentData?.displayWidth ?? "100%"}
|
|
173
165
|
promptTemplate={agentData?.displayPromptTemplate ?? "{{prompt}}"}
|
|
174
166
|
initialMessage={
|
|
175
167
|
agentData?.displayStartMessageOrPrompt === "message"
|
|
@@ -187,11 +179,7 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
|
|
|
187
179
|
: agentData?.displayFollowOnPrompts?.split("|") ?? []
|
|
188
180
|
}
|
|
189
181
|
clearFollowOnQuestionsNextPrompt={clearFollowOnQuestionsNextPrompt}
|
|
190
|
-
historyChangedCallback={
|
|
191
|
-
if (history) {
|
|
192
|
-
setFollowOnPrompt("");
|
|
193
|
-
}
|
|
194
|
-
}}
|
|
182
|
+
historyChangedCallback={historyChangedCallback}
|
|
195
183
|
prismStyle={
|
|
196
184
|
(agentData?.displayTheme === "light"
|
|
197
185
|
? materialLight
|
|
@@ -222,12 +210,16 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
|
|
|
222
210
|
agentData?.displayCallToActionMustSendEmail ?? false
|
|
223
211
|
}
|
|
224
212
|
customer={{
|
|
225
|
-
customer_id: customer_id ?? "
|
|
226
|
-
customer_user_email:
|
|
213
|
+
customer_id: customer ? customer.customer_id : customer_id ?? "",
|
|
214
|
+
customer_user_email: customer
|
|
215
|
+
? customer.customer_user_email
|
|
216
|
+
: customer_email ?? "",
|
|
227
217
|
}}
|
|
228
218
|
scrollToEnd={agentData?.displayScrollToEnd ?? false}
|
|
229
219
|
ragQueryLimit={agentData?.ragQueryLimit ?? 10}
|
|
230
220
|
ragRankLimit={agentData?.ragRankLimit ?? 5}
|
|
221
|
+
showPoweredBy={showPoweredBy}
|
|
222
|
+
messages={messages}
|
|
231
223
|
/>
|
|
232
224
|
)}
|
|
233
225
|
</>
|
package/src/ChatPanel.css
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
|
+
/* --------------------------------------------------------
|
|
2
|
+
SIDE PANEL (Light Theme)
|
|
3
|
+
-------------------------------------------------------- */
|
|
4
|
+
|
|
5
|
+
/* Base container for side panel */
|
|
1
6
|
.side-panel {
|
|
2
7
|
font-family: "Roboto", Arial, Helvetica, sans-serif;
|
|
3
8
|
font-size: small;
|
|
4
|
-
color: #
|
|
5
|
-
background-color: #
|
|
9
|
+
color: #1a1a1a;
|
|
10
|
+
background-color: #ffffff;
|
|
6
11
|
display: flex;
|
|
7
12
|
flex-direction: column;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
padding: 10px;
|
|
10
|
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
|
11
|
-
max-height: 90%;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
/* Title inside side panel */
|
|
14
16
|
.side-panel .title {
|
|
15
|
-
font-size:
|
|
17
|
+
font-size: 1.5rem;
|
|
16
18
|
font-weight: bold;
|
|
17
|
-
|
|
19
|
+
padding: 0.5rem 0.75rem;
|
|
20
|
+
margin-bottom: 0.75rem;
|
|
21
|
+
border-bottom: 1px solid #e5e7eb;
|
|
18
22
|
text-align: center;
|
|
19
23
|
color: #007bff;
|
|
20
24
|
}
|
|
21
|
-
|
|
25
|
+
|
|
26
|
+
/* Input container */
|
|
22
27
|
.side-panel .input-container {
|
|
23
28
|
display: flex;
|
|
24
29
|
flex-direction: row;
|
|
@@ -26,6 +31,7 @@
|
|
|
26
31
|
margin-top: 5px;
|
|
27
32
|
}
|
|
28
33
|
|
|
34
|
+
/* Textarea styling */
|
|
29
35
|
.side-panel textarea {
|
|
30
36
|
flex: 1;
|
|
31
37
|
padding: 10px;
|
|
@@ -39,6 +45,7 @@
|
|
|
39
45
|
background-color: #fff;
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
/* Send button */
|
|
42
49
|
.side-panel .send-button {
|
|
43
50
|
background-color: lightblue;
|
|
44
51
|
color: #0056b3;
|
|
@@ -57,20 +64,23 @@
|
|
|
57
64
|
color: white;
|
|
58
65
|
}
|
|
59
66
|
|
|
67
|
+
/* History entry container */
|
|
60
68
|
.side-panel .history-entry {
|
|
61
|
-
background-color:
|
|
69
|
+
background-color: white;
|
|
62
70
|
padding-bottom: 10px;
|
|
63
71
|
border-radius: 10px;
|
|
64
72
|
}
|
|
65
73
|
|
|
74
|
+
/* Response area (scrollable container) */
|
|
66
75
|
.side-panel .responseArea {
|
|
67
76
|
flex: 1;
|
|
68
|
-
background-color:
|
|
77
|
+
background-color: white;
|
|
69
78
|
border-radius: 10px;
|
|
70
79
|
overflow-y: auto;
|
|
71
80
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
72
81
|
}
|
|
73
82
|
|
|
83
|
+
/* Chat prompt bubble */
|
|
74
84
|
.side-panel .prompt {
|
|
75
85
|
align-self: flex-start;
|
|
76
86
|
padding: 10px;
|
|
@@ -86,6 +96,7 @@
|
|
|
86
96
|
color: #000;
|
|
87
97
|
}
|
|
88
98
|
|
|
99
|
+
/* Chat response bubble */
|
|
89
100
|
.side-panel .response {
|
|
90
101
|
align-self: flex-end;
|
|
91
102
|
padding: 10px;
|
|
@@ -95,10 +106,11 @@
|
|
|
95
106
|
margin-left: 5%;
|
|
96
107
|
max-width: 90%;
|
|
97
108
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
98
|
-
background:
|
|
109
|
+
background: #e0f7fa;
|
|
99
110
|
color: #000;
|
|
100
111
|
}
|
|
101
112
|
|
|
113
|
+
/* Copy button */
|
|
102
114
|
.side-panel .copy-button {
|
|
103
115
|
font-size: 12px;
|
|
104
116
|
border: 0;
|
|
@@ -112,23 +124,7 @@
|
|
|
112
124
|
align-items: center;
|
|
113
125
|
}
|
|
114
126
|
|
|
115
|
-
|
|
116
|
-
width: 20px;
|
|
117
|
-
height: 20px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.side-panel .icon-svg-large {
|
|
121
|
-
margin-right: 4px;
|
|
122
|
-
margin-top: 5px;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.side-panel .copy-button:hover,
|
|
126
|
-
.side-panel .thumbs-button:hover {
|
|
127
|
-
color: white;
|
|
128
|
-
border-radius: 50%;
|
|
129
|
-
background-color: #0056b3;
|
|
130
|
-
}
|
|
131
|
-
|
|
127
|
+
/* Thumbs button (same style as copy button) */
|
|
132
128
|
.side-panel .thumbs-button {
|
|
133
129
|
font-size: 12px;
|
|
134
130
|
border: 0;
|
|
@@ -142,11 +138,32 @@
|
|
|
142
138
|
align-items: center;
|
|
143
139
|
}
|
|
144
140
|
|
|
141
|
+
/* Hover state for copy and thumbs buttons */
|
|
142
|
+
.side-panel .copy-button:hover,
|
|
143
|
+
.side-panel .thumbs-button:hover {
|
|
144
|
+
color: white;
|
|
145
|
+
border-radius: 50%;
|
|
146
|
+
background-color: #0056b3;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* SVG icons */
|
|
150
|
+
.side-panel .icon-svg {
|
|
151
|
+
width: 20px;
|
|
152
|
+
height: 20px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.side-panel .icon-svg-large {
|
|
156
|
+
margin-right: 4px;
|
|
157
|
+
margin-top: 5px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Button container for layout */
|
|
145
161
|
.side-panel .button-container {
|
|
146
162
|
display: flex;
|
|
147
163
|
margin-top: 10px;
|
|
148
164
|
}
|
|
149
165
|
|
|
166
|
+
/* Button container for actions (with spacing) */
|
|
150
167
|
.side-panel .button-container-actions {
|
|
151
168
|
display: flex;
|
|
152
169
|
margin-top: 10px;
|
|
@@ -154,6 +171,7 @@
|
|
|
154
171
|
gap: 5px;
|
|
155
172
|
}
|
|
156
173
|
|
|
174
|
+
/* Scroll button (fixed at bottom center) */
|
|
157
175
|
.side-panel .scroll-button {
|
|
158
176
|
position: absolute;
|
|
159
177
|
left: 50%;
|
|
@@ -176,22 +194,20 @@
|
|
|
176
194
|
background-color: #0056b3;
|
|
177
195
|
}
|
|
178
196
|
|
|
197
|
+
/* Table styling */
|
|
179
198
|
.side-panel table {
|
|
180
199
|
border-collapse: collapse;
|
|
181
200
|
margin-bottom: 1em;
|
|
182
201
|
border: 1px solid #777;
|
|
183
202
|
}
|
|
184
203
|
|
|
185
|
-
.side-panel th
|
|
186
|
-
border: 1px solid #777;
|
|
187
|
-
padding: 8px;
|
|
188
|
-
}
|
|
189
|
-
|
|
204
|
+
.side-panel th,
|
|
190
205
|
.side-panel td {
|
|
191
206
|
border: 1px solid #777;
|
|
192
207
|
padding: 8px;
|
|
193
208
|
}
|
|
194
209
|
|
|
210
|
+
/* Save button */
|
|
195
211
|
.side-panel .save-button {
|
|
196
212
|
flex: 1;
|
|
197
213
|
background-color: lightblue;
|
|
@@ -210,11 +226,13 @@
|
|
|
210
226
|
color: white;
|
|
211
227
|
}
|
|
212
228
|
|
|
229
|
+
/* Suggestion buttons container */
|
|
213
230
|
.suggestions-container {
|
|
214
231
|
display: flex;
|
|
215
232
|
flex-wrap: wrap;
|
|
216
233
|
}
|
|
217
234
|
|
|
235
|
+
/* Suggestion button */
|
|
218
236
|
.side-panel .suggestion-button {
|
|
219
237
|
background-color: lightblue;
|
|
220
238
|
color: #0056b3;
|
|
@@ -237,6 +255,11 @@
|
|
|
237
255
|
cursor: not-allowed;
|
|
238
256
|
}
|
|
239
257
|
|
|
258
|
+
/* --------------------------------------------------------
|
|
259
|
+
SIDE PANEL (Dark Theme)
|
|
260
|
+
-------------------------------------------------------- */
|
|
261
|
+
|
|
262
|
+
/* Base container for dark side panel */
|
|
240
263
|
.side-panel-dark {
|
|
241
264
|
font-family: "Roboto", Arial, Helvetica, sans-serif;
|
|
242
265
|
font-size: small;
|
|
@@ -249,18 +272,24 @@
|
|
|
249
272
|
box-shadow: 5px 0 5px rgba(0, 0, 0, 0.1);
|
|
250
273
|
max-height: 90%;
|
|
251
274
|
}
|
|
275
|
+
|
|
276
|
+
/* Title */
|
|
252
277
|
.side-panel-dark .title {
|
|
253
278
|
font-size: 24px;
|
|
254
279
|
font-weight: bold;
|
|
255
280
|
margin-bottom: 10px;
|
|
256
281
|
text-align: center;
|
|
257
282
|
}
|
|
283
|
+
|
|
284
|
+
/* Input container */
|
|
258
285
|
.side-panel-dark .input-container {
|
|
259
286
|
display: flex;
|
|
260
287
|
flex-direction: row;
|
|
261
288
|
align-items: center;
|
|
262
289
|
margin-top: 5px;
|
|
263
290
|
}
|
|
291
|
+
|
|
292
|
+
/* Textarea */
|
|
264
293
|
.side-panel-dark textarea {
|
|
265
294
|
flex: 1;
|
|
266
295
|
padding: 10px;
|
|
@@ -272,6 +301,8 @@
|
|
|
272
301
|
color: #333;
|
|
273
302
|
border: 1px solid #ddd;
|
|
274
303
|
}
|
|
304
|
+
|
|
305
|
+
/* Send button */
|
|
275
306
|
.side-panel-dark .send-button {
|
|
276
307
|
background-color: #424242;
|
|
277
308
|
color: white;
|
|
@@ -286,15 +317,20 @@
|
|
|
286
317
|
box-shadow: 0 4px 6px rgba(0, 123, 255, 0.3);
|
|
287
318
|
transition: background-color 0.3s ease, transform 0.3s ease;
|
|
288
319
|
}
|
|
320
|
+
|
|
289
321
|
.side-panel-dark .send-button:hover {
|
|
290
322
|
background-color: #0056b3;
|
|
291
323
|
transform: scale(1.1);
|
|
292
324
|
}
|
|
325
|
+
|
|
326
|
+
/* History entry */
|
|
293
327
|
.side-panel-dark .history-entry {
|
|
294
328
|
background-color: #424242;
|
|
295
329
|
padding-bottom: 10px;
|
|
296
330
|
border-radius: 10px;
|
|
297
331
|
}
|
|
332
|
+
|
|
333
|
+
/* Response area */
|
|
298
334
|
.side-panel-dark .responseArea {
|
|
299
335
|
flex: 1;
|
|
300
336
|
background-color: #424242;
|
|
@@ -302,6 +338,8 @@
|
|
|
302
338
|
overflow-y: auto;
|
|
303
339
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
304
340
|
}
|
|
341
|
+
|
|
342
|
+
/* Chat prompt bubble */
|
|
305
343
|
.side-panel-dark .prompt {
|
|
306
344
|
align-self: flex-start;
|
|
307
345
|
background-color: #303030;
|
|
@@ -315,6 +353,8 @@
|
|
|
315
353
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
316
354
|
white-space: pre-wrap;
|
|
317
355
|
}
|
|
356
|
+
|
|
357
|
+
/* Chat response bubble */
|
|
318
358
|
.side-panel-dark .response {
|
|
319
359
|
align-self: flex-end;
|
|
320
360
|
padding: 10px;
|
|
@@ -326,6 +366,8 @@
|
|
|
326
366
|
background-color: #3a3737;
|
|
327
367
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
328
368
|
}
|
|
369
|
+
|
|
370
|
+
/* Copy button */
|
|
329
371
|
.side-panel-dark .copy-button {
|
|
330
372
|
font-size: 12px;
|
|
331
373
|
border: 0;
|
|
@@ -338,20 +380,27 @@
|
|
|
338
380
|
justify-content: center;
|
|
339
381
|
align-items: center;
|
|
340
382
|
}
|
|
383
|
+
|
|
384
|
+
/* SVG icons */
|
|
341
385
|
.side-panel-dark .icon-svg {
|
|
342
386
|
width: 20px;
|
|
343
387
|
height: 20px;
|
|
344
388
|
}
|
|
389
|
+
|
|
345
390
|
.side-panel-dark .icon-svg-large {
|
|
346
391
|
margin-right: 4px;
|
|
347
392
|
margin-top: 5px;
|
|
348
393
|
}
|
|
394
|
+
|
|
395
|
+
/* Hover state for copy and thumbs buttons */
|
|
349
396
|
.side-panel-dark .copy-button:hover,
|
|
350
397
|
.side-panel-dark .thumbs-button:hover {
|
|
351
398
|
color: #0056b3;
|
|
352
399
|
border-radius: 50%;
|
|
353
400
|
background-color: #e2e6ea;
|
|
354
401
|
}
|
|
402
|
+
|
|
403
|
+
/* Thumbs button */
|
|
355
404
|
.side-panel-dark .thumbs-button {
|
|
356
405
|
font-size: 12px;
|
|
357
406
|
border: 0;
|
|
@@ -365,6 +414,7 @@
|
|
|
365
414
|
align-items: center;
|
|
366
415
|
}
|
|
367
416
|
|
|
417
|
+
/* Button containers */
|
|
368
418
|
.side-panel-dark .button-container {
|
|
369
419
|
display: flex;
|
|
370
420
|
margin-top: 10px;
|
|
@@ -377,6 +427,7 @@
|
|
|
377
427
|
gap: 5px;
|
|
378
428
|
}
|
|
379
429
|
|
|
430
|
+
/* Scroll button */
|
|
380
431
|
.side-panel-dark .scroll-button {
|
|
381
432
|
position: absolute;
|
|
382
433
|
left: 50%;
|
|
@@ -399,22 +450,20 @@
|
|
|
399
450
|
background-color: #0056b3;
|
|
400
451
|
}
|
|
401
452
|
|
|
453
|
+
/* Table styling */
|
|
402
454
|
.side-panel-dark table {
|
|
403
455
|
border-collapse: collapse;
|
|
404
456
|
margin-bottom: 1em;
|
|
405
457
|
border: 1px solid #ddd;
|
|
406
458
|
}
|
|
407
459
|
|
|
408
|
-
.side-panel-dark th
|
|
409
|
-
border: 1px solid #ddd;
|
|
410
|
-
padding: 8px;
|
|
411
|
-
}
|
|
412
|
-
|
|
460
|
+
.side-panel-dark th,
|
|
413
461
|
.side-panel-dark td {
|
|
414
462
|
border: 1px solid #ddd;
|
|
415
463
|
padding: 8px;
|
|
416
464
|
}
|
|
417
465
|
|
|
466
|
+
/* Links */
|
|
418
467
|
.side-panel-dark a {
|
|
419
468
|
color: #ddd;
|
|
420
469
|
}
|
|
@@ -423,6 +472,7 @@
|
|
|
423
472
|
color: #fff;
|
|
424
473
|
}
|
|
425
474
|
|
|
475
|
+
/* Save button */
|
|
426
476
|
.side-panel-dark .save-button {
|
|
427
477
|
flex: 1;
|
|
428
478
|
background-color: #3a3737;
|
|
@@ -440,6 +490,7 @@
|
|
|
440
490
|
color: white;
|
|
441
491
|
}
|
|
442
492
|
|
|
493
|
+
/* Suggestion button */
|
|
443
494
|
.side-panel-dark .suggestion-button {
|
|
444
495
|
background-color: #0056b3;
|
|
445
496
|
color: white;
|
|
@@ -456,6 +507,10 @@
|
|
|
456
507
|
color: black;
|
|
457
508
|
}
|
|
458
509
|
|
|
510
|
+
/* --------------------------------------------------------
|
|
511
|
+
POWERED BY / FOOTER
|
|
512
|
+
-------------------------------------------------------- */
|
|
513
|
+
|
|
459
514
|
.powered-by {
|
|
460
515
|
margin-top: 3px;
|
|
461
516
|
display: flex;
|
|
@@ -472,6 +527,11 @@
|
|
|
472
527
|
text-decoration: underline;
|
|
473
528
|
}
|
|
474
529
|
|
|
530
|
+
/* --------------------------------------------------------
|
|
531
|
+
MODAL DIALOG
|
|
532
|
+
-------------------------------------------------------- */
|
|
533
|
+
|
|
534
|
+
/* Modal overlay (full screen dim background) */
|
|
475
535
|
.modal-overlay {
|
|
476
536
|
position: fixed;
|
|
477
537
|
top: 0;
|
|
@@ -484,6 +544,7 @@
|
|
|
484
544
|
align-items: center;
|
|
485
545
|
}
|
|
486
546
|
|
|
547
|
+
/* Modal content container */
|
|
487
548
|
.modal-content {
|
|
488
549
|
background: white;
|
|
489
550
|
padding: 5px;
|
|
@@ -493,16 +554,19 @@
|
|
|
493
554
|
color: #333;
|
|
494
555
|
}
|
|
495
556
|
|
|
557
|
+
/* Modal text */
|
|
496
558
|
.modal-text {
|
|
497
559
|
color: black;
|
|
498
560
|
}
|
|
499
561
|
|
|
562
|
+
/* Modal buttons container */
|
|
500
563
|
.modal-buttons {
|
|
501
564
|
padding: 5px 10px;
|
|
502
565
|
display: flex;
|
|
503
566
|
justify-content: space-between;
|
|
504
567
|
}
|
|
505
568
|
|
|
569
|
+
/* Modal button styling */
|
|
506
570
|
.modal-buttons button {
|
|
507
571
|
padding: 5px 10px;
|
|
508
572
|
border: none;
|
|
@@ -510,19 +574,27 @@
|
|
|
510
574
|
cursor: pointer;
|
|
511
575
|
}
|
|
512
576
|
|
|
577
|
+
/* First modal button */
|
|
513
578
|
.modal-buttons button:first-child {
|
|
514
579
|
background: #ccc;
|
|
515
580
|
}
|
|
516
581
|
|
|
582
|
+
/* Second modal button */
|
|
517
583
|
.modal-buttons button:last-child {
|
|
518
584
|
background: #007bff;
|
|
519
585
|
color: white;
|
|
520
586
|
}
|
|
521
587
|
|
|
588
|
+
/* --------------------------------------------------------
|
|
589
|
+
FORM ERROR STYLING
|
|
590
|
+
-------------------------------------------------------- */
|
|
591
|
+
|
|
592
|
+
/* Invalid field outline */
|
|
522
593
|
.invalid {
|
|
523
594
|
border-color: red;
|
|
524
595
|
}
|
|
525
596
|
|
|
597
|
+
/* Error message text */
|
|
526
598
|
.error-message {
|
|
527
599
|
color: red;
|
|
528
600
|
font-size: 0.8em;
|
package/src/ChatPanel.tsx
CHANGED
|
@@ -26,6 +26,7 @@ export interface ChatPanelProps {
|
|
|
26
26
|
thumbsUpClick?: (callId: string) => void;
|
|
27
27
|
thumbsDownClick?: (callId: string) => void;
|
|
28
28
|
theme?: "light" | "dark";
|
|
29
|
+
cssUrl?: string;
|
|
29
30
|
markdownClass?: string;
|
|
30
31
|
width?: string;
|
|
31
32
|
height?: string;
|
|
@@ -78,6 +79,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
78
79
|
thumbsUpClick,
|
|
79
80
|
thumbsDownClick,
|
|
80
81
|
theme = "light",
|
|
82
|
+
cssUrl = "",
|
|
81
83
|
markdownClass = null,
|
|
82
84
|
width = "300px",
|
|
83
85
|
height = "100vh",
|
|
@@ -159,6 +161,16 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
159
161
|
};
|
|
160
162
|
}, []);
|
|
161
163
|
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (cssUrl && cssUrl !== "") {
|
|
166
|
+
const link = document.createElement("link");
|
|
167
|
+
link.href = cssUrl;
|
|
168
|
+
link.rel = "stylesheet";
|
|
169
|
+
document.head.appendChild(link);
|
|
170
|
+
console.log("Added css link", link);
|
|
171
|
+
}
|
|
172
|
+
}, [cssUrl]);
|
|
173
|
+
|
|
162
174
|
// response change. Update the history
|
|
163
175
|
useEffect(() => {
|
|
164
176
|
if (response && response.length > 0) {
|