feat(chat): enhance chat component with workflowChatId and isBootstrapPreparing props

Closed
AH
6mo ago
+287-204

This update introduces two new props, workflowChatId and isBootstrapPreparing, to the Chat component, improving the handling of chat sessions. The workflowChatId is used for workflow transport when the chat ID is a client placeholder, while isBootstrapPreparing indicates when session provisioning is in progress. Additionally, the ChatInput component now disables message sending during bootstrap preparation, enhancing user experience. The NewChatBootstrap component has been updated to manage these new props effectively.


Summary by cubic

Enable parallel new‑chat bootstrap with workflowChatId and isBootstrapPreparing; the chat UI renders immediately with a placeholder ID and blocks send until the session is ready. Also simplifies the provider with a new useVercelChatProviderValue hook and keeps session‑based chat APIs.

  • New Features

    • NewChatBootstrap mounts <Chat> with a client placeholder ID and passes workflowChatId/isBootstrapPreparing via isNewChatBootstrapPreparing.
    • useVercelChat uses transportChatId = workflowChatId ?? id for transport, initial message load, and URL; defers the first send until auth and sessionId exist.
    • ChatInput disables send and shows “Preparing…” during bootstrap.
  • Refactors

    • Centralized auto‑login in UserProvider; removed useAutoLogin across pages/components.
    • Extracted VercelChatContext and useVercelChatProviderValue; VercelChatProvider now passes isBootstrapPreparing.
    • Always clear attachments after send (finally), removed a redundant reload wrapper, and kept session‑based delete/rename APIs.

Summary by CodeRabbit

  • New Features
    • Chat shows a persistent "Preparing…" status during bootstrap so users know initialization is in progress.
    • Submit button is disabled while preparing to prevent sending messages prematurely.
    • Chat interface now appears immediately during bootstrap (with temporary session handling) to reduce perceived loading time.