@gendive/chatllm 0.17.22 → 0.17.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.
@@ -1257,7 +1257,7 @@ var useProject = (options) => {
1257
1257
  }
1258
1258
  };
1259
1259
  loadProjects();
1260
- }, [useExternalStorage, onLoadProjects, onError, storageKey]);
1260
+ }, [enabled, useExternalStorage, onLoadProjects, onError, storageKey]);
1261
1261
  const createProject = (0, import_react4.useCallback)(
1262
1262
  async (data) => {
1263
1263
  const now = Date.now();
@@ -1499,11 +1499,6 @@ var parsePollFromContent = (content) => {
1499
1499
  allowOther,
1500
1500
  required: false
1501
1501
  };
1502
- console.log("[pollParser] Parsed poll:", {
1503
- question: pollQuestion.question,
1504
- optionsCount: pollQuestion.options.length,
1505
- options: pollQuestion.options.map((o) => o.label)
1506
- });
1507
1502
  polls.push(pollQuestion);
1508
1503
  }
1509
1504
  cleanContent = cleanContent.replace(match[0], "");
@@ -1511,7 +1506,6 @@ var parsePollFromContent = (content) => {
1511
1506
  if (polls.length === 0) {
1512
1507
  return { pollBlock: null, cleanContent: content };
1513
1508
  }
1514
- console.log("[pollParser] Total polls parsed:", polls.length, polls.map((p) => p.question));
1515
1509
  cleanContent = cleanContent.replace(/\n{3,}/g, "\n\n");
1516
1510
  return {
1517
1511
  pollBlock: {
@@ -1796,7 +1790,8 @@ var useChatUI = (options) => {
1796
1790
  }),
1797
1791
  [globalMemoryConfig, storageKey]
1798
1792
  );
1799
- const globalMemory = useGlobalMemoryEnabled ? useGlobalMemory(memoryOptions) : null;
1793
+ const globalMemoryRaw = useGlobalMemory(memoryOptions);
1794
+ const globalMemory = useGlobalMemoryEnabled ? globalMemoryRaw : null;
1800
1795
  const stableToolCall = (0, import_react5.useCallback)(
1801
1796
  (name, params) => onToolCallRef.current(name, params),
1802
1797
  []
@@ -2415,7 +2410,7 @@ ${finalContent}`;
2415
2410
  ...userContentParts && { contentParts: userContentParts }
2416
2411
  };
2417
2412
  const capturedSessionId = sessionId;
2418
- const currentSession2 = sessions.find((s) => s.id === capturedSessionId);
2413
+ const currentSession2 = sessionsRef.current.find((s) => s.id === capturedSessionId);
2419
2414
  const existingMessages = currentSession2?.messages || [];
2420
2415
  const isFirstMessage = !existingMessages.length;
2421
2416
  const contextSummary = currentSession2?.compressionState?.contextSummary || currentSession2?.contextSummary;
@@ -2432,6 +2427,9 @@ ${finalContent}`;
2432
2427
  setInput("");
2433
2428
  setQuotedText(null);
2434
2429
  setSelectedAction(null);
2430
+ attachments.forEach((a) => {
2431
+ if (a.previewUrl) URL.revokeObjectURL(a.previewUrl);
2432
+ });
2435
2433
  setAttachments([]);
2436
2434
  setSessions(
2437
2435
  (prev) => prev.map((s) => {
@@ -6838,7 +6836,7 @@ var MarkdownRenderer = ({
6838
6836
  flushBlockquote();
6839
6837
  flushTable();
6840
6838
  return elements;
6841
- }, [content, onChoiceClick, sources]);
6839
+ }, [content, onChoiceClick, sources, showThinking, thinkingDefaultOpen]);
6842
6840
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6843
6841
  "div",
6844
6842
  {
@@ -7236,7 +7234,10 @@ var PollCard = ({
7236
7234
  (0, import_react13.useEffect)(() => {
7237
7235
  if (typeof window === "undefined") return;
7238
7236
  const handleKeyDown = (e) => {
7239
- if (e.key === "Escape") handleSkip();
7237
+ if (e.key !== "Escape") return;
7238
+ const modalOpen = document.querySelector(".chatllm-settings-overlay, .chatllm-disclaimer-overlay, .chatllm-project-settings-overlay");
7239
+ if (modalOpen) return;
7240
+ handleSkip();
7240
7241
  };
7241
7242
  window.addEventListener("keydown", handleKeyDown);
7242
7243
  return () => window.removeEventListener("keydown", handleKeyDown);
@@ -8208,13 +8209,6 @@ var MessageBubble = ({
8208
8209
  const displayContent = isAssistant && relevantAlternatives && relevantAlternatives.length > 0 && relevantActiveIndex > 0 ? relevantAlternatives[relevantActiveIndex - 1]?.content || message.content : message.content;
8209
8210
  const displayModel = isAssistant && relevantAlternatives && relevantAlternatives.length > 0 && relevantActiveIndex > 0 ? relevantAlternatives[relevantActiveIndex - 1]?.model : message.model;
8210
8211
  const displaySources = isAssistant && relevantAlternatives && relevantAlternatives.length > 0 && relevantActiveIndex > 0 ? relevantAlternatives[relevantActiveIndex - 1]?.sources : message.sources;
8211
- const handleMouseUp = () => {
8212
- if (!onQuote) return;
8213
- const selection = typeof window !== "undefined" ? window.getSelection() : null;
8214
- const text = selection?.toString().trim();
8215
- if (text && text.length > 0) {
8216
- }
8217
- };
8218
8212
  if (isUser) {
8219
8213
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
8220
8214
  "div",
@@ -8228,7 +8222,6 @@ var MessageBubble = ({
8228
8222
  },
8229
8223
  onMouseEnter: () => setShowActions(true),
8230
8224
  onMouseLeave: () => setShowActions(false),
8231
- onMouseUp: handleMouseUp,
8232
8225
  children: [
8233
8226
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8234
8227
  "div",
@@ -8349,7 +8342,6 @@ var MessageBubble = ({
8349
8342
  },
8350
8343
  onMouseEnter: () => setShowActions(true),
8351
8344
  onMouseLeave: () => setShowActions(false),
8352
- onMouseUp: handleMouseUp,
8353
8345
  children: [
8354
8346
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
8355
8347
  "div",
@@ -8452,7 +8444,7 @@ var MessageBubble = ({
8452
8444
  ]
8453
8445
  }
8454
8446
  ),
8455
- message.contentParts?.length && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8447
+ !!message.contentParts?.length && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8456
8448
  ContentPartRenderer,
8457
8449
  {
8458
8450
  parts: message.contentParts,
@@ -9089,6 +9081,9 @@ var SettingsModal = ({
9089
9081
  }) => {
9090
9082
  const [activeTab, setActiveTab] = (0, import_react18.useState)("general");
9091
9083
  const [localApiKey, setLocalApiKey] = (0, import_react18.useState)(apiKey);
9084
+ (0, import_react18.useEffect)(() => {
9085
+ setLocalApiKey(apiKey);
9086
+ }, [apiKey]);
9092
9087
  if (!isOpen) return null;
9093
9088
  const updateResponseStyle = (key, value) => {
9094
9089
  onPersonalizationChange({