File size: 959 Bytes
ffcad5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/** Persist whether below-input chat follow-up suggestion chips are shown. Default: visible. */

export const CHAT_INPUT_FOLLOWUPS_STORAGE_KEY = 'chat-input-followups-visible';
export const CHAT_INPUT_FOLLOWUPS_EVENT = 'chat-input-followups-pref-changed';

export function readChatInputFollowupsVisible() {
  try {
    const raw = localStorage.getItem(CHAT_INPUT_FOLLOWUPS_STORAGE_KEY);
    if (raw === null) return true;
    return raw !== 'false';
  } catch {
    return true;
  }
}

export function writeChatInputFollowupsVisible(visible) {
  const next = Boolean(visible);
  try {
    localStorage.setItem(CHAT_INPUT_FOLLOWUPS_STORAGE_KEY, String(next));
  } catch {
    /* ignore quota / private mode */
  }
  if (typeof window !== 'undefined') {
    queueMicrotask(() => {
      window.dispatchEvent(
        new CustomEvent(CHAT_INPUT_FOLLOWUPS_EVENT, { detail: { visible: next } })
      );
    });
  }
  return next;
}