<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 880 680" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
  <defs>
    <!-- Arrow markers -->
    <marker id="arrow" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
      <path d="M0,0 L0,6 L9,3 z" fill="#2563EB">
    </marker>

    <!-- Drop shadow for depth -->
    <filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
      <feGaussianBlur in="SourceAlpha" stdDeviation="2">
      <feOffset dx="1" dy="1" result="offsetblur">
      <feComponentTransfer>
        <feFuncA type="linear" slope="0.2">
      </feComponentTransfer>
      <feMerge>
        <feMergeNode/>
        <feMergeNode in="SourceGraphic">
      </feMerge>
    </filter>
  </defs>



  <!-- Beautiful gradient definitions for depth -->
  

  <!-- White background with subtle border -->
  <rect x="0" y="0" width="880" height="680" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">

  <!-- Content container with proper margins -->
  <g transform="translate(40, 40)">
  

  <!-- Title -->
  <text x="400" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="24" font-weight="bold" fill="#333" filter="url(#textShadow)">BotServer Data Flow Architecture</text>

  <!-- User Input Layer -->
  <g id="user-layer">
    <rect x="50" y="60" width="700" height="80" fill="url(#gradient1)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.8" filter="url(#shadow)">
    <text x="400" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#333" filter="url(#textShadow)">User Input Layer</text>

    <!-- Input sources -->
    <rect x="80" y="95" width="120" height="30" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="140" y="113" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#333" filter="url(#textShadow)">Web UI</text>

    <rect x="220" y="95" width="120" height="30" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="280" y="113" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#333" filter="url(#textShadow)">WhatsApp</text>

    <rect x="360" y="95" width="120" height="30" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="420" y="113" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#333" filter="url(#textShadow)">Teams</text>

    <rect x="500" y="95" width="120" height="30" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="560" y="113" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#333" filter="url(#textShadow)">Email</text>

    <rect x="640" y="95" width="80" height="30" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="680" y="113" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#333" filter="url(#textShadow)">API</text>
  </g>

  <!-- Arrows from User Layer to Processing -->
  <line x1="400" y1="140" x2="400" y2="170" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">

  <!-- Processing Layer -->
  <g id="processing-layer">
    <rect x="50" y="170" width="700" height="200" fill="url(#gradient2)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.8" filter="url(#shadow)">
    <text x="400" y="195" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#333" filter="url(#textShadow)">Core Processing Engine</text>

    <!-- Session Manager -->
    <rect x="80" y="210" width="150" height="60" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="155" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Session Manager</text>
    <text x="155" y="252" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">User Context</text>

    <!-- BASIC Interpreter -->
    <rect x="250" y="210" width="150" height="60" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="325" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">BASIC Interpreter</text>
    <text x="325" y="252" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Script Execution</text>

    <!-- LLM Integration -->
    <rect x="420" y="210" width="150" height="60" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="495" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">LLM Integration</text>
    <text x="495" y="252" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)" font-weight="600">AI Processing</text>

    <!-- Knowledge Base -->
    <rect x="590" y="210" width="130" height="60" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="655" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Knowledge Base</text>
    <text x="655" y="252" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Vector Search</text>

    <!-- Internal flow arrows -->
    <line x1="230" y1="240" x2="250" y2="240" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.5">
    <line x1="400" y1="240" x2="420" y2="240" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.5">
    <line x1="570" y1="240" x2="590" y2="240" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.5">

    <!-- Tool System -->
    <rect x="80" y="290" width="300" height="60" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="230" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Tool System</text>
    <text x="230" y="332" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">External APIs &amp; Functions</text>

    <!-- Cache Layer -->
    <rect x="420" y="290" width="300" height="60" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="570" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Cache Layer</text>
    <text x="570" y="332" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Response Optimization</text>
  </g>

  <!-- Arrows from Processing to Storage -->
  <line x1="400" y1="370" x2="400" y2="400" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">

  <!-- Storage Layer -->
  <g id="storage-layer">
    <rect x="50" y="400" width="700" height="120" fill="url(#gradient3)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.8" filter="url(#shadow)">
    <text x="400" y="425" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#333" filter="url(#textShadow)">Storage &amp; Persistence Layer</text>

    <!-- Database -->
    <rect x="80" y="450" width="140" height="50" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="150" y="470" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Database</text>
    <text x="150" y="487" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">User Data</text>

    <!-- Vector DB -->
    <rect x="240" y="450" width="140" height="50" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="310" y="470" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Vector DB</text>
    <text x="310" y="487" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Embeddings</text>

    <!-- Drive Storage -->
    <rect x="400" y="450" width="140" height="50" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="470" y="470" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Drive Storage</text>
    <text x="470" y="487" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Files &amp; Assets</text>

    <!-- Cache -->
    <rect x="560" y="450" width="140" height="50" fill="white" stroke="#2563EB" stroke-width="2" rx="4" opacity="0.9" filter="url(#shadow)"/>
    <text x="630" y="470" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Cache</text>
    <text x="630" y="487" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Fast Access</text>
  </g>

  <!-- Bidirectional arrows showing data flow -->
  <g id="flow-arrows" opacity="0.4">
    <!-- Vertical flows -->
    <line x1="155" y1="270" x2="155" y2="450" stroke="#666" stroke-width="2" stroke-dasharray="5,5">
    <line x1="325" y1="270" x2="310" y2="450" stroke="#666" stroke-width="2" stroke-dasharray="5,5">
    <line x1="495" y1="270" x2="470" y2="450" stroke="#666" stroke-width="2" stroke-dasharray="5,5">
    <line x1="655" y1="270" x2="630" y2="450" stroke="#666" stroke-width="2" stroke-dasharray="5,5">
  </g>

  <!-- Legend -->
  <g id="legend" transform="translate(50, 540)">
    <text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#333" filter="url(#textShadow)">Data Flow:</text>
    <line x1="80" y1="-5" x2="120" y2="-5" stroke="#666" stroke-width="2" marker-end="url(#arrow)">
    <text x="125" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Request/Response</text>

    <line x1="250" y1="-5" x2="290" y2="-5" stroke="#666" stroke-width="2" stroke-dasharray="5,5">
    <text x="295" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#666" filter="url(#textShadow)">Data Access</text>
  </g>

  <!-- Performance Note -->
  <text x="400" y="580" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#999" filter="url(#textShadow)">All components run in async Rust for maximum performance</text>


  </g>

</svg>