llmasaservice-ui 0.7.12 → 0.7.14

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.d.mts CHANGED
@@ -35,6 +35,7 @@ interface ChatPanelProps {
35
35
  callId: string;
36
36
  };
37
37
  }) => void;
38
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
38
39
  promptTemplate?: string;
39
40
  actions?: {
40
41
  pattern: string;
@@ -89,6 +90,7 @@ interface AgentPanelProps {
89
90
  callId: string;
90
91
  };
91
92
  }) => void;
93
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
92
94
  actions?: {
93
95
  pattern: string;
94
96
  type?: string;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,7 @@ interface ChatPanelProps {
35
35
  callId: string;
36
36
  };
37
37
  }) => void;
38
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
38
39
  promptTemplate?: string;
39
40
  actions?: {
40
41
  pattern: string;
@@ -89,6 +90,7 @@ interface AgentPanelProps {
89
90
  callId: string;
90
91
  };
91
92
  }) => void;
93
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
92
94
  actions?: {
93
95
  pattern: string;
94
96
  type?: string;
package/dist/index.js CHANGED
@@ -185,6 +185,7 @@ var ChatPanel = ({
185
185
  prismStyle = theme === "light" ? import_material_light.default : import_material_dark.default,
186
186
  service = null,
187
187
  historyChangedCallback = null,
188
+ responseCompleteCallback = null,
188
189
  promptTemplate = "",
189
190
  actions = [],
190
191
  showSaveButton = true,
@@ -228,6 +229,12 @@ var ChatPanel = ({
228
229
  sendConversationsViaEmail(to, `Conversation History from ${title}`, from);
229
230
  };
230
231
  const responseAreaRef = (0, import_react3.useRef)(null);
232
+ (0, import_react3.useEffect)(() => {
233
+ if (responseCompleteCallback) {
234
+ if (lastCallId && lastCallId !== "" && idle)
235
+ responseCompleteCallback(lastCallId, lastPrompt != null ? lastPrompt : "", response);
236
+ }
237
+ }, [idle]);
231
238
  (0, import_react3.useEffect)(() => {
232
239
  const handleBeforeUnload = (event) => {
233
240
  if (callToActionMustSendEmail && showCallToAction && callToActionEmailAddress && callToActionEmailAddress !== "" && !hasSentCallToActionEmail) {
@@ -1115,6 +1122,7 @@ var AgentPanel = ({
1115
1122
  //prismStyle = theme === "light" ? materialLight : materialDark,
1116
1123
  service = null,
1117
1124
  historyChangedCallback = void 0,
1125
+ responseCompleteCallback = void 0,
1118
1126
  //promptTemplate = "",
1119
1127
  actions = [],
1120
1128
  //showSaveButton = true,
@@ -1194,6 +1202,7 @@ var AgentPanel = ({
1194
1202
  followOnQuestions: followOnQuestions && followOnQuestions.length > 0 ? followOnQuestions : (_i = (_h = agentData == null ? void 0 : agentData.displayFollowOnPrompts) == null ? void 0 : _h.split("|")) != null ? _i : [],
1195
1203
  clearFollowOnQuestionsNextPrompt,
1196
1204
  historyChangedCallback,
1205
+ responseCompleteCallback,
1197
1206
  prismStyle: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? import_material_light2.default : import_material_dark2.default,
1198
1207
  actions: [
1199
1208
  ...actions,
package/dist/index.mjs CHANGED
@@ -151,6 +151,7 @@ var ChatPanel = ({
151
151
  prismStyle = theme === "light" ? materialLight : materialDark,
152
152
  service = null,
153
153
  historyChangedCallback = null,
154
+ responseCompleteCallback = null,
154
155
  promptTemplate = "",
155
156
  actions = [],
156
157
  showSaveButton = true,
@@ -194,6 +195,12 @@ var ChatPanel = ({
194
195
  sendConversationsViaEmail(to, `Conversation History from ${title}`, from);
195
196
  };
196
197
  const responseAreaRef = useRef(null);
198
+ useEffect(() => {
199
+ if (responseCompleteCallback) {
200
+ if (lastCallId && lastCallId !== "" && idle)
201
+ responseCompleteCallback(lastCallId, lastPrompt != null ? lastPrompt : "", response);
202
+ }
203
+ }, [idle]);
197
204
  useEffect(() => {
198
205
  const handleBeforeUnload = (event) => {
199
206
  if (callToActionMustSendEmail && showCallToAction && callToActionEmailAddress && callToActionEmailAddress !== "" && !hasSentCallToActionEmail) {
@@ -1081,6 +1088,7 @@ var AgentPanel = ({
1081
1088
  //prismStyle = theme === "light" ? materialLight : materialDark,
1082
1089
  service = null,
1083
1090
  historyChangedCallback = void 0,
1091
+ responseCompleteCallback = void 0,
1084
1092
  //promptTemplate = "",
1085
1093
  actions = [],
1086
1094
  //showSaveButton = true,
@@ -1160,6 +1168,7 @@ var AgentPanel = ({
1160
1168
  followOnQuestions: followOnQuestions && followOnQuestions.length > 0 ? followOnQuestions : (_i = (_h = agentData == null ? void 0 : agentData.displayFollowOnPrompts) == null ? void 0 : _h.split("|")) != null ? _i : [],
1161
1169
  clearFollowOnQuestionsNextPrompt,
1162
1170
  historyChangedCallback,
1171
+ responseCompleteCallback,
1163
1172
  prismStyle: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? materialLight2 : materialDark2,
1164
1173
  actions: [
1165
1174
  ...actions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmasaservice-ui",
3
- "version": "0.7.12",
3
+ "version": "0.7.14",
4
4
  "description": "Prebuilt UI components for LLMAsAService.io",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,6 +28,7 @@ export interface AgentPanelProps {
28
28
  historyChangedCallback?: (history: {
29
29
  [key: string]: { content: string; callId: string };
30
30
  }) => void;
31
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
31
32
  //promptTemplate?: string;
32
33
  actions?: {
33
34
  pattern: string;
@@ -78,6 +79,7 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
78
79
  //prismStyle = theme === "light" ? materialLight : materialDark,
79
80
  service = null,
80
81
  historyChangedCallback = undefined,
82
+ responseCompleteCallback = undefined,
81
83
  //promptTemplate = "",
82
84
  actions = [],
83
85
  //showSaveButton = true,
@@ -180,6 +182,7 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
180
182
  }
181
183
  clearFollowOnQuestionsNextPrompt={clearFollowOnQuestionsNextPrompt}
182
184
  historyChangedCallback={historyChangedCallback}
185
+ responseCompleteCallback={responseCompleteCallback}
183
186
  prismStyle={
184
187
  (agentData?.displayTheme === "light"
185
188
  ? materialLight
package/src/ChatPanel.tsx CHANGED
@@ -37,6 +37,7 @@ export interface ChatPanelProps {
37
37
  historyChangedCallback?: (history: {
38
38
  [key: string]: { content: string; callId: string };
39
39
  }) => void;
40
+ responseCompleteCallback?: (callId: string, prompt: string, response: string) => void;
40
41
  promptTemplate?: string;
41
42
  actions?: {
42
43
  pattern: string;
@@ -89,6 +90,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
89
90
  prismStyle = theme === "light" ? materialLight : materialDark,
90
91
  service = null,
91
92
  historyChangedCallback = null,
93
+ responseCompleteCallback = null,
92
94
  promptTemplate = "",
93
95
  actions = [],
94
96
  showSaveButton = true,
@@ -139,6 +141,13 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
139
141
 
140
142
  const responseAreaRef = useRef(null);
141
143
 
144
+ useEffect(() => {
145
+ if (responseCompleteCallback) {
146
+ if (lastCallId && lastCallId !== "" && idle)
147
+ responseCompleteCallback(lastCallId, lastPrompt ?? "", response);
148
+ }
149
+ }, [idle]);
150
+
142
151
  useEffect(() => {
143
152
  const handleBeforeUnload = (event: BeforeUnloadEvent) => {
144
153
  if (