botserver/docs/src/appendix-i/assets/schema-overview.svg.backup

170 lines
12 KiB
Text
Raw Normal View History

2025-11-25 08:50:03 -03:00
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 980 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="980" height="680" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
<!-- Content container with proper margins -->
<g transform="translate(40, 40)">
<!-- Title -->
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Database Schema Overview</text>
<!-- Organizations -->
<rect x="50" y="60" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="140" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">organizations</text>
<text x="140" y="105" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Top Level Entity</text>
<!-- Bots -->
<rect x="320" y="60" width="180" height="60" fill="none" stroke="#059669" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="410" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">bots</text>
<text x="410" y="105" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Bot Instances</text>
<!-- Bot Configuration -->
<rect x="590" y="60" width="180" height="60" fill="none" stroke="#EA580C" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="680" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">bot_configuration</text>
<text x="680" y="105" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Settings</text>
<!-- Bot Memories -->
<rect x="220" y="180" width="180" height="60" fill="none" stroke="#7C3AED" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="310" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">bot_memories</text>
<text x="310" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">State Storage</text>
<!-- KB Collections -->
<rect x="420" y="180" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="510" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">kb_collections</text>
<text x="510" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Knowledge Base</text>
<!-- KB Documents -->
<rect x="420" y="280" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="510" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">kb_documents</text>
<text x="510" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Documents</text>
<!-- Users -->
<rect x="50" y="380" width="180" height="60" fill="none" stroke="#DC2626" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="140" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">users</text>
<text x="140" y="425" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">User Accounts</text>
<!-- User Sessions -->
<rect x="320" y="380" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="410" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">user_sessions</text>
<text x="410" y="425" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Active Sessions</text>
<!-- Message History -->
<rect x="590" y="380" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="680" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">message_history</text>
<text x="680" y="425" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#1F2937" filter="url(#textShadow)">Chat Messages</text>
<!-- User Login Tokens -->
<rect x="50" y="480" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="140" y="505" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">user_login_tokens</text>
<text x="140" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Auth Tokens</text>
<!-- User KB Associations -->
<rect x="320" y="480" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="410" y="505" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">user_kb_associations</text>
<text x="410" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">KB Access</text>
<!-- Session Tool Associations -->
<rect x="590" y="480" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="680" y="505" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">session_tool_associations</text>
<text x="680" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Tool Access</text>
<!-- Basic Tools -->
<rect x="650" y="280" width="180" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
<text x="740" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">basic_tools</text>
<text x="740" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">BASIC Scripts</text>
<!-- Relationships -->
<g stroke="#6B7280" stroke-width="2" fill="none">
<!-- organizations to bots -->
<line x1="230" y1="90" x2="320" y2="90" marker-end="url(#arrow)">
<text x="275" y="85" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- bots to bot_configuration -->
<line x1="500" y1="90" x2="590" y2="90" marker-end="url(#arrow)">
<text x="545" y="85" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- bots to bot_memories -->
<line x1="360" y1="120" x2="310" y2="180" marker-end="url(#arrow)">
<text x="330" y="150" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- bots to kb_collections -->
<line x1="460" y1="120" x2="510" y2="180" marker-end="url(#arrow)">
<text x="485" y="150" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- kb_collections to kb_documents -->
<line x1="510" y1="240" x2="510" y2="280" marker-end="url(#arrow)">
<text x="525" y="260" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- users to user_sessions -->
<line x1="230" y1="410" x2="320" y2="410" marker-end="url(#arrow)">
<text x="275" y="405" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- user_sessions to message_history -->
<line x1="500" y1="410" x2="590" y2="410" marker-end="url(#arrow)">
<text x="545" y="405" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- users to user_login_tokens -->
<line x1="140" y1="440" x2="140" y2="480" marker-end="url(#arrow)">
<text x="155" y="460" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- user_sessions to user_kb_associations -->
<line x1="410" y1="440" x2="410" y2="480" marker-end="url(#arrow)">
<text x="425" y="460" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- user_sessions to session_tool_associations -->
<line x1="480" y1="440" x2="620" y2="480" marker-end="url(#arrow)">
<text x="550" y="460" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
<!-- user_kb_associations to kb_collections (reference) -->
<path d="M 410 480 Q 410 360 510 240" stroke-dasharray="5,5" marker-end="url(#arrow)" opacity="0.6">
<text x="450" y="360" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">ref</text>
<!-- session_tool_associations to basic_tools (reference) -->
<path d="M 680 480 Q 740 400 740 340" stroke-dasharray="5,5" marker-end="url(#arrow)" opacity="0.6">
<text x="710" y="410" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">ref</text>
<!-- bots to user_sessions (cross reference) -->
<path d="M 410 120 Q 410 250 410 380" stroke-dasharray="3,3" opacity="0.4">
</g>
<!-- Legend -->
<g id="legend" transform="translate(50, 550)">
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Legend:</text>
<line x1="80" y1="-5" x2="120" y2="-5" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
<text x="125" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N Relationship</text>
<line x1="250" y1="-5" x2="290" y2="-5" stroke="#6B7280" stroke-width="2" stroke-dasharray="5,5" marker-end="url(#arrow)" opacity="0.6">
<text x="295" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Reference</text>
</g>
</g>
</svg>