useChatStorage
useChatStorage(
options:object):UseChatStorageResult
Defined in: src/react/useChatStorage.ts:548
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
|
|
|
Which API endpoint to use. Default: “responses”
|
|
|
|
Automatically create a new conversation if none is set (default: true) |
|
|
|
Automatically generate embeddings for messages after saving. Enables semantic search over past conversations via searchMessages(). Default |
|
|
|
Automatically flush queued operations when the encryption key becomes
available. Requires Default |
|
|
|
Base URL for the chat API endpoint |
|
|
|
ID of an existing conversation to load and continue |
|
|
|
WatermelonDB database instance for storing conversations and messages |
|
|
|
Title for auto-created conversations (default: “New conversation”) |
|
|
Function for silent signing with Privy embedded wallets. When provided, enables automatic encryption key derivation without user confirmation modals. | |
|
|
|
Embedding model to use when autoEmbedMessages is enabled. Default |
|
|
|
Enable the in-memory write queue for operations when encryption key isn’t yet available. When enabled, operations are held in memory and flushed to encrypted storage once the key becomes available. Default |
|
|
{ |
Options for file preprocessing behavior |
|
|
|
Whether to keep original file attachments (default: true) |
|
|
|
Max file size to process in bytes (default: 10MB) |
|
|
( |
Callback for errors (non-fatal) |
|
|
( |
Callback for progress updates |
|
|
|
File preprocessors to use for automatic text extraction.
|
|
|
() => |
Function to retrieve the auth token for API requests |
|
|
() => |
Async function that returns the wallet address when available. Used for polling during Privy embedded wallet initialization. When the wallet isn’t ready yet, should return null. |
|
|
|
Minimum content length required to generate embeddings. Messages shorter than this are skipped as they provide limited semantic value. Default |
|
|
( |
Callback invoked with each streamed response chunk |
|
|
( |
Callback invoked when an error occurs during the request |
|
|
( |
Callback invoked when the response completes successfully |
|
|
( |
Callback invoked when a server-side tool (MCP) is called during streaming. Use this to show activity indicators like “Searching…” in the UI. |
|
|
( |
Callback invoked when thinking/reasoning content is received (from |
|
|
{ |
Configuration for server-side tools fetching and caching. Server tools are fetched from /api/v1/tools and cached in localStorage. |
|
|
|
Cache expiration time in milliseconds (default: 86400000 = 1 day) |
|
|
Function to sign a message for encryption key derivation. Typically from Privy’s useSignMessage hook. Required together with walletAddress for field-level encryption. | |
|
|
|
Wallet address for encrypted file storage and field-level encryption. When provided with signMessage, all sensitive message content, conversation titles, and media metadata are encrypted at rest using AES-GCM with wallet-derived keys. Requires:
When not provided, data is stored in plaintext (backwards compatible). |