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

Function getSubChatDraftFull

src/renderer/features/agents/lib/drafts.ts:535–557  ·  view source on GitHub ↗
(
  chatId: string,
  subChatId: string
)

Source from the content-addressed store, hash-verified

533 * Get full sub-chat draft including attachments and text contexts
534 */
535export function getSubChatDraftFull(
536 chatId: string,
537 subChatId: string
538): FullDraftData | null {
539 const globalDrafts = loadGlobalDrafts()
540 const key = getSubChatDraftKey(chatId, subChatId)
541 const draft = globalDrafts[key] as DraftContent | undefined
542
543 if (!draft) return null
544
545 return {
546 text: draft.text || null,
547 images:
548 draft.images
549 ?.map(fromDraftImage)
550 .filter((img): img is UploadedImage => img !== null) ?? [],
551 files:
552 draft.files
553 ?.map(fromDraftFile)
554 .filter((f): f is UploadedFile => f !== null) ?? [],
555 textContexts: draft.textContexts?.map(fromDraftTextContext) ?? [],
556 }
557}
558
559/**
560 * Save sub-chat draft with attachments (async version)

Callers 1

active-chat.tsxFile · 0.90

Calls 2

loadGlobalDraftsFunction · 0.85
getSubChatDraftKeyFunction · 0.85

Tested by

no test coverage detected