llmasaservice-ui 0.7.11 → 0.7.13

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
@@ -33,6 +33,7 @@ interface ChatPanelProps {
33
33
  [key: string]: {
34
34
  content: string;
35
35
  callId: string;
36
+ idle: boolean;
36
37
  };
37
38
  }) => void;
38
39
  promptTemplate?: string;
@@ -87,6 +88,7 @@ interface AgentPanelProps {
87
88
  [key: string]: {
88
89
  content: string;
89
90
  callId: string;
91
+ idle: boolean;
90
92
  };
91
93
  }) => void;
92
94
  actions?: {
package/dist/index.d.ts CHANGED
@@ -33,6 +33,7 @@ interface ChatPanelProps {
33
33
  [key: string]: {
34
34
  content: string;
35
35
  callId: string;
36
+ idle: boolean;
36
37
  };
37
38
  }) => void;
38
39
  promptTemplate?: string;
@@ -87,6 +88,7 @@ interface AgentPanelProps {
87
88
  [key: string]: {
88
89
  content: string;
89
90
  callId: string;
91
+ idle: boolean;
90
92
  };
91
93
  }) => void;
92
94
  actions?: {
package/dist/index.js CHANGED
@@ -298,7 +298,7 @@ var ChatPanel = ({
298
298
  }
299
299
  setHistory((prevHistory) => {
300
300
  return __spreadProps(__spreadValues({}, prevHistory), {
301
- [lastKey != null ? lastKey : ""]: { content: newResponse, callId: lastCallId }
301
+ [lastKey != null ? lastKey : ""]: { content: newResponse, callId: lastCallId, idle }
302
302
  });
303
303
  });
304
304
  }
@@ -375,7 +375,8 @@ var ChatPanel = ({
375
375
  return __spreadProps(__spreadValues({}, prevHistory), {
376
376
  [lastKey != null ? lastKey : ""]: {
377
377
  content: response + "\n\n(response cancelled)",
378
- callId: lastCallId
378
+ callId: lastCallId,
379
+ idle: true
379
380
  }
380
381
  });
381
382
  });
@@ -422,7 +423,7 @@ var ChatPanel = ({
422
423
  }
423
424
  setHistory((prevHistory) => {
424
425
  return __spreadProps(__spreadValues({}, prevHistory), {
425
- [promptKey != null ? promptKey : ""]: { content: "", callId: "" }
426
+ [promptKey != null ? promptKey : ""]: { content: "", callId: "", idle: false }
426
427
  });
427
428
  });
428
429
  if (initialPrompt && initialPrompt !== "" && Object.keys(history).length === 1 || (!initialPrompt || initialPrompt === "") && Object.keys(history).length === 0) {
@@ -1191,7 +1192,7 @@ var AgentPanel = ({
1191
1192
  promptTemplate: (_e = agentData == null ? void 0 : agentData.displayPromptTemplate) != null ? _e : "{{prompt}}",
1192
1193
  initialMessage: (agentData == null ? void 0 : agentData.displayStartMessageOrPrompt) === "message" ? (_f = agentData == null ? void 0 : agentData.displayInitialMessageOrPrompt) != null ? _f : "" : void 0,
1193
1194
  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 : [],
1195
+ followOnQuestions: followOnQuestions && followOnQuestions.length > 0 ? followOnQuestions : (_i = (_h = agentData == null ? void 0 : agentData.displayFollowOnPrompts) == null ? void 0 : _h.split("|")) != null ? _i : [],
1195
1196
  clearFollowOnQuestionsNextPrompt,
1196
1197
  historyChangedCallback,
1197
1198
  prismStyle: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? import_material_light2.default : import_material_dark2.default,
package/dist/index.mjs CHANGED
@@ -264,7 +264,7 @@ var ChatPanel = ({
264
264
  }
265
265
  setHistory((prevHistory) => {
266
266
  return __spreadProps(__spreadValues({}, prevHistory), {
267
- [lastKey != null ? lastKey : ""]: { content: newResponse, callId: lastCallId }
267
+ [lastKey != null ? lastKey : ""]: { content: newResponse, callId: lastCallId, idle }
268
268
  });
269
269
  });
270
270
  }
@@ -341,7 +341,8 @@ var ChatPanel = ({
341
341
  return __spreadProps(__spreadValues({}, prevHistory), {
342
342
  [lastKey != null ? lastKey : ""]: {
343
343
  content: response + "\n\n(response cancelled)",
344
- callId: lastCallId
344
+ callId: lastCallId,
345
+ idle: true
345
346
  }
346
347
  });
347
348
  });
@@ -388,7 +389,7 @@ var ChatPanel = ({
388
389
  }
389
390
  setHistory((prevHistory) => {
390
391
  return __spreadProps(__spreadValues({}, prevHistory), {
391
- [promptKey != null ? promptKey : ""]: { content: "", callId: "" }
392
+ [promptKey != null ? promptKey : ""]: { content: "", callId: "", idle: false }
392
393
  });
393
394
  });
394
395
  if (initialPrompt && initialPrompt !== "" && Object.keys(history).length === 1 || (!initialPrompt || initialPrompt === "") && Object.keys(history).length === 0) {
@@ -1157,7 +1158,7 @@ var AgentPanel = ({
1157
1158
  promptTemplate: (_e = agentData == null ? void 0 : agentData.displayPromptTemplate) != null ? _e : "{{prompt}}",
1158
1159
  initialMessage: (agentData == null ? void 0 : agentData.displayStartMessageOrPrompt) === "message" ? (_f = agentData == null ? void 0 : agentData.displayInitialMessageOrPrompt) != null ? _f : "" : void 0,
1159
1160
  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 : [],
1161
+ followOnQuestions: followOnQuestions && followOnQuestions.length > 0 ? followOnQuestions : (_i = (_h = agentData == null ? void 0 : agentData.displayFollowOnPrompts) == null ? void 0 : _h.split("|")) != null ? _i : [],
1161
1162
  clearFollowOnQuestionsNextPrompt,
1162
1163
  historyChangedCallback,
1163
1164
  prismStyle: (agentData == null ? void 0 : agentData.displayTheme) === "light" ? materialLight2 : materialDark2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmasaservice-ui",
3
- "version": "0.7.11",
3
+ "version": "0.7.13",
4
4
  "description": "Prebuilt UI components for LLMAsAService.io",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -26,7 +26,7 @@ export interface AgentPanelProps {
26
26
  prismStyle?: PrismStyle;
27
27
  service?: string | null;
28
28
  historyChangedCallback?: (history: {
29
- [key: string]: { content: string; callId: string };
29
+ [key: string]: { content: string; callId: string; idle: boolean };
30
30
  }) => void;
31
31
  //promptTemplate?: string;
32
32
  actions?: {
@@ -174,7 +174,7 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
174
174
  : undefined
175
175
  }
176
176
  followOnQuestions={
177
- followOnQuestions
177
+ followOnQuestions && followOnQuestions.length > 0
178
178
  ? followOnQuestions
179
179
  : agentData?.displayFollowOnPrompts?.split("|") ?? []
180
180
  }
package/src/ChatPanel.tsx CHANGED
@@ -35,7 +35,7 @@ export interface ChatPanelProps {
35
35
  prismStyle?: PrismStyle;
36
36
  service?: string | null;
37
37
  historyChangedCallback?: (history: {
38
- [key: string]: { content: string; callId: string };
38
+ [key: string]: { content: string; callId: string; idle: boolean };
39
39
  }) => void;
40
40
  promptTemplate?: string;
41
41
  actions?: {
@@ -119,7 +119,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
119
119
  const [nextPrompt, setNextPrompt] = useState("");
120
120
  const [lastController, setLastController] = useState(new AbortController());
121
121
  const [history, setHistory] = useState<{
122
- [prompt: string]: { content: string; callId: string };
122
+ [prompt: string]: { content: string; callId: string; idle: boolean };
123
123
  }>({});
124
124
  const [isLoading, setIsLoading] = useState(false);
125
125
  const [lastPrompt, setLastPrompt] = useState<string | null>(null);
@@ -231,7 +231,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
231
231
  setHistory((prevHistory) => {
232
232
  return {
233
233
  ...prevHistory,
234
- [lastKey ?? ""]: { content: newResponse, callId: lastCallId },
234
+ [lastKey ?? ""]: { content: newResponse, callId: lastCallId, idle },
235
235
  };
236
236
  });
237
237
  }
@@ -321,6 +321,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
321
321
  [lastKey ?? ""]: {
322
322
  content: response + "\n\n(response cancelled)",
323
323
  callId: lastCallId,
324
+ idle: true,
324
325
  },
325
326
  };
326
327
  });
@@ -386,7 +387,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
386
387
  setHistory((prevHistory) => {
387
388
  return {
388
389
  ...prevHistory,
389
- [promptKey ?? ""]: { content: "", callId: "" },
390
+ [promptKey ?? ""]: { content: "", callId: "", idle: false },
390
391
  };
391
392
  });
392
393
 
@@ -432,7 +433,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
432
433
  };
433
434
 
434
435
  const replaceHistory = (newHistory: {
435
- [prompt: string]: { content: string; callId: string };
436
+ [prompt: string]: { content: string; callId: string; idle: boolean };
436
437
  }) => {
437
438
  setHistory(newHistory);
438
439
  };