llmasaservice-ui 0.7.21 → 0.7.23

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.js CHANGED
@@ -238,6 +238,8 @@ var ChatPanel = ({
238
238
  }
239
239
  }, [idle]);
240
240
  (0, import_react3.useEffect)(() => {
241
+ if (Object.keys(initialHistory).length === 0) return;
242
+ console.log("initialHistory", initialHistory);
241
243
  setHistory(initialHistory);
242
244
  }, [initialHistory]);
243
245
  (0, import_react3.useEffect)(() => {
@@ -718,7 +720,6 @@ var ChatPanel = ({
718
720
  });
719
721
  };
720
722
  const formatPromptForDisplay = (prompt) => {
721
- var _a;
722
723
  if (!prompt) {
723
724
  return "";
724
725
  }
@@ -727,7 +728,7 @@ var ChatPanel = ({
727
728
  const withoutContext = parts.length > 0 ? parts[0] : "";
728
729
  if (withoutContext.includes("PROMPT:")) {
729
730
  const promptParts = withoutContext.split("PROMPT:");
730
- return promptParts.length > 1 ? (_a = promptParts[1]) != null ? _a : "".trim() : withoutContext.trim();
731
+ return promptParts.length > 1 ? (promptParts[1] || "").trim() : withoutContext.trim();
731
732
  }
732
733
  return withoutContext.trim();
733
734
  }
package/dist/index.mjs CHANGED
@@ -204,6 +204,8 @@ var ChatPanel = ({
204
204
  }
205
205
  }, [idle]);
206
206
  useEffect(() => {
207
+ if (Object.keys(initialHistory).length === 0) return;
208
+ console.log("initialHistory", initialHistory);
207
209
  setHistory(initialHistory);
208
210
  }, [initialHistory]);
209
211
  useEffect(() => {
@@ -684,7 +686,6 @@ var ChatPanel = ({
684
686
  });
685
687
  };
686
688
  const formatPromptForDisplay = (prompt) => {
687
- var _a;
688
689
  if (!prompt) {
689
690
  return "";
690
691
  }
@@ -693,7 +694,7 @@ var ChatPanel = ({
693
694
  const withoutContext = parts.length > 0 ? parts[0] : "";
694
695
  if (withoutContext.includes("PROMPT:")) {
695
696
  const promptParts = withoutContext.split("PROMPT:");
696
- return promptParts.length > 1 ? (_a = promptParts[1]) != null ? _a : "".trim() : withoutContext.trim();
697
+ return promptParts.length > 1 ? (promptParts[1] || "").trim() : withoutContext.trim();
697
698
  }
698
699
  return withoutContext.trim();
699
700
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmasaservice-ui",
3
- "version": "0.7.21",
3
+ "version": "0.7.23",
4
4
  "description": "Prebuilt UI components for LLMAsAService.io",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/ChatPanel.tsx CHANGED
@@ -159,7 +159,11 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
159
159
  }, [idle]);
160
160
 
161
161
  useEffect(() => {
162
- setHistory(initialHistory);
162
+ if (Object.keys(initialHistory).length === 0) return;
163
+
164
+ console.log("initialHistory", initialHistory);
165
+ setHistory(initialHistory);
166
+
163
167
  }, [initialHistory]);
164
168
 
165
169
  useEffect(() => {
@@ -749,7 +753,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
749
753
  // Remove the optional chaining since withoutContext is always a string
750
754
  if (withoutContext.includes("PROMPT:")) {
751
755
  const promptParts = withoutContext.split("PROMPT:");
752
- return promptParts.length > 1 ? promptParts[1] ?? "".trim() : withoutContext.trim();
756
+ return promptParts.length > 1 ? (promptParts[1] || "").trim() : withoutContext.trim();
753
757
  }
754
758
 
755
759
  return withoutContext.trim();