MCPcopy
hub / github.com/21st-dev/1code / getNewChatDrafts

Function getNewChatDrafts

src/renderer/features/agents/lib/drafts.ts:120–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118
119// Get new chat drafts as sorted array (only visible ones)
120export 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
136export function saveNewChatDraft(

Callers 2

useNewChatDraftsFunction · 0.85
handleChangeFunction · 0.85

Calls 2

loadGlobalDraftsFunction · 0.85
isNewChatDraftKeyFunction · 0.85

Tested by

no test coverage detected