()
| 118 | |
| 119 | // Get new chat drafts as sorted array (only visible ones) |
| 120 | export function getNewChatDrafts(): NewChatDraft[] { |
| 121 | const globalDrafts = loadGlobalDrafts() |
| 122 | return Object.entries(globalDrafts) |
| 123 | .filter(([key]) => isNewChatDraftKey(key)) |
| 124 | .map(([id, data]) => ({ |
| 125 | id, |
| 126 | text: (data as NewChatDraft).text || "", |
| 127 | updatedAt: data.updatedAt || 0, |
| 128 | project: (data as NewChatDraft).project, |
| 129 | isVisible: (data as NewChatDraft).isVisible, |
| 130 | })) |
| 131 | .filter((draft) => draft.isVisible === true) |
| 132 | .sort((a, b) => b.updatedAt - a.updatedAt) |
| 133 | } |
| 134 | |
| 135 | // Save a new chat draft |
| 136 | export function saveNewChatDraft( |
no test coverage detected