加入我们的 Telegram 社群 (clawdbotCN) 学习分享和了解更多 →
en
Core Concepts
Streaming

Streaming and Chunking

Clawdbot supports real-time streaming responses and automatic message chunking to ensure a smooth user experience across various platforms.

Streaming

What is Streaming?

Streaming allows AI responses to be displayed in real-time as they're generated, rather than waiting for the complete response before sending.

Stream Modes

{
  channels: {
    telegram: {
      // Disable streaming
      streamMode: "off",
 
      // Partial streaming (periodic updates)
      streamMode: "partial",
 
      // Block streaming (update after complete blocks)
      streamMode: "block"
    }
  }
}

Mode Descriptions

ModeDescriptionUse Case
offSend once after completionLow latency needs
partialPeriodic message updatesReal-time feedback
blockUpdate after complete paragraphsBalanced experience

Message Chunking

Automatic Chunking

Long messages are automatically split into multiple smaller messages:

{
  channels: {
    whatsapp: {
      // Maximum characters per chunk
      textChunkLimit: 4000
    },
    telegram: {
      textChunkLimit: 4000
    },
    discord: {
      textChunkLimit: 2000
    }
  }
}

Chunking Rules

  1. Split at sentence boundaries (preferred)
  2. Split at paragraph boundaries
  3. Forced split (when limit reached)

Platform Limits

PlatformMessage LimitRecommended Chunk Size
WhatsApp~64KB4000
Telegram40964000
Discord20002000
Slack400004000
Signal~64KB4000

Media Handling

Media Size Limits

{
  media: {
    // Images max 6MB
    imageMaxMb: 6,
 
    // Videos max 16MB
    videoMaxMb: 16,
 
    // Documents max 100MB
    documentMaxMb: 100,
 
    // Audio max 16MB
    audioMaxMb: 16
  }
}

Media Optimization

Clawdbot automatically optimizes media files:

  • Image compression and resizing
  • Video transcoding
  • Audio format conversion

Response Configuration

Acknowledgment Reactions

Automatically send emoji reactions when messages are received:

{
  channels: {
    whatsapp: {
      // Reaction on message received
      ackReaction: "👀",
 
      // Reaction while processing
      processingReaction: "🤔",
 
      // Reaction when done
      doneReaction: "✅"
    }
  }
}

Typing Indicator

Show "typing..." status:

{
  channels: {
    telegram: {
      // Enable typing indicator
      typingIndicator: true
    }
  }
}

Advanced Settings

Draft Streaming

Enable draft streaming in private chats:

{
  channels: {
    telegram: {
      // Private chats only
      draftStreaming: true
    }
  }
}

Reply Mode

Control message reply behavior:

{
  channels: {
    telegram: {
      // Reply mode
      replyToMode: "first",  // Reply to first only
      // or
      replyToMode: "all",    // Reply to all
      // or
      replyToMode: "off"     // Don't use replies
    }
  }
}

Inline Buttons

Add interactive buttons to messages:

{
  channels: {
    telegram: {
      // Enable inline buttons
      inlineButtons: true
    }
  }
}

Performance Optimization

Network Optimization

{
  network: {
    // Retry attempts
    retryAttempts: 3,
 
    // Retry delay (milliseconds)
    retryDelay: 1000,
 
    // Timeout (milliseconds)
    timeout: 30000
  }
}

Cache Settings

{
  cache: {
    // Media cache size (MB)
    mediaCacheSize: 100,
 
    // Cache expiry (seconds)
    expiry: 3600
  }
}

Next Steps