Replace inline data-URL image handling with a persistent attachment storage service, add draft lifecycle states (active/abandoned/sent) with generation tracking, and update fetchAgent to return project placement alongside agent snapshots.
19 lines
491 B
TypeScript
19 lines
491 B
TypeScript
import { generateMessageId } from "@/types/stream";
|
|
|
|
export function generateDraftId(): string {
|
|
return `draft_${generateMessageId()}`;
|
|
}
|
|
|
|
export function buildDraftStoreKey(input: {
|
|
serverId: string;
|
|
agentId: string;
|
|
draftId?: string | null;
|
|
}): string {
|
|
const serverId = input.serverId.trim();
|
|
const explicitDraftId = input.draftId?.trim();
|
|
if (explicitDraftId) {
|
|
return `draft:${serverId}:${explicitDraftId}`;
|
|
}
|
|
return `agent:${serverId}:${input.agentId.trim()}`;
|
|
}
|