- Defined standard for diagrams.
331
beautify_all_svgs.py
Normal file
|
|
@ -0,0 +1,331 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
SVG Beautifier - Updates all SVG diagrams for perfect readability on all devices
|
||||
with beautiful colors that work in both color and black/white modes.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
# Beautiful color palette that works in grayscale
|
||||
COLORS = {
|
||||
# Primary colors with good contrast
|
||||
'primary_blue': '#2563EB', # Bright blue - appears as dark gray in B&W
|
||||
'primary_green': '#059669', # Emerald green - medium gray in B&W
|
||||
'primary_purple': '#7C3AED', # Purple - medium-dark gray in B&W
|
||||
'primary_orange': '#EA580C', # Orange - medium gray in B&W
|
||||
'primary_red': '#DC2626', # Red - dark gray in B&W
|
||||
'primary_teal': '#0891B2', # Teal - medium gray in B&W
|
||||
|
||||
# Text colors for maximum readability
|
||||
'text_primary': '#1F2937', # Almost black - perfect for main text
|
||||
'text_secondary': '#4B5563', # Dark gray - for secondary text
|
||||
'text_accent': '#2563EB', # Blue for emphasis - dark in B&W
|
||||
|
||||
# Background and border colors
|
||||
'bg_light': '#F9FAFB', # Very light gray background
|
||||
'border_primary': '#2563EB', # Blue borders - visible in B&W
|
||||
'border_secondary': '#9CA3AF', # Gray borders
|
||||
|
||||
# Status colors
|
||||
'success': '#059669', # Green - medium gray in B&W
|
||||
'warning': '#EA580C', # Orange - medium gray in B&W
|
||||
'error': '#DC2626', # Red - dark gray in B&W
|
||||
'info': '#2563EB', # Blue - dark gray in B&W
|
||||
}
|
||||
|
||||
# Consistent font sizes for all devices (matching documentation)
|
||||
FONT_SIZES = {
|
||||
'title': '24', # Main diagram titles
|
||||
'subtitle': '20', # Section titles
|
||||
'heading': '18', # Component headings
|
||||
'body': '16', # Main text (matches doc font size)
|
||||
'label': '14', # Labels and annotations
|
||||
'small': '12', # Small details (minimum for mobile)
|
||||
}
|
||||
|
||||
# Standard margins and padding
|
||||
LAYOUT = {
|
||||
'margin': 40, # Outer margin
|
||||
'padding': 20, # Inner padding
|
||||
'spacing': 15, # Element spacing
|
||||
'corner_radius': 8, # Rounded corners
|
||||
}
|
||||
|
||||
def create_improved_svg(content, filename):
|
||||
"""
|
||||
Transform SVG content with improved styling for all devices.
|
||||
"""
|
||||
|
||||
# Extract viewBox or width/height
|
||||
viewbox_match = re.search(r'viewBox="([^"]+)"', content)
|
||||
width_match = re.search(r'width="(\d+)"', content)
|
||||
height_match = re.search(r'height="(\d+)"', content)
|
||||
|
||||
if viewbox_match:
|
||||
viewbox = viewbox_match.group(1)
|
||||
vb_parts = viewbox.split()
|
||||
width = int(vb_parts[2])
|
||||
height = int(vb_parts[3])
|
||||
elif width_match and height_match:
|
||||
width = int(width_match.group(1))
|
||||
height = int(height_match.group(1))
|
||||
else:
|
||||
width, height = 800, 600 # Default size
|
||||
|
||||
# Add responsive margins
|
||||
new_width = width + (LAYOUT['margin'] * 2)
|
||||
new_height = height + (LAYOUT['margin'] * 2)
|
||||
|
||||
# Create new SVG header with responsive sizing
|
||||
new_header = f'''<svg viewBox="0 0 {new_width} {new_height}"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
style="max-width: 100%; height: auto; min-height: 400px;">
|
||||
|
||||
<!-- Beautiful gradient definitions for depth -->
|
||||
<defs>
|
||||
<linearGradient id="blueGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:{COLORS['primary_blue']};stop-opacity:0.9" />
|
||||
<stop offset="100%" style="stop-color:{COLORS['primary_blue']};stop-opacity:1" />
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="greenGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:{COLORS['primary_green']};stop-opacity:0.9" />
|
||||
<stop offset="100%" style="stop-color:{COLORS['primary_green']};stop-opacity:1" />
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="purpleGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:{COLORS['primary_purple']};stop-opacity:0.9" />
|
||||
<stop offset="100%" style="stop-color:{COLORS['primary_purple']};stop-opacity:1" />
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="orangeGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:{COLORS['primary_orange']};stop-opacity:0.9" />
|
||||
<stop offset="100%" style="stop-color:{COLORS['primary_orange']};stop-opacity:1" />
|
||||
</linearGradient>
|
||||
|
||||
<!-- Enhanced arrow markers -->
|
||||
<marker id="arrow" markerWidth="12" markerHeight="12" refX="11" refY="6"
|
||||
orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,12 L12,6 z" fill="{COLORS['primary_blue']}" />
|
||||
</marker>
|
||||
|
||||
<marker id="arrowGreen" markerWidth="12" markerHeight="12" refX="11" refY="6"
|
||||
orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,12 L12,6 z" fill="{COLORS['primary_green']}" />
|
||||
</marker>
|
||||
|
||||
<!-- Drop shadow filter for depth -->
|
||||
<filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="3"/>
|
||||
<feOffset dx="2" dy="2" result="offsetblur"/>
|
||||
<feComponentTransfer>
|
||||
<feFuncA type="linear" slope="0.2"/>
|
||||
</feComponentTransfer>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
|
||||
<!-- Soft shadow for text -->
|
||||
<filter id="textShadow" x="-50%" y="-50%" width="200%" height="200%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
|
||||
<feOffset dx="1" dy="1" result="offsetblur"/>
|
||||
<feComponentTransfer>
|
||||
<feFuncA type="linear" slope="0.15"/>
|
||||
</feComponentTransfer>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
</defs>
|
||||
|
||||
<!-- White background with subtle border -->
|
||||
<rect x="0" y="0" width="{new_width}" height="{new_height}"
|
||||
fill="{COLORS['bg_light']}" stroke="{COLORS['border_secondary']}"
|
||||
stroke-width="1" rx="{LAYOUT['corner_radius']}" />
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate({LAYOUT['margin']}, {LAYOUT['margin']})">'''
|
||||
|
||||
# Process the content
|
||||
content = re.sub(r'<svg[^>]*>', '', content)
|
||||
content = re.sub(r'</svg>', '', content)
|
||||
|
||||
# Update font sizes to be mobile-friendly and consistent
|
||||
content = re.sub(r'font-size="(\d+)"', lambda m: update_font_size(m), content)
|
||||
content = re.sub(r'font-size:\s*(\d+)(?:px)?', lambda m: f"font-size:{update_font_size_style(m)}", content)
|
||||
|
||||
# Update text colors for better contrast
|
||||
content = re.sub(r'fill="#[A-Fa-f0-9]{6}"', lambda m: update_text_color(m), content)
|
||||
content = re.sub(r'stroke="#[A-Fa-f0-9]{6}"', lambda m: update_stroke_color(m), content)
|
||||
|
||||
# Improve rectangles with better styling
|
||||
content = re.sub(r'<rect([^>]+)>', lambda m: improve_rect(m), content)
|
||||
|
||||
# Update text elements with better positioning and styling
|
||||
content = re.sub(r'<text([^>]*)>(.*?)</text>', lambda m: improve_text(m), content)
|
||||
|
||||
# Add font family consistency
|
||||
content = re.sub(r'font-family="[^"]*"',
|
||||
'font-family="-apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, \'Helvetica Neue\', Arial, sans-serif"',
|
||||
content)
|
||||
|
||||
# Close the container and SVG
|
||||
new_footer = '''
|
||||
</g>
|
||||
</svg>'''
|
||||
|
||||
return new_header + content + new_footer
|
||||
|
||||
def update_font_size(match):
|
||||
"""Update font sizes to be mobile-friendly."""
|
||||
size = int(match.group(1))
|
||||
if size >= 20:
|
||||
return f'font-size="{FONT_SIZES["title"]}"'
|
||||
elif size >= 16:
|
||||
return f'font-size="{FONT_SIZES["heading"]}"'
|
||||
elif size >= 14:
|
||||
return f'font-size="{FONT_SIZES["body"]}"'
|
||||
elif size >= 12:
|
||||
return f'font-size="{FONT_SIZES["label"]}"'
|
||||
else:
|
||||
return f'font-size="{FONT_SIZES["small"]}"'
|
||||
|
||||
def update_font_size_style(match):
|
||||
"""Update font sizes in style attributes."""
|
||||
size = int(match.group(1))
|
||||
if size >= 20:
|
||||
return FONT_SIZES["title"]
|
||||
elif size >= 16:
|
||||
return FONT_SIZES["heading"]
|
||||
elif size >= 14:
|
||||
return FONT_SIZES["body"]
|
||||
elif size >= 12:
|
||||
return FONT_SIZES["label"]
|
||||
else:
|
||||
return FONT_SIZES["small"]
|
||||
|
||||
def update_text_color(match):
|
||||
"""Update text fill colors for better contrast."""
|
||||
color = match.group(0)
|
||||
# Check if it's a light color (rough heuristic)
|
||||
if any(light in color.lower() for light in ['fff', 'fef', 'efe', 'fee', 'eee', 'ddd', 'ccc']):
|
||||
return f'fill="{COLORS["text_primary"]}"'
|
||||
# Keep dark colors but ensure they're dark enough
|
||||
elif any(dark in color.lower() for dark in ['000', '111', '222', '333', '444']):
|
||||
return f'fill="{COLORS["text_primary"]}"'
|
||||
else:
|
||||
# For other colors, use our palette
|
||||
return f'fill="{COLORS["text_secondary"]}"'
|
||||
|
||||
def update_stroke_color(match):
|
||||
"""Update stroke colors to use our palette."""
|
||||
color = match.group(0)
|
||||
# Map to our color palette for consistency
|
||||
if 'blue' in color.lower() or '4a90e2' in color.lower() or '63b3ed' in color.lower():
|
||||
return f'stroke="{COLORS["primary_blue"]}"'
|
||||
elif 'green' in color.lower() or '48bb78' in color.lower() or '68d391' in color.lower():
|
||||
return f'stroke="{COLORS["primary_green"]}"'
|
||||
elif 'purple' in color.lower() or 'b794f4' in color.lower() or '9f7aea' in color.lower():
|
||||
return f'stroke="{COLORS["primary_purple"]}"'
|
||||
elif 'orange' in color.lower() or 'f6ad55' in color.lower() or 'ed8936' in color.lower():
|
||||
return f'stroke="{COLORS["primary_orange"]}"'
|
||||
elif 'red' in color.lower() or 'e53e3e' in color.lower() or 'fc8181' in color.lower():
|
||||
return f'stroke="{COLORS["primary_red"]}"'
|
||||
else:
|
||||
return f'stroke="{COLORS["border_primary"]}"'
|
||||
|
||||
def improve_rect(match):
|
||||
"""Improve rectangle elements with better styling."""
|
||||
rect = match.group(0)
|
||||
# Add rounded corners if not present
|
||||
if 'rx=' not in rect:
|
||||
rect = rect[:-1] + f' rx="{LAYOUT["corner_radius"]}">'
|
||||
# Add subtle shadow for depth
|
||||
if 'filter=' not in rect:
|
||||
rect = rect[:-1] + ' filter="url(#shadow)">'
|
||||
# Ensure proper stroke width
|
||||
rect = re.sub(r'stroke-width="[^"]*"', 'stroke-width="2"', rect)
|
||||
return rect
|
||||
|
||||
def improve_text(match):
|
||||
"""Improve text elements with better styling."""
|
||||
text_tag = match.group(1)
|
||||
text_content = match.group(2)
|
||||
|
||||
# Add text shadow for better readability
|
||||
if 'filter=' not in text_tag:
|
||||
text_tag += ' filter="url(#textShadow)"'
|
||||
|
||||
# Ensure text has proper weight for readability
|
||||
if 'font-weight=' not in text_tag and any(word in text_content.lower() for word in ['title', 'process', 'flow', 'system']):
|
||||
text_tag += ' font-weight="600"'
|
||||
|
||||
return f'<text{text_tag}>{text_content}</text>'
|
||||
|
||||
def process_all_svgs():
|
||||
"""Process all SVG files in the docs directory."""
|
||||
docs_dir = Path('docs')
|
||||
|
||||
# Find all SVG files
|
||||
svg_files = list(docs_dir.glob('**/*.svg'))
|
||||
|
||||
print(f"Found {len(svg_files)} SVG files to beautify")
|
||||
|
||||
for svg_file in svg_files:
|
||||
# Skip font files
|
||||
if 'fontawesome' in str(svg_file).lower() or 'favicon' in str(svg_file).lower():
|
||||
print(f"Skipping font/favicon file: {svg_file}")
|
||||
continue
|
||||
|
||||
print(f"Beautifying: {svg_file}")
|
||||
|
||||
try:
|
||||
# Read the original content
|
||||
with open(svg_file, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Skip if already processed
|
||||
if 'Beautiful gradient definitions' in content:
|
||||
print(f" Already beautified, skipping...")
|
||||
continue
|
||||
|
||||
# Create improved version
|
||||
improved = create_improved_svg(content, svg_file.name)
|
||||
|
||||
# Save the improved version
|
||||
with open(svg_file, 'w', encoding='utf-8') as f:
|
||||
f.write(improved)
|
||||
|
||||
print(f" ✓ Successfully beautified!")
|
||||
|
||||
except Exception as e:
|
||||
print(f" ✗ Error processing {svg_file}: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("=" * 60)
|
||||
print("SVG BEAUTIFIER - Making diagrams beautiful for all devices")
|
||||
print("=" * 60)
|
||||
print("\nFeatures:")
|
||||
print("• Consistent text sizing matching documentation")
|
||||
print("• Proper margins and padding for mobile")
|
||||
print("• Beautiful colors that work in black & white")
|
||||
print("• Responsive design for all screen sizes")
|
||||
print("• Enhanced readability with shadows and gradients")
|
||||
print("\nStarting beautification process...\n")
|
||||
|
||||
process_all_svgs()
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("✨ Beautification complete!")
|
||||
print("All SVGs now have:")
|
||||
print("• Mobile-friendly text sizes (min 12px)")
|
||||
print("• Consistent font family")
|
||||
print("• Proper margins (40px) and padding (20px)")
|
||||
print("• High contrast colors readable in B&W")
|
||||
print("• Responsive viewBox settings")
|
||||
print("=" * 60)
|
||||
|
|
@ -1,100 +1,96 @@
|
|||
<svg width="800" height="400" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
</marker>
|
||||
<marker id="arrow-ref" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#999"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Knowledge Base Access</text>
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">Knowledge Base Access</text>
|
||||
|
||||
<!-- user_sessions -->
|
||||
<rect x="50" y="80" width="200" height="120" fill="none" stroke="#FBBF24" stroke-width="2" rx="8"/>
|
||||
<rect x="50" y="80" width="200" height="30" fill="none" stroke="#FBBF24" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="150" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FCD34D">user_sessions</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<text x="60" y="130">• id</text>
|
||||
<text x="60" y="145">• user_id</text>
|
||||
<text x="60" y="160">• bot_id</text>
|
||||
<text x="60" y="175">• session_token</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to user_kb_associations -->
|
||||
<line x1="250" y1="140" x2="320" y2="140" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="285" y="130" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#718096">Has Access</text>
|
||||
<rect x="20" y="60" width="160" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="100" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_sessions</text>
|
||||
|
||||
<!-- user_kb_associations -->
|
||||
<rect x="320" y="80" width="200" height="120" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8"/>
|
||||
<rect x="320" y="80" width="200" height="30" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="420" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">user_kb_associations</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<text x="330" y="130">• id</text>
|
||||
<text x="330" y="145">• session_id</text>
|
||||
<text x="330" y="160">• kb_id</text>
|
||||
<text x="330" y="175">• created_at</text>
|
||||
</g>
|
||||
|
||||
<!-- Reference arrow down -->
|
||||
<line x1="420" y1="200" x2="420" y2="240" stroke="#999" stroke-width="2" stroke-dasharray="5,5" marker-end="url(#arrow-ref)"/>
|
||||
<text x="435" y="220" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#718096">References</text>
|
||||
<rect x="240" y="60" width="160" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="320" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_kb_associations</text>
|
||||
|
||||
<!-- kb_collections -->
|
||||
<rect x="50" y="240" width="200" height="140" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<rect x="50" y="240" width="200" height="30" fill="none" stroke="#48BB78" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="150" y="260" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">kb_collections</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<text x="60" y="290">• id</text>
|
||||
<text x="60" y="305">• bot_id</text>
|
||||
<text x="60" y="320">• name</text>
|
||||
<text x="60" y="335">• created_at</text>
|
||||
<text x="60" y="350">• metadata</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to kb_documents -->
|
||||
<line x1="250" y1="310" x2="320" y2="310" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="285" y="300" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#718096">Contains</text>
|
||||
<text x="285" y="320" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<rect x="20" y="180" width="160" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="100" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">kb_collections</text>
|
||||
|
||||
<!-- kb_documents -->
|
||||
<rect x="320" y="240" width="200" height="140" fill="none" stroke="#68D391" stroke-width="2" rx="8"/>
|
||||
<rect x="320" y="240" width="200" height="30" fill="none" stroke="#68D391" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="420" y="260" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#9AE6B4">kb_documents</text>
|
||||
<rect x="240" y="180" width="160" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="320" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">kb_documents</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<text x="330" y="290">• id</text>
|
||||
<text x="330" y="305">• collection_id</text>
|
||||
<text x="330" y="320">• content</text>
|
||||
<text x="330" y="335">• embeddings</text>
|
||||
<text x="330" y="350">• metadata</text>
|
||||
<!-- Vector Storage -->
|
||||
<rect x="460" y="180" width="160" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="540" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Vector Storage</text>
|
||||
|
||||
<!-- Field details -->
|
||||
<g font-family="Arial, sans-serif" font-size="11" fill="#666">
|
||||
<!-- user_sessions fields -->
|
||||
<text x="30" y="120">id, user_id</text>
|
||||
<text x="30" y="135">bot_id, session_token</text>
|
||||
|
||||
<!-- user_kb_associations fields -->
|
||||
<text x="250" y="120">id, session_id</text>
|
||||
<text x="250" y="135">kb_id, created_at</text>
|
||||
|
||||
<!-- kb_collections fields -->
|
||||
<text x="30" y="240">id, bot_id, name</text>
|
||||
<text x="30" y="255">created_at, metadata</text>
|
||||
|
||||
<!-- kb_documents fields -->
|
||||
<text x="250" y="240">id, collection_id</text>
|
||||
<text x="250" y="255">content, embeddings</text>
|
||||
|
||||
<!-- Vector Storage info -->
|
||||
<text x="470" y="240">Embeddings stored</text>
|
||||
<text x="470" y="255">for semantic search</text>
|
||||
</g>
|
||||
|
||||
<!-- Vector indicator -->
|
||||
<g id="vector-indicator" transform="translate(550, 280)">
|
||||
<rect x="0" y="0" width="180" height="80" fill="none" stroke="#B794F4" stroke-width="1" rx="5" stroke-dasharray="3,3" opacity="0.7"/>
|
||||
<text x="90" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#D6BCFA">Vector Storage</text>
|
||||
<text x="90" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Embeddings stored</text>
|
||||
<text x="90" y="60" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">for semantic search</text>
|
||||
<!-- Arrows -->
|
||||
<g stroke="#666" stroke-width="2" fill="none">
|
||||
<!-- user_sessions to user_kb_associations -->
|
||||
<line x1="180" y1="80" x2="240" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- user_kb_associations references kb_collections (dashed) -->
|
||||
<path d="M320,100 Q320,140 100,140 Q100,160 100,180" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- kb_collections to kb_documents -->
|
||||
<line x1="180" y1="200" x2="240" y2="200" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- kb_documents to Vector Storage -->
|
||||
<line x1="400" y1="200" x2="460" y2="200" marker-end="url(#arrow)"/>
|
||||
</g>
|
||||
|
||||
<!-- Connection from kb_documents to vector indicator -->
|
||||
<line x1="520" y1="335" x2="550" y2="320" stroke="#B794F4" stroke-width="1" stroke-dasharray="3,3" opacity="0.7"/>
|
||||
<!-- Relationship labels -->
|
||||
<text x="210" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">Has Access</text>
|
||||
<text x="210" y="195" font-family="Arial, sans-serif" font-size="11" fill="#666">Contains</text>
|
||||
<text x="210" y="210" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="430" y="195" font-family="Arial, sans-serif" font-size="11" fill="#666">Indexes</text>
|
||||
<text x="210" y="140" font-family="Arial, sans-serif" font-size="11" fill="#666">References</text>
|
||||
|
||||
<!-- Access flow description -->
|
||||
<g id="access-flow" transform="translate(550, 100)">
|
||||
<rect x="0" y="0" width="200" height="100" fill="none" stroke="#4A5568" stroke-width="1" rx="5" stroke-dasharray="2,2" opacity="0.5"/>
|
||||
<text x="100" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Access Pattern</text>
|
||||
|
||||
<g font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">
|
||||
<text x="10" y="40">1. Session requests KB</text>
|
||||
<text x="10" y="55">2. Association created</text>
|
||||
<text x="10" y="70">3. KB documents available</text>
|
||||
<text x="10" y="85">4. Vector search enabled</text>
|
||||
</g>
|
||||
<!-- Access Pattern Box -->
|
||||
<g transform="translate(460, 60)">
|
||||
<rect width="320" height="90" fill="none" stroke="#666" stroke-width="1" rx="5" opacity="0.3"/>
|
||||
<text x="10" y="20" font-family="Arial, sans-serif" font-size="12" font-weight="600" fill="#333">Access Pattern:</text>
|
||||
<text x="10" y="40" font-family="Arial, sans-serif" font-size="12" fill="#666">1. Session requests KB access</text>
|
||||
<text x="10" y="55" font-family="Arial, sans-serif" font-size="12" fill="#666">2. Association created in user_kb_associations</text>
|
||||
<text x="10" y="70" font-family="Arial, sans-serif" font-size="12" fill="#666">3. KB documents become available</text>
|
||||
<text x="10" y="85" font-family="Arial, sans-serif" font-size="12" fill="#666">4. Vector search enabled on embeddings</text>
|
||||
</g>
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="320" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
Sessions gain access to knowledge bases through associations, enabling vector search on document embeddings
|
||||
</text>
|
||||
<text x="400" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
Each collection contains multiple documents with pre-computed embeddings for semantic search
|
||||
</text>
|
||||
<text x="400" y="360" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
Access is controlled per session, allowing dynamic knowledge base selection during conversations
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5 KiB |
128
docs/src/appendix-i/assets/kb-access.svg.backup
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 880 480" 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="480" 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="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Knowledge Base Access</text>
|
||||
|
||||
<!-- user_sessions -->
|
||||
<rect x="50" y="80" width="200" height="120" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<rect x="50" y="80" width="200" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="8 8 0 0" filter="url(#shadow)"/>
|
||||
<text x="150" y="100" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="60" y="130" filter="url(#textShadow)">• id</text>
|
||||
<text x="60" y="145" filter="url(#textShadow)">• user_id</text>
|
||||
<text x="60" y="160" filter="url(#textShadow)">• bot_id</text>
|
||||
<text x="60" y="175" filter="url(#textShadow)">• session_token</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to user_kb_associations -->
|
||||
<line x1="250" y1="140" x2="320" y2="140" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<text x="285" y="130" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Has Access</text>
|
||||
|
||||
<!-- user_kb_associations -->
|
||||
<rect x="320" y="80" width="200" height="120" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<rect x="320" y="80" width="200" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="8 8 0 0" filter="url(#shadow)"/>
|
||||
<text x="420" y="100" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="330" y="130" filter="url(#textShadow)">• id</text>
|
||||
<text x="330" y="145" filter="url(#textShadow)">• session_id</text>
|
||||
<text x="330" y="160" filter="url(#textShadow)">• kb_id</text>
|
||||
<text x="330" y="175" filter="url(#textShadow)">• created_at</text>
|
||||
</g>
|
||||
|
||||
<!-- Reference arrow down -->
|
||||
<line x1="420" y1="200" x2="420" y2="240" stroke="#999" stroke-width="2" stroke-dasharray="5,5" marker-end="url(#arrow-ref)">
|
||||
<text x="435" y="220" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">References</text>
|
||||
|
||||
<!-- kb_collections -->
|
||||
<rect x="50" y="240" width="200" height="140" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<rect x="50" y="240" width="200" height="30" fill="none" stroke="#059669" stroke-width="2" rx="8 8 0 0" filter="url(#shadow)"/>
|
||||
<text x="150" y="260" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="60" y="290" filter="url(#textShadow)">• id</text>
|
||||
<text x="60" y="305" filter="url(#textShadow)">• bot_id</text>
|
||||
<text x="60" y="320" filter="url(#textShadow)">• name</text>
|
||||
<text x="60" y="335" filter="url(#textShadow)">• created_at</text>
|
||||
<text x="60" y="350" filter="url(#textShadow)">• metadata</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to kb_documents -->
|
||||
<line x1="250" y1="310" x2="320" y2="310" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<text x="285" y="300" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Contains</text>
|
||||
<text x="285" y="320" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
|
||||
|
||||
<!-- kb_documents -->
|
||||
<rect x="320" y="240" width="200" height="140" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<rect x="320" y="240" width="200" height="30" fill="none" stroke="#059669" stroke-width="2" rx="8 8 0 0" filter="url(#shadow)"/>
|
||||
<text x="420" y="260" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="330" y="290" filter="url(#textShadow)">• id</text>
|
||||
<text x="330" y="305" filter="url(#textShadow)">• collection_id</text>
|
||||
<text x="330" y="320" filter="url(#textShadow)">• content</text>
|
||||
<text x="330" y="335" filter="url(#textShadow)">• embeddings</text>
|
||||
<text x="330" y="350" filter="url(#textShadow)">• metadata</text>
|
||||
</g>
|
||||
|
||||
<!-- Vector indicator -->
|
||||
<g id="vector-indicator" transform="translate(550, 280)">
|
||||
<rect x="0" y="0" width="180" height="80" fill="none" stroke="#7C3AED" stroke-width="2" rx="5" stroke-dasharray="3,3" opacity="0.7" filter="url(#shadow)"/>
|
||||
<text x="90" y="25" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Vector Storage</text>
|
||||
<text x="90" y="45" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Embeddings stored</text>
|
||||
<text x="90" y="60" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">for semantic search</text>
|
||||
</g>
|
||||
|
||||
<!-- Connection from kb_documents to vector indicator -->
|
||||
<line x1="520" y1="335" x2="550" y2="320" stroke="#7C3AED" stroke-width="2" stroke-dasharray="3,3" opacity="0.7">
|
||||
|
||||
<!-- Access flow description -->
|
||||
<g id="access-flow" transform="translate(550, 100)">
|
||||
<rect x="0" y="0" width="200" height="100" fill="none" stroke="#2563EB" stroke-width="2" rx="5" stroke-dasharray="2,2" opacity="0.5" filter="url(#shadow)"/>
|
||||
<text x="100" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Access Pattern</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="10" y="40" filter="url(#textShadow)">1. Session requests KB</text>
|
||||
<text x="10" y="55" filter="url(#textShadow)">2. Association created</text>
|
||||
<text x="10" y="70" filter="url(#textShadow)">3. KB documents available</text>
|
||||
<text x="10" y="85" filter="url(#textShadow)">4. Vector search enabled</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.7 KiB |
|
|
@ -1,186 +1,128 @@
|
|||
<svg width="1000" height="700" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="450" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="500" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Database Entity Details</text>
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">Database Entity Details</text>
|
||||
|
||||
<!-- Organizations Table -->
|
||||
<g id="organizations">
|
||||
<rect x="50" y="60" width="400" height="150" fill="none" stroke="#4299E1" stroke-width="2" rx="5"/>
|
||||
<rect x="50" y="60" width="400" height="30" fill="none" stroke="#4299E1" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="250" y="80" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#63B3ED">organizations</text>
|
||||
<!-- Organizations -->
|
||||
<rect x="20" y="60" width="120" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="80" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">organizations</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="60" y="110">id: UUID (PK)</text>
|
||||
<text x="60" y="130">name: VARCHAR(255)</text>
|
||||
<text x="60" y="150">created_at: TIMESTAMPTZ</text>
|
||||
<text x="60" y="170">updated_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Bots -->
|
||||
<rect x="200" y="60" width="100" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="250" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">bots</text>
|
||||
|
||||
<!-- Bots Table -->
|
||||
<g id="bots">
|
||||
<rect x="550" y="60" width="400" height="190" fill="none" stroke="#48BB78" stroke-width="2" rx="5"/>
|
||||
<rect x="550" y="60" width="400" height="30" fill="none" stroke="#48BB78" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="750" y="80" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">bots</text>
|
||||
<!-- Users -->
|
||||
<rect x="360" y="60" width="100" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="410" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">users</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="560" y="110">id: UUID (PK)</text>
|
||||
<text x="560" y="130">organization_id: UUID (FK)</text>
|
||||
<text x="560" y="150">name: VARCHAR(255)</text>
|
||||
<text x="560" y="170">configuration: JSONB</text>
|
||||
<text x="560" y="190">created_at: TIMESTAMPTZ</text>
|
||||
<text x="560" y="210">updated_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
<!-- User Sessions -->
|
||||
<rect x="520" y="60" width="120" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="580" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_sessions</text>
|
||||
|
||||
<!-- Bot Memories Table -->
|
||||
<g id="bot_memories">
|
||||
<rect x="50" y="290" width="280" height="130" fill="none" stroke="#B794F4" stroke-width="2" rx="5"/>
|
||||
<rect x="50" y="290" width="280" height="30" fill="none" stroke="#B794F4" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="190" y="310" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">bot_memories</text>
|
||||
<!-- Bot Memories -->
|
||||
<rect x="20" y="160" width="120" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="80" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">bot_memories</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="60" y="340">id: UUID (PK)</text>
|
||||
<text x="60" y="360">bot_id: UUID (FK)</text>
|
||||
<text x="60" y="380">key: TEXT</text>
|
||||
<text x="60" y="400">value: TEXT</text>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Message History -->
|
||||
<rect x="200" y="160" width="120" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="260" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">message_history</text>
|
||||
|
||||
<!-- User Sessions Table -->
|
||||
<g id="user_sessions">
|
||||
<rect x="360" y="290" width="280" height="170" fill="none" stroke="#FBBF24" stroke-width="2" rx="5"/>
|
||||
<rect x="360" y="290" width="280" height="30" fill="none" stroke="#FBBF24" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="500" y="310" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FCD34D">user_sessions</text>
|
||||
<!-- KB Collections -->
|
||||
<rect x="380" y="160" width="120" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="440" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">kb_collections</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="370" y="340">id: UUID (PK)</text>
|
||||
<text x="370" y="360">user_id: UUID (FK)</text>
|
||||
<text x="370" y="380">bot_id: UUID (FK)</text>
|
||||
<text x="370" y="400">session_token: TEXT</text>
|
||||
<text x="370" y="420">created_at: TIMESTAMPTZ</text>
|
||||
<text x="370" y="440">expires_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
<!-- KB Documents -->
|
||||
<rect x="560" y="160" width="120" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="620" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">kb_documents</text>
|
||||
|
||||
<!-- KB Collections Table -->
|
||||
<g id="kb_collections">
|
||||
<rect x="670" y="290" width="280" height="150" fill="none" stroke="#4FD1C5" stroke-width="2" rx="5"/>
|
||||
<rect x="670" y="290" width="280" height="30" fill="none" stroke="#4FD1C5" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="810" y="310" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">kb_collections</text>
|
||||
<!-- Field Details -->
|
||||
<g font-family="Arial, sans-serif" font-size="11" fill="#666">
|
||||
<!-- organizations -->
|
||||
<text x="30" y="115">id, name</text>
|
||||
<text x="30" y="130">created_at</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="680" y="340">id: TEXT (PK)</text>
|
||||
<text x="680" y="360">bot_id: UUID (FK)</text>
|
||||
<text x="680" y="380">name: TEXT</text>
|
||||
<text x="680" y="400">description: TEXT</text>
|
||||
<text x="680" y="420">created_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
<!-- bots -->
|
||||
<text x="210" y="115">id, org_id</text>
|
||||
<text x="210" y="130">name, config</text>
|
||||
|
||||
<!-- Users Table -->
|
||||
<g id="users">
|
||||
<rect x="50" y="480" width="280" height="170" fill="none" stroke="#FC8181" stroke-width="2" rx="5"/>
|
||||
<rect x="50" y="480" width="280" height="30" fill="none" stroke="#FC8181" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="190" y="500" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">users</text>
|
||||
<!-- users -->
|
||||
<text x="370" y="115">id, username</text>
|
||||
<text x="370" y="130">email, active</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="60" y="530">id: UUID (PK)</text>
|
||||
<text x="60" y="550">username: TEXT</text>
|
||||
<text x="60" y="570">email: TEXT</text>
|
||||
<text x="60" y="590">password_hash: TEXT</text>
|
||||
<text x="60" y="610">active: BOOLEAN</text>
|
||||
<text x="60" y="630">created_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
<!-- user_sessions -->
|
||||
<text x="530" y="115">id, user_id, bot_id</text>
|
||||
<text x="530" y="130">token, expires_at</text>
|
||||
|
||||
<!-- Message History Table -->
|
||||
<g id="message_history">
|
||||
<rect x="360" y="480" width="280" height="170" fill="none" stroke="#A78BFA" stroke-width="2" rx="5"/>
|
||||
<rect x="360" y="480" width="280" height="30" fill="none" stroke="#A78BFA" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="500" y="500" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#C4B5FD">message_history</text>
|
||||
<!-- bot_memories -->
|
||||
<text x="30" y="215">id, bot_id</text>
|
||||
<text x="30" y="230">key, value</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="370" y="530">id: UUID (PK)</text>
|
||||
<text x="370" y="550">session_id: UUID (FK)</text>
|
||||
<text x="370" y="570">user_id: UUID (FK)</text>
|
||||
<text x="370" y="590">bot_id: UUID (FK)</text>
|
||||
<text x="370" y="610">message: TEXT</text>
|
||||
<text x="370" y="630">sender: TEXT</text>
|
||||
</g>
|
||||
</g>
|
||||
<!-- message_history -->
|
||||
<text x="210" y="215">id, session_id</text>
|
||||
<text x="210" y="230">message, sender</text>
|
||||
|
||||
<!-- KB Documents Table -->
|
||||
<g id="kb_documents">
|
||||
<rect x="670" y="480" width="280" height="170" fill="none" stroke="#34D399" stroke-width="2" rx="5"/>
|
||||
<rect x="670" y="480" width="280" height="30" fill="none" stroke="#34D399" stroke-width="2" rx="5 5 0 0"/>
|
||||
<text x="810" y="500" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#6EE7B7">kb_documents</text>
|
||||
<!-- kb_collections -->
|
||||
<text x="390" y="215">id, bot_id</text>
|
||||
<text x="390" y="230">name, description</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<text x="680" y="530">id: UUID (PK)</text>
|
||||
<text x="680" y="550">collection_id: TEXT (FK)</text>
|
||||
<text x="680" y="570">content: TEXT</text>
|
||||
<text x="680" y="590">embeddings: VECTOR</text>
|
||||
<text x="680" y="610">metadata: JSONB</text>
|
||||
<text x="680" y="630">created_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
<!-- kb_documents -->
|
||||
<text x="570" y="215">id, collection_id</text>
|
||||
<text x="570" y="230">content, embeddings</text>
|
||||
</g>
|
||||
|
||||
<!-- Relationships -->
|
||||
<g stroke="#888" stroke-width="2" fill="none">
|
||||
<g stroke="#666" stroke-width="2" fill="none">
|
||||
<!-- organizations to bots -->
|
||||
<line x1="450" y1="135" x2="550" y2="135" marker-end="url(#arrow)"/>
|
||||
<text x="500" y="130" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<line x1="140" y1="80" x2="200" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- bots to bot_memories -->
|
||||
<line x1="750" y1="250" x2="190" y2="290" marker-end="url(#arrow)"/>
|
||||
<text x="470" y="270" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<!-- users to user_sessions -->
|
||||
<line x1="460" y1="80" x2="520" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- bots to user_sessions -->
|
||||
<line x1="750" y1="250" x2="500" y2="290" marker-end="url(#arrow)"/>
|
||||
<path d="M250,100 Q250,120 580,120 Q580,100 580,100" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- bots to kb_collections -->
|
||||
<line x1="750" y1="250" x2="810" y2="290" marker-end="url(#arrow)"/>
|
||||
<text x="780" y="270" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
|
||||
<!-- kb_collections to kb_documents -->
|
||||
<line x1="810" y1="440" x2="810" y2="480" marker-end="url(#arrow)"/>
|
||||
<text x="825" y="460" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<!-- bots to bot_memories -->
|
||||
<path d="M250,100 Q250,130 80,130 Q80,150 80,160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- user_sessions to message_history -->
|
||||
<line x1="500" y1="460" x2="500" y2="480" marker-end="url(#arrow)"/>
|
||||
<text x="515" y="470" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M580,100 Q580,130 260,130 Q260,150 260,160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- users to user_sessions (dotted) -->
|
||||
<path d="M 330 565 L 360 390" stroke-dasharray="5,5" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
<text x="345" y="475" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<!-- bots to kb_collections -->
|
||||
<path d="M250,100 Q250,130 440,130 Q440,150 440,160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- kb_collections to kb_documents -->
|
||||
<line x1="500" y1="180" x2="560" y2="180" marker-end="url(#arrow)"/>
|
||||
</g>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(50, 670)">
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Color Coding:</text>
|
||||
<!-- Relationship labels -->
|
||||
<text x="170" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="490" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="530" y="175" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="165" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="350" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="420" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
|
||||
<rect x="100" y="-10" width="20" height="10" fill="none" stroke="#4299E1" stroke-width="2"/>
|
||||
<text x="125" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Organization</text>
|
||||
<!-- Schema Info Box -->
|
||||
<g transform="translate(20, 260)">
|
||||
<rect width="760" height="140" fill="none" stroke="#666" stroke-width="1" rx="5" opacity="0.3"/>
|
||||
<text x="10" y="20" font-family="Arial, sans-serif" font-size="12" font-weight="600" fill="#333">Key Relationships:</text>
|
||||
|
||||
<rect x="220" y="-10" width="20" height="10" fill="none" stroke="#48BB78" stroke-width="2"/>
|
||||
<text x="245" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Bot Core</text>
|
||||
|
||||
<rect x="320" y="-10" width="20" height="10" fill="none" stroke="#FBBF24" stroke-width="2"/>
|
||||
<text x="345" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Sessions</text>
|
||||
|
||||
<rect x="420" y="-10" width="20" height="10" fill="none" stroke="#4FD1C5" stroke-width="2"/>
|
||||
<text x="445" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Knowledge</text>
|
||||
|
||||
<rect x="530" y="-10" width="20" height="10" fill="none" stroke="#FC8181" stroke-width="2"/>
|
||||
<text x="555" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Users</text>
|
||||
|
||||
<rect x="620" y="-10" width="20" height="10" fill="none" stroke="#A78BFA" stroke-width="2"/>
|
||||
<text x="645" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Messages</text>
|
||||
<text x="10" y="40" font-family="Arial, sans-serif" font-size="12" fill="#666">• Organizations own multiple Bots</text>
|
||||
<text x="10" y="55" font-family="Arial, sans-serif" font-size="12" fill="#666">• Users create multiple Sessions with Bots</text>
|
||||
<text x="10" y="70" font-family="Arial, sans-serif" font-size="12" fill="#666">• Sessions generate Message History</text>
|
||||
<text x="10" y="85" font-family="Arial, sans-serif" font-size="12" fill="#666">• Bots maintain Memories (key-value pairs)</text>
|
||||
<text x="10" y="100" font-family="Arial, sans-serif" font-size="12" fill="#666">• Bots have Knowledge Collections containing Documents</text>
|
||||
<text x="10" y="115" font-family="Arial, sans-serif" font-size="12" fill="#666">• Documents store embeddings for vector search</text>
|
||||
<text x="10" y="130" font-family="Arial, sans-serif" font-size="12" fill="#666">• All entities use UUIDs as primary keys (except KB collections using TEXT)</text>
|
||||
</g>
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="430" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
Core database schema supporting multi-tenant bot operations with session management and vector search capabilities
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 6.4 KiB |
217
docs/src/appendix-i/assets/schema-detailed.svg.backup
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 1080 780" 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="1080" height="780" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<text x="500" 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 Entity Details</text>
|
||||
|
||||
<!-- Organizations Table -->
|
||||
<g id="organizations">
|
||||
<rect x="50" y="60" width="400" height="150" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="50" y="60" width="400" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="250" y="80" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">organizations</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="60" y="110" filter="url(#textShadow)">id: UUID (PK)</text>
|
||||
<text x="60" y="130" filter="url(#textShadow)">name: VARCHAR(255)</text>
|
||||
<text x="60" y="150" filter="url(#textShadow)">created_at: TIMESTAMPTZ</text>
|
||||
<text x="60" y="170" filter="url(#textShadow)">updated_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Bots Table -->
|
||||
<g id="bots">
|
||||
<rect x="550" y="60" width="400" height="190" fill="none" stroke="#059669" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="550" y="60" width="400" height="30" fill="none" stroke="#059669" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="750" y="80" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">bots</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="560" y="110" filter="url(#textShadow)">id: UUID (PK)</text>
|
||||
<text x="560" y="130" filter="url(#textShadow)">organization_id: UUID (FK)</text>
|
||||
<text x="560" y="150" filter="url(#textShadow)">name: VARCHAR(255)</text>
|
||||
<text x="560" y="170" filter="url(#textShadow)">configuration: JSONB</text>
|
||||
<text x="560" y="190" filter="url(#textShadow)">created_at: TIMESTAMPTZ</text>
|
||||
<text x="560" y="210" filter="url(#textShadow)">updated_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Bot Memories Table -->
|
||||
<g id="bot_memories">
|
||||
<rect x="50" y="290" width="280" height="130" fill="none" stroke="#7C3AED" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="50" y="290" width="280" height="30" fill="none" stroke="#7C3AED" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="190" y="310" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="60" y="340" filter="url(#textShadow)">id: UUID (PK)</text>
|
||||
<text x="60" y="360" filter="url(#textShadow)">bot_id: UUID (FK)</text>
|
||||
<text x="60" y="380" filter="url(#textShadow)">key: TEXT</text>
|
||||
<text x="60" y="400" filter="url(#textShadow)">value: TEXT</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- User Sessions Table -->
|
||||
<g id="user_sessions">
|
||||
<rect x="360" y="290" width="280" height="170" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="360" y="290" width="280" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="500" y="310" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="370" y="340" filter="url(#textShadow)">id: UUID (PK)</text>
|
||||
<text x="370" y="360" filter="url(#textShadow)">user_id: UUID (FK)</text>
|
||||
<text x="370" y="380" filter="url(#textShadow)">bot_id: UUID (FK)</text>
|
||||
<text x="370" y="400" filter="url(#textShadow)">session_token: TEXT</text>
|
||||
<text x="370" y="420" filter="url(#textShadow)">created_at: TIMESTAMPTZ</text>
|
||||
<text x="370" y="440" filter="url(#textShadow)">expires_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- KB Collections Table -->
|
||||
<g id="kb_collections">
|
||||
<rect x="670" y="290" width="280" height="150" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="670" y="290" width="280" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="810" y="310" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="680" y="340" filter="url(#textShadow)">id: TEXT (PK)</text>
|
||||
<text x="680" y="360" filter="url(#textShadow)">bot_id: UUID (FK)</text>
|
||||
<text x="680" y="380" filter="url(#textShadow)">name: TEXT</text>
|
||||
<text x="680" y="400" filter="url(#textShadow)">description: TEXT</text>
|
||||
<text x="680" y="420" filter="url(#textShadow)">created_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Users Table -->
|
||||
<g id="users">
|
||||
<rect x="50" y="480" width="280" height="170" fill="none" stroke="#DC2626" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="50" y="480" width="280" height="30" fill="none" stroke="#DC2626" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="190" y="500" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">users</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="60" y="530" filter="url(#textShadow)">id: UUID (PK)</text>
|
||||
<text x="60" y="550" filter="url(#textShadow)">username: TEXT</text>
|
||||
<text x="60" y="570" filter="url(#textShadow)">email: TEXT</text>
|
||||
<text x="60" y="590" filter="url(#textShadow)">password_hash: TEXT</text>
|
||||
<text x="60" y="610" filter="url(#textShadow)">active: BOOLEAN</text>
|
||||
<text x="60" y="630" filter="url(#textShadow)">created_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Message History Table -->
|
||||
<g id="message_history">
|
||||
<rect x="360" y="480" width="280" height="170" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="360" y="480" width="280" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="500" y="500" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="370" y="530" filter="url(#textShadow)">id: UUID (PK)</text>
|
||||
<text x="370" y="550" filter="url(#textShadow)">session_id: UUID (FK)</text>
|
||||
<text x="370" y="570" filter="url(#textShadow)">user_id: UUID (FK)</text>
|
||||
<text x="370" y="590" filter="url(#textShadow)">bot_id: UUID (FK)</text>
|
||||
<text x="370" y="610" filter="url(#textShadow)">message: TEXT</text>
|
||||
<text x="370" y="630" filter="url(#textShadow)">sender: TEXT</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- KB Documents Table -->
|
||||
<g id="kb_documents">
|
||||
<rect x="670" y="480" width="280" height="170" fill="none" stroke="#2563EB" stroke-width="2" rx="5" filter="url(#shadow)"/>
|
||||
<rect x="670" y="480" width="280" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="5 5 0 0" filter="url(#shadow)"/>
|
||||
<text x="810" y="500" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="680" y="530" filter="url(#textShadow)">id: UUID (PK)</text>
|
||||
<text x="680" y="550" filter="url(#textShadow)">collection_id: TEXT (FK)</text>
|
||||
<text x="680" y="570" filter="url(#textShadow)">content: TEXT</text>
|
||||
<text x="680" y="590" filter="url(#textShadow)">embeddings: VECTOR</text>
|
||||
<text x="680" y="610" filter="url(#textShadow)">metadata: JSONB</text>
|
||||
<text x="680" y="630" filter="url(#textShadow)">created_at: TIMESTAMPTZ</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Relationships -->
|
||||
<g stroke="#6B7280" stroke-width="2" fill="none">
|
||||
<!-- organizations to bots -->
|
||||
<line x1="450" y1="135" x2="550" y2="135" marker-end="url(#arrow)">
|
||||
<text x="500" y="130" 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="750" y1="250" x2="190" y2="290" marker-end="url(#arrow)">
|
||||
<text x="470" y="270" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
|
||||
|
||||
<!-- bots to user_sessions -->
|
||||
<line x1="750" y1="250" x2="500" y2="290" marker-end="url(#arrow)">
|
||||
|
||||
<!-- bots to kb_collections -->
|
||||
<line x1="750" y1="250" x2="810" y2="290" marker-end="url(#arrow)">
|
||||
<text x="780" y="270" 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="810" y1="440" x2="810" y2="480" marker-end="url(#arrow)">
|
||||
<text x="825" y="460" 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="460" x2="500" y2="480" marker-end="url(#arrow)">
|
||||
<text x="515" y="470" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
|
||||
|
||||
<!-- users to user_sessions (dotted) -->
|
||||
<path d="M 330 565 L 360 390" stroke-dasharray="5,5" marker-end="url(#arrow)" opacity="0.6">
|
||||
<text x="345" y="475" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1:N</text>
|
||||
</g>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(50, 670)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Color Coding:</text>
|
||||
|
||||
<rect x="100" y="-10" width="20" height="10" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="125" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Organization</text>
|
||||
|
||||
<rect x="220" y="-10" width="20" height="10" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="245" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Bot Core</text>
|
||||
|
||||
<rect x="320" y="-10" width="20" height="10" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="345" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Sessions</text>
|
||||
|
||||
<rect x="420" y="-10" width="20" height="10" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="445" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Knowledge</text>
|
||||
|
||||
<rect x="530" y="-10" width="20" height="10" fill="none" stroke="#DC2626" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="555" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Users</text>
|
||||
|
||||
<rect x="620" y="-10" width="20" height="10" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="645" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Messages</text>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -1,139 +1,131 @@
|
|||
<svg width="900" height="600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="400" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Database Schema Overview</text>
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">Database Schema Overview</text>
|
||||
|
||||
<!-- Top Level -->
|
||||
<!-- Organizations -->
|
||||
<rect x="50" y="60" width="180" height="60" fill="none" stroke="#4299E1" stroke-width="2" rx="5"/>
|
||||
<text x="140" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#63B3ED">organizations</text>
|
||||
<text x="140" y="105" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#90CDF4">Top Level Entity</text>
|
||||
<rect x="20" y="60" width="120" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="80" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">organizations</text>
|
||||
|
||||
<!-- Bots -->
|
||||
<rect x="320" y="60" width="180" height="60" fill="none" stroke="#48BB78" stroke-width="2" rx="5"/>
|
||||
<text x="410" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">bots</text>
|
||||
<text x="410" y="105" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#9AE6B4">Bot Instances</text>
|
||||
<rect x="200" y="60" width="100" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="250" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">bots</text>
|
||||
|
||||
<!-- Bot Configuration -->
|
||||
<rect x="590" y="60" width="180" height="60" fill="none" stroke="#F6AD55" stroke-width="2" rx="5"/>
|
||||
<text x="680" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">bot_configuration</text>
|
||||
<text x="680" y="105" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FED7AA">Settings</text>
|
||||
|
||||
<!-- Bot Memories -->
|
||||
<rect x="220" y="180" width="180" height="60" fill="none" stroke="#B794F4" stroke-width="2" rx="5"/>
|
||||
<text x="310" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">bot_memories</text>
|
||||
<text x="310" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">State Storage</text>
|
||||
|
||||
<!-- KB Collections -->
|
||||
<rect x="420" y="180" width="180" height="60" fill="none" stroke="#4FD1C5" stroke-width="2" rx="5"/>
|
||||
<text x="510" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">kb_collections</text>
|
||||
<text x="510" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#B2F5EA">Knowledge Base</text>
|
||||
|
||||
<!-- KB Documents -->
|
||||
<rect x="420" y="280" width="180" height="60" fill="none" stroke="#4FD1C5" stroke-width="2" rx="5"/>
|
||||
<text x="510" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">kb_documents</text>
|
||||
<text x="510" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#B2F5EA">Documents</text>
|
||||
<rect x="360" y="60" width="120" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="420" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">bot_configuration</text>
|
||||
|
||||
<!-- Users -->
|
||||
<rect x="50" y="380" width="180" height="60" fill="none" stroke="#FC8181" stroke-width="2" rx="5"/>
|
||||
<text x="140" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">users</text>
|
||||
<text x="140" y="425" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FEB2B2">User Accounts</text>
|
||||
<rect x="540" y="60" width="100" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="590" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">users</text>
|
||||
|
||||
<!-- Middle Layer -->
|
||||
<!-- Bot Memories -->
|
||||
<rect x="20" y="140" width="120" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="80" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">bot_memories</text>
|
||||
|
||||
<!-- KB Collections -->
|
||||
<rect x="180" y="140" width="120" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="240" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">kb_collections</text>
|
||||
|
||||
<!-- User Sessions -->
|
||||
<rect x="320" y="380" width="180" height="60" fill="none" stroke="#FBBF24" stroke-width="2" rx="5"/>
|
||||
<text x="410" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FCD34D">user_sessions</text>
|
||||
<text x="410" y="425" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FDE68A">Active Sessions</text>
|
||||
|
||||
<!-- Message History -->
|
||||
<rect x="590" y="380" width="180" height="60" fill="none" stroke="#A78BFA" stroke-width="2" rx="5"/>
|
||||
<text x="680" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#C4B5FD">message_history</text>
|
||||
<text x="680" y="425" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#DDD6FE">Chat Messages</text>
|
||||
|
||||
<!-- User Login Tokens -->
|
||||
<rect x="50" y="480" width="180" height="60" fill="none" stroke="#F87171" stroke-width="2" rx="5"/>
|
||||
<text x="140" y="505" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#F87171">user_login_tokens</text>
|
||||
<text x="140" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FCA5A5">Auth Tokens</text>
|
||||
|
||||
<!-- User KB Associations -->
|
||||
<rect x="320" y="480" width="180" height="60" fill="none" stroke="#34D399" stroke-width="2" rx="5"/>
|
||||
<text x="410" y="505" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#6EE7B7">user_kb_associations</text>
|
||||
<text x="410" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A7F3D0">KB Access</text>
|
||||
|
||||
<!-- Session Tool Associations -->
|
||||
<rect x="590" y="480" width="180" height="60" fill="none" stroke="#60A5FA" stroke-width="2" rx="5"/>
|
||||
<text x="680" y="505" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#93C5FD">session_tool_associations</text>
|
||||
<text x="680" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#BFDBFE">Tool Access</text>
|
||||
<rect x="340" y="140" width="120" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="400" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_sessions</text>
|
||||
|
||||
<!-- Basic Tools -->
|
||||
<rect x="650" y="280" width="180" height="60" fill="none" stroke="#F59E0B" stroke-width="2" rx="5"/>
|
||||
<text x="740" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBBF24">basic_tools</text>
|
||||
<text x="740" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FCD34D">BASIC Scripts</text>
|
||||
<rect x="500" y="140" width="100" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="550" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">basic_tools</text>
|
||||
|
||||
<!-- Relationships -->
|
||||
<g stroke="#888" stroke-width="2" fill="none">
|
||||
<!-- Message History -->
|
||||
<rect x="640" y="140" width="120" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="700" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">message_history</text>
|
||||
|
||||
<!-- Bottom Layer -->
|
||||
<!-- KB Documents -->
|
||||
<rect x="20" y="220" width="120" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="80" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">kb_documents</text>
|
||||
|
||||
<!-- User Login Tokens -->
|
||||
<rect x="180" y="220" width="140" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="250" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_login_tokens</text>
|
||||
|
||||
<!-- User KB Associations -->
|
||||
<rect x="360" y="220" width="160" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="440" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_kb_associations</text>
|
||||
|
||||
<!-- Session Tool Associations -->
|
||||
<rect x="560" y="220" width="180" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="650" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">session_tool_associations</text>
|
||||
|
||||
<!-- Arrows -->
|
||||
<g stroke="#666" 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="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<line x1="140" y1="80" x2="200" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- bots to bot_configuration -->
|
||||
<line x1="500" y1="90" x2="590" y2="90" marker-end="url(#arrow)"/>
|
||||
<text x="545" y="85" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<line x1="300" y1="80" x2="360" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- bots to bot_memories -->
|
||||
<line x1="360" y1="120" x2="310" y2="180" marker-end="url(#arrow)"/>
|
||||
<text x="330" y="150" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M250,100 Q250,120 80,120 Q80,130 80,140" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- bots to kb_collections -->
|
||||
<line x1="460" y1="120" x2="510" y2="180" marker-end="url(#arrow)"/>
|
||||
<text x="485" y="150" font-family="Arial, sans-serif" font-size="10" fill="#718096">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="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M250,100 Q250,120 240,120 Q240,130 240,140" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- users to user_sessions -->
|
||||
<line x1="230" y1="410" x2="320" y2="410" marker-end="url(#arrow)"/>
|
||||
<text x="275" y="405" font-family="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M590,100 Q590,120 400,120 Q400,130 400,140" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- 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="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M460,160 Q530,160 640,160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- kb_collections to kb_documents -->
|
||||
<path d="M240,180 Q240,200 80,200 Q80,210 80,220" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- 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="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M590,100 Q590,200 250,200 Q250,210 250,220" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.4"/>
|
||||
|
||||
<!-- 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="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M400,180 Q400,200 440,200 Q440,210 440,220" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- 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="Arial, sans-serif" font-size="10" fill="#718096">1:N</text>
|
||||
<path d="M460,160 Q550,190 650,220" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- 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="Arial, sans-serif" font-size="10" fill="#718096">ref</text>
|
||||
<!-- session_tool_associations refs basic_tools -->
|
||||
<path d="M650,220 Q650,200 550,200 Q550,190 550,180" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.4"/>
|
||||
|
||||
<!-- 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="Arial, sans-serif" font-size="10" fill="#718096">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"/>
|
||||
<!-- user_kb_associations refs kb_collections -->
|
||||
<path d="M440,220 Q440,200 240,200 Q240,190 240,180" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.4"/>
|
||||
</g>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(50, 550)">
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Legend:</text>
|
||||
<line x1="80" y1="-5" x2="120" y2="-5" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="125" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">1:N Relationship</text>
|
||||
<!-- Relationship Labels -->
|
||||
<text x="170" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="330" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="165" y="135" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="245" y="135" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="495" y="135" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="550" y="155" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="160" y="210" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="420" y="210" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="550" y="210" font-family="Arial, sans-serif" font-size="11" fill="#666">1:N</text>
|
||||
<text x="340" y="210" font-family="Arial, sans-serif" font-size="11" fill="#666">ref</text>
|
||||
<text x="600" y="210" font-family="Arial, sans-serif" font-size="11" fill="#666">ref</text>
|
||||
|
||||
<line x1="250" y1="-5" x2="290" y2="-5" stroke="#888" stroke-width="2" stroke-dasharray="5,5" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
<text x="295" y="0" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Reference</text>
|
||||
<!-- Info Box -->
|
||||
<g transform="translate(20, 290)">
|
||||
<rect width="760" height="80" fill="none" stroke="#666" stroke-width="1" rx="5" opacity="0.3"/>
|
||||
<text x="10" y="20" font-family="Arial, sans-serif" font-size="12" font-weight="600" fill="#333">Entity Categories:</text>
|
||||
<text x="10" y="40" font-family="Arial, sans-serif" font-size="12" fill="#666">Core: organizations, bots, users • State: bot_memories, user_sessions, message_history</text>
|
||||
<text x="10" y="55" font-family="Arial, sans-serif" font-size="12" fill="#666">Knowledge: kb_collections, kb_documents • Tools: basic_tools • Auth: user_login_tokens</text>
|
||||
<text x="10" y="70" font-family="Arial, sans-serif" font-size="12" fill="#666">Associations: user_kb_associations, session_tool_associations, bot_configuration</text>
|
||||
</g>
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="390" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
Multi-tenant database schema supporting organizations with multiple bots, user sessions, knowledge bases, and tools
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 9 KiB After Width: | Height: | Size: 7.5 KiB |
170
docs/src/appendix-i/assets/schema-overview.svg.backup
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
<?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>
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
|
@ -1,95 +1,126 @@
|
|||
<svg width="700" height="500" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="320" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="350" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Session Flow Diagram</text>
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">Session Flow Diagram</text>
|
||||
|
||||
<!-- User Login -->
|
||||
<rect x="50" y="70" width="180" height="80" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="140" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">User Login</text>
|
||||
<text x="140" y="120" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Authentication</text>
|
||||
<text x="140" y="135" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Entry Point</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="230" y1="110" x2="280" y2="110" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="255" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#718096">Creates</text>
|
||||
<rect x="20" y="60" width="100" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="70" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">User Login</text>
|
||||
|
||||
<!-- users table -->
|
||||
<rect x="280" y="70" width="180" height="130" fill="none" stroke="#FC8181" stroke-width="2" rx="8"/>
|
||||
<rect x="280" y="70" width="180" height="30" fill="none" stroke="#FC8181" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="370" y="90" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">users</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<text x="290" y="120">• id</text>
|
||||
<text x="290" y="135">• email</text>
|
||||
<text x="290" y="150">• zitadel_id</text>
|
||||
<text x="290" y="165">• created_at</text>
|
||||
<text x="290" y="180">• updated_at</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="370" y1="200" x2="370" y2="240" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="385" y="220" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#718096">Creates</text>
|
||||
<rect x="180" y="60" width="100" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="230" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">users</text>
|
||||
|
||||
<!-- user_sessions table -->
|
||||
<rect x="280" y="240" width="180" height="150" fill="none" stroke="#FBBF24" stroke-width="2" rx="8"/>
|
||||
<rect x="280" y="240" width="180" height="30" fill="none" stroke="#FBBF24" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="370" y="260" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FCD34D">user_sessions</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<text x="290" y="290">• id</text>
|
||||
<text x="290" y="305">• user_id</text>
|
||||
<text x="290" y="320">• bot_id</text>
|
||||
<text x="290" y="335">• token</text>
|
||||
<text x="290" y="350">• created_at</text>
|
||||
<text x="290" y="365">• expires_at</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to message_history -->
|
||||
<line x1="460" y1="315" x2="510" y2="315" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="485" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#718096">Generates</text>
|
||||
<text x="485" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#718096">Messages</text>
|
||||
<rect x="340" y="60" width="120" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="400" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_sessions</text>
|
||||
|
||||
<!-- message_history table -->
|
||||
<rect x="510" y="240" width="180" height="150" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<rect x="510" y="240" width="180" height="30" fill="none" stroke="#B794F4" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="600" y="260" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">message_history</text>
|
||||
<rect x="520" y="60" width="120" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="580" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">message_history</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<text x="520" y="290">• id</text>
|
||||
<text x="520" y="305">• session_id</text>
|
||||
<text x="520" y="320">• role</text>
|
||||
<text x="520" y="335">• content</text>
|
||||
<text x="520" y="350">• timestamp</text>
|
||||
<text x="520" y="365">• metadata</text>
|
||||
<!-- Session Token -->
|
||||
<rect x="700" y="60" width="80" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="740" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Token</text>
|
||||
|
||||
<!-- Additional Tables -->
|
||||
<rect x="180" y="160" width="140" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="250" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_login_tokens</text>
|
||||
|
||||
<rect x="360" y="160" width="160" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="440" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">user_kb_associations</text>
|
||||
|
||||
<rect x="560" y="160" width="180" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="650" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">session_tool_associations</text>
|
||||
|
||||
<!-- Field Details -->
|
||||
<g font-family="Arial, sans-serif" font-size="11" fill="#666">
|
||||
<!-- users fields -->
|
||||
<text x="190" y="115">id, email</text>
|
||||
<text x="190" y="130">zitadel_id</text>
|
||||
|
||||
<!-- user_sessions fields -->
|
||||
<text x="350" y="115">id, user_id, bot_id</text>
|
||||
<text x="350" y="130">token, expires_at</text>
|
||||
|
||||
<!-- message_history fields -->
|
||||
<text x="530" y="115">id, session_id</text>
|
||||
<text x="530" y="130">role, content</text>
|
||||
|
||||
<!-- Token info -->
|
||||
<text x="710" y="115">JWT/UUID</text>
|
||||
<text x="710" y="130">Auth</text>
|
||||
|
||||
<!-- user_login_tokens fields -->
|
||||
<text x="190" y="215">id, user_id, token</text>
|
||||
<text x="190" y="230">expires_at</text>
|
||||
|
||||
<!-- user_kb_associations fields -->
|
||||
<text x="370" y="215">id, session_id</text>
|
||||
<text x="370" y="230">kb_id, created_at</text>
|
||||
|
||||
<!-- session_tool_associations fields -->
|
||||
<text x="570" y="215">id, session_id</text>
|
||||
<text x="570" y="230">tool_name, added_at</text>
|
||||
</g>
|
||||
|
||||
<!-- Flow indicators -->
|
||||
<g id="flow-numbers" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#4A5568">
|
||||
<circle cx="140" cy="70" r="15" fill="none" stroke="#4A5568" stroke-width="1"/>
|
||||
<text x="140" y="75" text-anchor="middle">1</text>
|
||||
<!-- Flow Arrows -->
|
||||
<g stroke="#666" stroke-width="2" fill="none">
|
||||
<!-- Main flow -->
|
||||
<line x1="120" y1="80" x2="180" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="280" y1="80" x2="340" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="460" y1="80" x2="520" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="640" y1="80" x2="700" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<circle cx="370" cy="70" r="15" fill="none" stroke="#4A5568" stroke-width="1"/>
|
||||
<text x="370" y="75" text-anchor="middle">2</text>
|
||||
<!-- users to user_login_tokens -->
|
||||
<path d="M230,100 Q230,130 250,130 Q250,150 250,160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<circle cx="370" cy="240" r="15" fill="none" stroke="#4A5568" stroke-width="1"/>
|
||||
<text x="370" y="245" text-anchor="middle">3</text>
|
||||
|
||||
<circle cx="600" cy="240" r="15" fill="none" stroke="#4A5568" stroke-width="1"/>
|
||||
<text x="600" y="245" text-anchor="middle">4</text>
|
||||
<!-- user_sessions to associations -->
|
||||
<path d="M400,100 Q400,130 440,130 Q440,150 440,160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
<path d="M460,80 Q550,130 650,160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
</g>
|
||||
|
||||
<!-- Process description -->
|
||||
<g id="process-description" transform="translate(50, 420)">
|
||||
<rect x="0" y="0" width="600" height="60" fill="none" stroke="#4A5568" stroke-width="1" rx="5" stroke-dasharray="2,2" opacity="0.5"/>
|
||||
<text x="300" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Process Flow</text>
|
||||
<!-- Labels -->
|
||||
<text x="150" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">Creates</text>
|
||||
<text x="310" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">Establishes</text>
|
||||
<text x="490" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">Logs</text>
|
||||
<text x="670" y="75" font-family="Arial, sans-serif" font-size="11" fill="#666">Returns</text>
|
||||
<text x="240" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">Stores</text>
|
||||
<text x="420" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">Links KB</text>
|
||||
<text x="550" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">Links Tools</text>
|
||||
|
||||
<g font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">
|
||||
<text x="20" y="45">1. User authenticates → 2. User record created/updated → 3. Session established → 4. Messages logged</text>
|
||||
</g>
|
||||
<!-- Process Steps -->
|
||||
<g font-family="Arial, sans-serif" font-size="12" fill="#333">
|
||||
<circle cx="70" cy="60" r="12" fill="none" stroke="#666" stroke-width="1"/>
|
||||
<text x="70" y="65" text-anchor="middle">1</text>
|
||||
|
||||
<circle cx="230" cy="60" r="12" fill="none" stroke="#666" stroke-width="1"/>
|
||||
<text x="230" y="65" text-anchor="middle">2</text>
|
||||
|
||||
<circle cx="400" cy="60" r="12" fill="none" stroke="#666" stroke-width="1"/>
|
||||
<text x="400" y="65" text-anchor="middle">3</text>
|
||||
|
||||
<circle cx="580" cy="60" r="12" fill="none" stroke="#666" stroke-width="1"/>
|
||||
<text x="580" y="65" text-anchor="middle">4</text>
|
||||
|
||||
<circle cx="740" cy="60" r="12" fill="none" stroke="#666" stroke-width="1"/>
|
||||
<text x="740" y="65" text-anchor="middle">5</text>
|
||||
</g>
|
||||
|
||||
<!-- Process Description Box -->
|
||||
<g transform="translate(20, 250)">
|
||||
<rect width="760" height="50" fill="none" stroke="#666" stroke-width="1" rx="5" opacity="0.3"/>
|
||||
<text x="10" y="20" font-family="Arial, sans-serif" font-size="12" font-weight="600" fill="#333">Process Flow:</text>
|
||||
<text x="10" y="40" font-family="Arial, sans-serif" font-size="12" fill="#666">1. User authenticates → 2. User record created/updated → 3. Session established → 4. Messages logged → 5. Token returned</text>
|
||||
</g>
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
Authentication flow from login through session establishment and message tracking
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 6.3 KiB |
126
docs/src/appendix-i/assets/session-flow.svg.backup
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 780 580" 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="780" height="580" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<text x="350" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Session Flow Diagram</text>
|
||||
|
||||
<!-- User Login -->
|
||||
<rect x="50" y="70" width="180" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="140" y="100" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">User Login</text>
|
||||
<text x="140" y="120" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Authentication</text>
|
||||
<text x="140" y="135" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Entry Point</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="230" y1="110" x2="280" y2="110" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<text x="255" y="100" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Creates</text>
|
||||
|
||||
<!-- users table -->
|
||||
<rect x="280" y="70" width="180" height="130" fill="none" stroke="#DC2626" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<rect x="280" y="70" width="180" height="30" fill="none" stroke="#DC2626" stroke-width="2" rx="8 8 0 0" filter="url(#shadow)"/>
|
||||
<text x="370" y="90" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">users</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="290" y="120" filter="url(#textShadow)">• id</text>
|
||||
<text x="290" y="135" filter="url(#textShadow)">• email</text>
|
||||
<text x="290" y="150" filter="url(#textShadow)">• zitadel_id</text>
|
||||
<text x="290" y="165" filter="url(#textShadow)">• created_at</text>
|
||||
<text x="290" y="180" filter="url(#textShadow)">• updated_at</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="370" y1="200" x2="370" y2="240" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<text x="385" y="220" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Creates</text>
|
||||
|
||||
<!-- user_sessions table -->
|
||||
<rect x="280" y="240" width="180" height="150" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<rect x="280" y="240" width="180" height="30" fill="none" stroke="#2563EB" stroke-width="2" rx="8 8 0 0" filter="url(#shadow)"/>
|
||||
<text x="370" y="260" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="290" y="290" filter="url(#textShadow)">• id</text>
|
||||
<text x="290" y="305" filter="url(#textShadow)">• user_id</text>
|
||||
<text x="290" y="320" filter="url(#textShadow)">• bot_id</text>
|
||||
<text x="290" y="335" filter="url(#textShadow)">• token</text>
|
||||
<text x="290" y="350" filter="url(#textShadow)">• created_at</text>
|
||||
<text x="290" y="365" filter="url(#textShadow)">• expires_at</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to message_history -->
|
||||
<line x1="460" y1="315" x2="510" y2="315" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<text x="485" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Generates</text>
|
||||
<text x="485" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Messages</text>
|
||||
|
||||
<!-- message_history table -->
|
||||
<rect x="510" y="240" width="180" height="150" fill="none" stroke="#7C3AED" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<rect x="510" y="240" width="180" height="30" fill="none" stroke="#7C3AED" stroke-width="2" rx="8 8 0 0" filter="url(#shadow)"/>
|
||||
<text x="600" y="260" 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>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="520" y="290" filter="url(#textShadow)">• id</text>
|
||||
<text x="520" y="305" filter="url(#textShadow)">• session_id</text>
|
||||
<text x="520" y="320" filter="url(#textShadow)">• role</text>
|
||||
<text x="520" y="335" filter="url(#textShadow)">• content</text>
|
||||
<text x="520" y="350" filter="url(#textShadow)">• timestamp</text>
|
||||
<text x="520" y="365" filter="url(#textShadow)">• metadata</text>
|
||||
</g>
|
||||
|
||||
<!-- Flow indicators -->
|
||||
<g id="flow-numbers" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563">
|
||||
<circle cx="140" cy="70" r="15" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="140" y="75" text-anchor="middle" filter="url(#textShadow)">1</text>
|
||||
|
||||
<circle cx="370" cy="70" r="15" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="370" y="75" text-anchor="middle" filter="url(#textShadow)">2</text>
|
||||
|
||||
<circle cx="370" cy="240" r="15" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="370" y="245" text-anchor="middle" filter="url(#textShadow)">3</text>
|
||||
|
||||
<circle cx="600" cy="240" r="15" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="600" y="245" text-anchor="middle" filter="url(#textShadow)">4</text>
|
||||
</g>
|
||||
|
||||
<!-- Process description -->
|
||||
<g id="process-description" transform="translate(50, 420)">
|
||||
<rect x="0" y="0" width="600" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" stroke-dasharray="2,2" opacity="0.5" filter="url(#shadow)"/>
|
||||
<text x="300" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Process Flow</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="20" y="45" filter="url(#textShadow)">1. User authenticates → 2. User record created/updated → 3. Session established → 4. Messages logged</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.3 KiB |
|
|
@ -1,79 +1,96 @@
|
|||
<svg width="900" height="600" xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- Main Container -->
|
||||
<rect x="50" y="30" width="800" height="540" fill="none" stroke="#4A5568" stroke-width="3" rx="10"/>
|
||||
<svg width="800" height="400" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title Bar -->
|
||||
<rect x="50" y="30" width="800" height="50" fill="none" stroke="#4A5568" stroke-width="2" rx="10 10 0 0"/>
|
||||
<text x="450" y="60" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#E2E8F0">BotServer (Single Binary)</text>
|
||||
<!-- Title -->
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">General Bots Architecture</text>
|
||||
|
||||
<!-- Top Layer Components -->
|
||||
<g id="top-components">
|
||||
<!-- Web Server -->
|
||||
<rect x="100" y="120" width="200" height="80" fill="none" stroke="#4299E1" stroke-width="2" rx="8"/>
|
||||
<text x="200" y="150" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#63B3ED">Web Server</text>
|
||||
<text x="200" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#90CDF4">(Axum)</text>
|
||||
<!-- Web Server -->
|
||||
<rect x="20" y="60" width="100" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="70" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Web Server</text>
|
||||
|
||||
<!-- BASIC Interpreter -->
|
||||
<rect x="350" y="120" width="200" height="80" fill="none" stroke="#F56565" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="150" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#FC8181">BASIC</text>
|
||||
<text x="450" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#FEB2B2">Interpreter</text>
|
||||
<text x="450" y="190" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FBB6CE">(Rhai)</text>
|
||||
<!-- BASIC Interpreter -->
|
||||
<rect x="160" y="60" width="120" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="220" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">BASIC Interpreter</text>
|
||||
|
||||
<!-- LLM Integration -->
|
||||
<rect x="600" y="120" width="200" height="80" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<text x="700" y="150" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#D6BCFA">LLM</text>
|
||||
<text x="700" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#E9D8FD">Integration</text>
|
||||
</g>
|
||||
<!-- LLM Integration -->
|
||||
<rect x="320" y="60" width="100" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="370" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">LLM Integration</text>
|
||||
|
||||
<!-- Connection Lines from Top to Middle -->
|
||||
<g stroke="#718096" stroke-width="2" fill="none">
|
||||
<line x1="200" y1="200" x2="200" y2="240" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="450" y1="200" x2="450" y2="240" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="700" y1="200" x2="700" y2="240" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
</g>
|
||||
<!-- Package Manager -->
|
||||
<rect x="460" y="60" width="120" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="520" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Package Manager</text>
|
||||
|
||||
<!-- Session Manager -->
|
||||
<rect x="100" y="240" width="700" height="60" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="275" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#68D391">Session Manager (Tokio)</text>
|
||||
<!-- Console UI -->
|
||||
<rect x="620" y="60" width="100" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="670" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Console UI</text>
|
||||
|
||||
<!-- Connection Lines from Middle to Data Layer -->
|
||||
<g stroke="#718096" stroke-width="2" fill="none">
|
||||
<line x1="250" y1="300" x2="250" y2="340" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="450" y1="300" x2="450" y2="340" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="650" y1="300" x2="650" y2="340" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
</g>
|
||||
<!-- Session Manager (Middle Layer) -->
|
||||
<rect x="250" y="160" width="300" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="400" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Session Manager (Tokio Async Runtime)</text>
|
||||
|
||||
<!-- Data Layer Components -->
|
||||
<g id="data-components">
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="100" y="340" width="200" height="80" fill="none" stroke="#4A90E2" stroke-width="2" rx="8"/>
|
||||
<text x="200" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#5BA0F2">PostgreSQL</text>
|
||||
<text x="200" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#7BB4F6">Database</text>
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="20" y="260" width="100" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="70" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">PostgreSQL</text>
|
||||
|
||||
<!-- Valkey Cache -->
|
||||
<rect x="350" y="340" width="200" height="80" fill="none" stroke="#E53E3E" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#FC6B6B">Valkey</text>
|
||||
<text x="450" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#FD8E8E">Cache</text>
|
||||
<!-- Valkey Cache -->
|
||||
<rect x="160" y="260" width="100" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="210" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Valkey Cache</text>
|
||||
|
||||
<!-- Qdrant Vectors -->
|
||||
<rect x="600" y="340" width="200" height="80" fill="none" stroke="#38D4B2" stroke-width="2" rx="8"/>
|
||||
<text x="700" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#4EECC8">Qdrant</text>
|
||||
<text x="700" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#6FF4D2">Vectors</text>
|
||||
</g>
|
||||
<!-- Qdrant Vectors -->
|
||||
<rect x="300" y="260" width="100" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="350" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Qdrant Vectors</text>
|
||||
|
||||
<!-- Object Storage -->
|
||||
<rect x="100" y="450" width="700" height="100" fill="none" stroke="#38A169" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="480" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#48BB78">Object Storage (SeaweedFS/S3)</text>
|
||||
<rect x="440" y="260" width="100" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="490" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Object Storage</text>
|
||||
|
||||
<!-- Storage Items -->
|
||||
<g id="storage-items">
|
||||
<rect x="150" y="500" width="150" height="35" fill="none" stroke="#68D391" stroke-width="1" rx="5"/>
|
||||
<text x="225" y="522" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#9AE6B4">Documents</text>
|
||||
<!-- Channels -->
|
||||
<rect x="580" y="260" width="100" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="630" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Channels</text>
|
||||
|
||||
<rect x="375" y="500" width="150" height="35" fill="none" stroke="#68D391" stroke-width="1" rx="5"/>
|
||||
<text x="450" y="522" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#9AE6B4">Templates</text>
|
||||
<!-- External Services -->
|
||||
<rect x="700" y="260" width="80" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="740" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">External API</text>
|
||||
|
||||
<rect x="600" y="500" width="150" height="35" fill="none" stroke="#68D391" stroke-width="1" rx="5"/>
|
||||
<text x="675" y="522" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#9AE6B4">Assets</text>
|
||||
<!-- Arrows -->
|
||||
<g stroke="#666" stroke-width="2" fill="none">
|
||||
<!-- Top layer to Session Manager -->
|
||||
<line x1="70" y1="100" x2="250" y2="160" opacity="0.6"/>
|
||||
<line x1="220" y1="100" x2="300" y2="160" opacity="0.6"/>
|
||||
<line x1="370" y1="100" x2="400" y2="160" opacity="0.6"/>
|
||||
<line x1="520" y1="100" x2="500" y2="160" opacity="0.6"/>
|
||||
<line x1="670" y1="100" x2="550" y2="160" opacity="0.6"/>
|
||||
|
||||
<!-- Session Manager to Data Layer -->
|
||||
<line x1="260" y1="200" x2="70" y2="260" opacity="0.6"/>
|
||||
<line x1="320" y1="200" x2="210" y2="260" opacity="0.6"/>
|
||||
<line x1="400" y1="200" x2="350" y2="260" opacity="0.6"/>
|
||||
<line x1="480" y1="200" x2="490" y2="260" opacity="0.6"/>
|
||||
<line x1="540" y1="200" x2="630" y2="260" opacity="0.6"/>
|
||||
|
||||
<!-- External API connections (dashed) -->
|
||||
<path d="M740,260 Q740,220 550,180" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.4"/>
|
||||
</g>
|
||||
|
||||
<!-- Storage Detail Box -->
|
||||
<g transform="translate(20, 330)">
|
||||
<rect width="760" height="50" fill="none" stroke="#666" stroke-width="1" rx="5" opacity="0.3"/>
|
||||
<text x="10" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">Storage Contents:</text>
|
||||
<text x="130" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">.gbkb (Documents)</text>
|
||||
<text x="280" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">.gbdialog (Scripts)</text>
|
||||
<text x="430" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">.gbot (Configs)</text>
|
||||
<text x="560" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">Templates</text>
|
||||
<text x="660" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">User Assets</text>
|
||||
</g>
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
Single binary with everything included - no external dependencies
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.4 KiB |
79
docs/src/assets/architecture.svg.backup
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<svg width="900" height="600" xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- Main Container -->
|
||||
<rect x="50" y="30" width="800" height="540" fill="none" stroke="#4A5568" stroke-width="3" rx="10"/>
|
||||
|
||||
<!-- Title Bar -->
|
||||
<rect x="50" y="30" width="800" height="50" fill="none" stroke="#4A5568" stroke-width="2" rx="10 10 0 0"/>
|
||||
<text x="450" y="60" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#E2E8F0">BotServer (Single Binary)</text>
|
||||
|
||||
<!-- Top Layer Components -->
|
||||
<g id="top-components">
|
||||
<!-- Web Server -->
|
||||
<rect x="100" y="120" width="200" height="80" fill="none" stroke="#4299E1" stroke-width="2" rx="8"/>
|
||||
<text x="200" y="150" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#63B3ED">Web Server</text>
|
||||
<text x="200" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#90CDF4">(Axum)</text>
|
||||
|
||||
<!-- BASIC Interpreter -->
|
||||
<rect x="350" y="120" width="200" height="80" fill="none" stroke="#F56565" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="150" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#FC8181">BASIC</text>
|
||||
<text x="450" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#FEB2B2">Interpreter</text>
|
||||
<text x="450" y="190" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FBB6CE">(Rhai)</text>
|
||||
|
||||
<!-- LLM Integration -->
|
||||
<rect x="600" y="120" width="200" height="80" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<text x="700" y="150" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#D6BCFA">LLM</text>
|
||||
<text x="700" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#E9D8FD">Integration</text>
|
||||
</g>
|
||||
|
||||
<!-- Connection Lines from Top to Middle -->
|
||||
<g stroke="#718096" stroke-width="2" fill="none">
|
||||
<line x1="200" y1="200" x2="200" y2="240" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="450" y1="200" x2="450" y2="240" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="700" y1="200" x2="700" y2="240" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
</g>
|
||||
|
||||
<!-- Session Manager -->
|
||||
<rect x="100" y="240" width="700" height="60" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="275" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#68D391">Session Manager (Tokio)</text>
|
||||
|
||||
<!-- Connection Lines from Middle to Data Layer -->
|
||||
<g stroke="#718096" stroke-width="2" fill="none">
|
||||
<line x1="250" y1="300" x2="250" y2="340" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="450" y1="300" x2="450" y2="340" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<line x1="650" y1="300" x2="650" y2="340" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
</g>
|
||||
|
||||
<!-- Data Layer Components -->
|
||||
<g id="data-components">
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="100" y="340" width="200" height="80" fill="none" stroke="#4A90E2" stroke-width="2" rx="8"/>
|
||||
<text x="200" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#5BA0F2">PostgreSQL</text>
|
||||
<text x="200" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#7BB4F6">Database</text>
|
||||
|
||||
<!-- Valkey Cache -->
|
||||
<rect x="350" y="340" width="200" height="80" fill="none" stroke="#E53E3E" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#FC6B6B">Valkey</text>
|
||||
<text x="450" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#FD8E8E">Cache</text>
|
||||
|
||||
<!-- Qdrant Vectors -->
|
||||
<rect x="600" y="340" width="200" height="80" fill="none" stroke="#38D4B2" stroke-width="2" rx="8"/>
|
||||
<text x="700" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#4EECC8">Qdrant</text>
|
||||
<text x="700" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#6FF4D2">Vectors</text>
|
||||
</g>
|
||||
|
||||
<!-- Object Storage -->
|
||||
<rect x="100" y="450" width="700" height="100" fill="none" stroke="#38A169" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="480" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#48BB78">Object Storage (SeaweedFS/S3)</text>
|
||||
|
||||
<!-- Storage Items -->
|
||||
<g id="storage-items">
|
||||
<rect x="150" y="500" width="150" height="35" fill="none" stroke="#68D391" stroke-width="1" rx="5"/>
|
||||
<text x="225" y="522" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#9AE6B4">Documents</text>
|
||||
|
||||
<rect x="375" y="500" width="150" height="35" fill="none" stroke="#68D391" stroke-width="1" rx="5"/>
|
||||
<text x="450" y="522" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#9AE6B4">Templates</text>
|
||||
|
||||
<rect x="600" y="500" width="150" height="35" fill="none" stroke="#68D391" stroke-width="1" rx="5"/>
|
||||
<text x="675" y="522" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#9AE6B4">Assets</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
|
|
@ -1,59 +1,73 @@
|
|||
<svg width="800" height="200" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="320" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Boxes -->
|
||||
<g id="boxes">
|
||||
<!-- Title -->
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">The Flow</text>
|
||||
|
||||
<!-- Main Flow Components -->
|
||||
<g id="mainFlow">
|
||||
<!-- User Input -->
|
||||
<rect x="20" y="30" width="100" height="40" fill="none" stroke="#4A9EFF" stroke-width="2" rx="5"/>
|
||||
<text x="70" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#4A9EFF">User Input</text>
|
||||
<rect x="20" y="60" width="100" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="70" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">User Input</text>
|
||||
|
||||
<!-- BASIC Script -->
|
||||
<rect x="180" y="30" width="100" height="40" fill="none" stroke="#FF9F40" stroke-width="2" rx="5"/>
|
||||
<text x="230" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#FF9F40">BASIC Script</text>
|
||||
<rect x="160" y="60" width="100" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="210" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">BASIC Script</text>
|
||||
|
||||
<!-- LLM Decision -->
|
||||
<rect x="340" y="30" width="100" height="40" fill="none" stroke="#BA68C8" stroke-width="2" rx="5"/>
|
||||
<text x="390" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#BA68C8">LLM Decision</text>
|
||||
<rect x="300" y="60" width="100" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="350" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">LLM Decision</text>
|
||||
|
||||
<!-- Tool Execution -->
|
||||
<rect x="500" y="30" width="120" height="40" fill="none" stroke="#66BB6A" stroke-width="2" rx="5"/>
|
||||
<text x="560" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#66BB6A">Tool Execution</text>
|
||||
|
||||
<!-- Save to CSV -->
|
||||
<rect x="500" y="100" width="120" height="40" fill="none" stroke="#EC407A" stroke-width="2" rx="5"/>
|
||||
<text x="560" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#EC407A">Save to CSV</text>
|
||||
|
||||
<!-- Search Knowledge -->
|
||||
<rect x="320" y="100" width="140" height="40" fill="none" stroke="#26A69A" stroke-width="2" rx="5"/>
|
||||
<text x="390" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#26A69A">Search Knowledge</text>
|
||||
<!-- Bot Executor -->
|
||||
<rect x="440" y="60" width="100" height="40" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="490" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Bot Executor</text>
|
||||
|
||||
<!-- Bot Response -->
|
||||
<rect x="160" y="160" width="120" height="40" fill="none" stroke="#5C6BC0" stroke-width="2" rx="5"/>
|
||||
<text x="220" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#5C6BC0">Bot Response</text>
|
||||
<rect x="580" y="60" width="100" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="630" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Bot Response</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrows -->
|
||||
<g id="arrows" stroke="#888" stroke-width="2" fill="none">
|
||||
<!-- Horizontal flow -->
|
||||
<line x1="120" y1="50" x2="180" y2="50" marker-end="url(#arrow)"/>
|
||||
<line x1="280" y1="50" x2="340" y2="50" marker-end="url(#arrow)"/>
|
||||
<line x1="440" y1="50" x2="500" y2="50" marker-end="url(#arrow)"/>
|
||||
<!-- Parallel Processes -->
|
||||
<g id="parallelProcesses">
|
||||
<!-- Search Knowledge -->
|
||||
<rect x="360" y="160" width="120" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="420" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Search Knowledge</text>
|
||||
|
||||
<!-- Vertical connections -->
|
||||
<line x1="230" y1="70" x2="230" y2="90" stroke-dasharray="3,3" opacity="0.6"/>
|
||||
<line x1="390" y1="70" x2="390" y2="100" marker-end="url(#arrow)"/>
|
||||
<line x1="560" y1="70" x2="560" y2="100" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Feedback lines -->
|
||||
<line x1="230" y1="90" x2="220" y2="160" marker-end="url(#arrow)"/>
|
||||
<line x1="390" y1="140" x2="240" y2="160" marker-end="url(#arrow)"/>
|
||||
<line x1="500" y1="120" x2="280" y2="170" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- User to Bot Response -->
|
||||
<path d="M 70 70 Q 70 180 160 180" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
<!-- Call API -->
|
||||
<rect x="500" y="160" width="100" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="550" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Call API</text>
|
||||
</g>
|
||||
|
||||
<!-- Flow Arrows -->
|
||||
<g id="arrows" stroke="#666" stroke-width="2" fill="none">
|
||||
<!-- Main horizontal flow -->
|
||||
<line x1="120" y1="80" x2="160" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="260" y1="80" x2="300" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="400" y1="80" x2="440" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="540" y1="80" x2="580" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Branch down to parallel processes -->
|
||||
<line x1="490" y1="100" x2="490" y2="130" stroke-dasharray="3,3" opacity="0.6"/>
|
||||
<line x1="490" y1="130" x2="420" y2="160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
<line x1="490" y1="130" x2="550" y2="160" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- Feedback from parallel processes to response -->
|
||||
<path d="M420,200 Q420,240 630,240 Q630,140 630,100" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.4"/>
|
||||
<path d="M550,200 Q550,230 620,230 Q620,130 620,100" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.4"/>
|
||||
|
||||
<!-- Direct feedback loop -->
|
||||
<path d="M70,60 Q70,30 630,30 Q630,50 630,60" stroke-dasharray="2,2" marker-end="url(#arrow)" opacity="0.3"/>
|
||||
</g>
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="280" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
The AI handles everything else - understanding intent, collecting information, executing tools,
|
||||
</text>
|
||||
<text x="400" y="298" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
answering from documents. Zero configuration.
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3.8 KiB |
59
docs/src/assets/conversation-flow.svg.backup
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<svg width="800" height="200" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Boxes -->
|
||||
<g id="boxes">
|
||||
<!-- User Input -->
|
||||
<rect x="20" y="30" width="100" height="40" fill="none" stroke="#4A9EFF" stroke-width="2" rx="5"/>
|
||||
<text x="70" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#4A9EFF">User Input</text>
|
||||
|
||||
<!-- BASIC Script -->
|
||||
<rect x="180" y="30" width="100" height="40" fill="none" stroke="#FF9F40" stroke-width="2" rx="5"/>
|
||||
<text x="230" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#FF9F40">BASIC Script</text>
|
||||
|
||||
<!-- LLM Decision -->
|
||||
<rect x="340" y="30" width="100" height="40" fill="none" stroke="#BA68C8" stroke-width="2" rx="5"/>
|
||||
<text x="390" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#BA68C8">LLM Decision</text>
|
||||
|
||||
<!-- Tool Execution -->
|
||||
<rect x="500" y="30" width="120" height="40" fill="none" stroke="#66BB6A" stroke-width="2" rx="5"/>
|
||||
<text x="560" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#66BB6A">Tool Execution</text>
|
||||
|
||||
<!-- Save to CSV -->
|
||||
<rect x="500" y="100" width="120" height="40" fill="none" stroke="#EC407A" stroke-width="2" rx="5"/>
|
||||
<text x="560" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#EC407A">Save to CSV</text>
|
||||
|
||||
<!-- Search Knowledge -->
|
||||
<rect x="320" y="100" width="140" height="40" fill="none" stroke="#26A69A" stroke-width="2" rx="5"/>
|
||||
<text x="390" y="125" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#26A69A">Search Knowledge</text>
|
||||
|
||||
<!-- Bot Response -->
|
||||
<rect x="160" y="160" width="120" height="40" fill="none" stroke="#5C6BC0" stroke-width="2" rx="5"/>
|
||||
<text x="220" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#5C6BC0">Bot Response</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrows -->
|
||||
<g id="arrows" stroke="#888" stroke-width="2" fill="none">
|
||||
<!-- Horizontal flow -->
|
||||
<line x1="120" y1="50" x2="180" y2="50" marker-end="url(#arrow)"/>
|
||||
<line x1="280" y1="50" x2="340" y2="50" marker-end="url(#arrow)"/>
|
||||
<line x1="440" y1="50" x2="500" y2="50" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Vertical connections -->
|
||||
<line x1="230" y1="70" x2="230" y2="90" stroke-dasharray="3,3" opacity="0.6"/>
|
||||
<line x1="390" y1="70" x2="390" y2="100" marker-end="url(#arrow)"/>
|
||||
<line x1="560" y1="70" x2="560" y2="100" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Feedback lines -->
|
||||
<line x1="230" y1="90" x2="220" y2="160" marker-end="url(#arrow)"/>
|
||||
<line x1="390" y1="140" x2="240" y2="160" marker-end="url(#arrow)"/>
|
||||
<line x1="500" y1="120" x2="280" y2="170" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- User to Bot Response -->
|
||||
<path d="M 70 70 Q 70 180 160 180" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3 KiB |
|
|
@ -1,95 +1,93 @@
|
|||
<svg width="800" height="500" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="400" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
</marker>
|
||||
<marker id="arrow-double" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#999"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Package System Flow</text>
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">Package System Flow</text>
|
||||
|
||||
<!-- Main Components -->
|
||||
<!-- User Request -->
|
||||
<rect x="50" y="60" width="120" height="50" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="110" y="90" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">User Request</text>
|
||||
<rect x="20" y="60" width="100" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="70" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">User Request</text>
|
||||
|
||||
<!-- start.bas -->
|
||||
<rect x="160" y="60" width="100" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="210" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">start.bas</text>
|
||||
|
||||
<!-- LLM Engine -->
|
||||
<rect x="300" y="60" width="100" height="40" fill="none" stroke="#BD10E0" stroke-width="2" rx="5"/>
|
||||
<text x="350" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">LLM Engine</text>
|
||||
|
||||
<!-- Bot Response -->
|
||||
<rect x="630" y="60" width="120" height="50" fill="none" stroke="#68D391" stroke-width="2" rx="8"/>
|
||||
<text x="690" y="90" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#9AE6B4">Bot Response</text>
|
||||
<rect x="440" y="60" width="100" height="40" fill="none" stroke="#50E3C2" stroke-width="2" rx="5"/>
|
||||
<text x="490" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Bot Response</text>
|
||||
|
||||
<!-- start.bas Box -->
|
||||
<rect x="50" y="180" width="180" height="140" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
|
||||
<rect x="50" y="180" width="180" height="35" fill="none" stroke="#F6AD55" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="140" y="203" text-anchor="middle" font-family="monospace" font-size="14" font-weight="bold" fill="#FBD38D">start.bas</text>
|
||||
<!-- Supporting Components -->
|
||||
<!-- Vector Search -->
|
||||
<rect x="240" y="160" width="120" height="40" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="300" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Vector Search</text>
|
||||
|
||||
<!-- BASIC Commands -->
|
||||
<text x="60" y="240" font-family="monospace" font-size="12" fill="#A0AEC0">USE KB "docs"</text>
|
||||
<text x="60" y="260" font-family="monospace" font-size="12" fill="#A0AEC0">answer=HEAR</text>
|
||||
<text x="60" y="280" font-family="monospace" font-size="12" fill="#A0AEC0">result=LLM()</text>
|
||||
<text x="60" y="300" font-family="monospace" font-size="12" fill="#A0AEC0">TALK result</text>
|
||||
<!-- .gbkb docs -->
|
||||
<rect x="240" y="240" width="120" height="40" fill="none" stroke="#F5A623" stroke-width="2" rx="5"/>
|
||||
<text x="300" y="265" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">.gbkb docs</text>
|
||||
|
||||
<!-- LLM Engine Box -->
|
||||
<rect x="350" y="180" width="180" height="140" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<rect x="350" y="180" width="180" height="35" fill="none" stroke="#B794F4" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="440" y="203" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">LLM Engine</text>
|
||||
<text x="440" y="250" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" fill="#D6BCFA">(GPT/Local)</text>
|
||||
<text x="440" y="280" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#A0AEC0">Processes requests</text>
|
||||
<text x="440" y="300" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#A0AEC0">Makes decisions</text>
|
||||
|
||||
<!-- Vector Search Box -->
|
||||
<rect x="300" y="370" width="200" height="100" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8"/>
|
||||
<rect x="300" y="370" width="200" height="35" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="400" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">Vector Search</text>
|
||||
<text x="400" y="430" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" fill="#81E6D9">(.gbkb docs)</text>
|
||||
<text x="400" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#A0AEC0">Semantic search</text>
|
||||
|
||||
<!-- Arrows -->
|
||||
<g stroke="#888" stroke-width="2" fill="none">
|
||||
<!-- User to start.bas -->
|
||||
<line x1="170" y1="85" x2="140" y2="180" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- start.bas to LLM (bidirectional) -->
|
||||
<line x1="230" y1="200" x2="350" y2="200" marker-end="url(#arrow)"/>
|
||||
<line x1="350" y1="220" x2="230" y2="220" marker-end="url(#arrow)" stroke="#999"/>
|
||||
|
||||
<line x1="230" y1="280" x2="350" y2="280" marker-end="url(#arrow)"/>
|
||||
<line x1="350" y1="300" x2="230" y2="300" marker-end="url(#arrow)" stroke="#999"/>
|
||||
|
||||
<!-- LLM to Vector Search -->
|
||||
<line x1="440" y1="320" x2="400" y2="370" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Vector Search back to LLM -->
|
||||
<path d="M 400 370 Q 340 340 380 320" stroke="#999" stroke-dasharray="5,5" marker-end="url(#arrow-double)" opacity="0.7"/>
|
||||
|
||||
<!-- Bot Response arrow -->
|
||||
<path d="M 530 250 Q 600 150 630 85" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- start.bas to Bot Response -->
|
||||
<path d="M 140 180 Q 140 85 630 85" stroke="#999" stroke-dasharray="5,5" marker-end="url(#arrow-double)" opacity="0.7"/>
|
||||
<!-- BASIC Commands Detail -->
|
||||
<g transform="translate(580, 60)">
|
||||
<rect width="200" height="120" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="100" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">BASIC Commands</text>
|
||||
<text x="10" y="50" font-family="monospace" font-size="12" fill="#666">USE KB "docs"</text>
|
||||
<text x="10" y="70" font-family="monospace" font-size="12" fill="#666">answer = HEAR</text>
|
||||
<text x="10" y="90" font-family="monospace" font-size="12" fill="#666">result = LLM()</text>
|
||||
<text x="10" y="110" font-family="monospace" font-size="12" fill="#666">TALK result</text>
|
||||
</g>
|
||||
|
||||
<!-- Labels on arrows -->
|
||||
<text x="290" y="195" font-family="Arial, sans-serif" font-size="11" fill="#718096">Commands</text>
|
||||
<text x="290" y="235" font-family="Arial, sans-serif" font-size="11" fill="#718096">Results</text>
|
||||
|
||||
<text x="420" y="345" font-family="Arial, sans-serif" font-size="11" fill="#718096">Query</text>
|
||||
<text x="320" y="345" font-family="Arial, sans-serif" font-size="11" fill="#718096">Context</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(600, 380)">
|
||||
<rect x="0" y="0" width="180" height="100" fill="none" stroke="#4A5568" stroke-width="1" rx="5" opacity="0.5"/>
|
||||
<text x="90" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Flow Legend</text>
|
||||
|
||||
<line x1="10" y1="40" x2="40" y2="40" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="50" y="45" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Direct flow</text>
|
||||
|
||||
<line x1="10" y1="60" x2="40" y2="60" stroke="#999" stroke-width="2" stroke-dasharray="5,5" marker-end="url(#arrow-double)" opacity="0.7"/>
|
||||
<text x="50" y="65" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Feedback/Return</text>
|
||||
|
||||
<line x1="10" y1="80" x2="40" y2="80" stroke="#888" stroke-width="2"/>
|
||||
<line x1="40" y1="80" x2="10" y2="80" stroke="#999" stroke-width="2"/>
|
||||
<text x="50" y="85" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Bidirectional</text>
|
||||
<!-- Package Structure -->
|
||||
<g transform="translate(580, 210)">
|
||||
<rect width="200" height="140" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="100" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Package Structure</text>
|
||||
<text x="10" y="50" font-family="monospace" font-size="12" fill="#666">my-bot.gbai/</text>
|
||||
<text x="20" y="70" font-family="monospace" font-size="12" fill="#666">├─ .gbdialog/</text>
|
||||
<text x="20" y="90" font-family="monospace" font-size="12" fill="#666">├─ .gbkb/</text>
|
||||
<text x="20" y="110" font-family="monospace" font-size="12" fill="#666">└─ .gbot/</text>
|
||||
</g>
|
||||
|
||||
<!-- Flow Arrows -->
|
||||
<g stroke="#666" stroke-width="2" fill="none">
|
||||
<!-- Main flow -->
|
||||
<line x1="120" y1="80" x2="160" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="260" y1="80" x2="300" y2="80" marker-end="url(#arrow)"/>
|
||||
<line x1="400" y1="80" x2="440" y2="80" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- LLM to Vector Search (downward) -->
|
||||
<line x1="350" y1="100" x2="300" y2="160" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- Vector Search to .gbkb docs -->
|
||||
<line x1="300" y1="200" x2="300" y2="240" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- Feedback from start.bas to Vector Search (Results) -->
|
||||
<path d="M240,100 Q240,130 270,130 Q270,160 270,160" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- Feedback from Vector Search to LLM (Context) -->
|
||||
<path d="M330,160 Q330,130 350,130 Q350,110 350,100" stroke-dasharray="3,3" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- Connection from start.bas to BASIC Commands (top right) -->
|
||||
<path d="M260,70 Q400,40 580,80" stroke-dasharray="2,2" opacity="0.3"/>
|
||||
|
||||
<!-- Connection from .gbkb docs to Package Structure (bottom right) -->
|
||||
<path d="M360,265 Q470,280 580,290" stroke-dasharray="2,2" opacity="0.3"/>
|
||||
</g>
|
||||
|
||||
<!-- Labels on key connections -->
|
||||
<text x="340" y="50" font-family="Arial, sans-serif" font-size="11" fill="#666">Commands</text>
|
||||
<text x="230" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">Results</text>
|
||||
<text x="365" y="145" font-family="Arial, sans-serif" font-size="11" fill="#666">Query</text>
|
||||
<text x="340" y="125" font-family="Arial, sans-serif" font-size="11" fill="#666">Context</text>
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="380" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
BASIC scripts orchestrate LLM decisions, vector search, and responses with zero configuration
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.2 KiB |
95
docs/src/assets/package-system-flow.svg.backup
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<svg width="800" height="500" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
</marker>
|
||||
<marker id="arrow-double" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#999"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Package System Flow</text>
|
||||
|
||||
<!-- User Request -->
|
||||
<rect x="50" y="60" width="120" height="50" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="110" y="90" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">User Request</text>
|
||||
|
||||
<!-- Bot Response -->
|
||||
<rect x="630" y="60" width="120" height="50" fill="none" stroke="#68D391" stroke-width="2" rx="8"/>
|
||||
<text x="690" y="90" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#9AE6B4">Bot Response</text>
|
||||
|
||||
<!-- start.bas Box -->
|
||||
<rect x="50" y="180" width="180" height="140" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
|
||||
<rect x="50" y="180" width="180" height="35" fill="none" stroke="#F6AD55" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="140" y="203" text-anchor="middle" font-family="monospace" font-size="14" font-weight="bold" fill="#FBD38D">start.bas</text>
|
||||
|
||||
<!-- BASIC Commands -->
|
||||
<text x="60" y="240" font-family="monospace" font-size="12" fill="#A0AEC0">USE KB "docs"</text>
|
||||
<text x="60" y="260" font-family="monospace" font-size="12" fill="#A0AEC0">answer=HEAR</text>
|
||||
<text x="60" y="280" font-family="monospace" font-size="12" fill="#A0AEC0">result=LLM()</text>
|
||||
<text x="60" y="300" font-family="monospace" font-size="12" fill="#A0AEC0">TALK result</text>
|
||||
|
||||
<!-- LLM Engine Box -->
|
||||
<rect x="350" y="180" width="180" height="140" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<rect x="350" y="180" width="180" height="35" fill="none" stroke="#B794F4" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="440" y="203" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">LLM Engine</text>
|
||||
<text x="440" y="250" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" fill="#D6BCFA">(GPT/Local)</text>
|
||||
<text x="440" y="280" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#A0AEC0">Processes requests</text>
|
||||
<text x="440" y="300" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#A0AEC0">Makes decisions</text>
|
||||
|
||||
<!-- Vector Search Box -->
|
||||
<rect x="300" y="370" width="200" height="100" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8"/>
|
||||
<rect x="300" y="370" width="200" height="35" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8 8 0 0"/>
|
||||
<text x="400" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">Vector Search</text>
|
||||
<text x="400" y="430" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" fill="#81E6D9">(.gbkb docs)</text>
|
||||
<text x="400" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#A0AEC0">Semantic search</text>
|
||||
|
||||
<!-- Arrows -->
|
||||
<g stroke="#888" stroke-width="2" fill="none">
|
||||
<!-- User to start.bas -->
|
||||
<line x1="170" y1="85" x2="140" y2="180" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- start.bas to LLM (bidirectional) -->
|
||||
<line x1="230" y1="200" x2="350" y2="200" marker-end="url(#arrow)"/>
|
||||
<line x1="350" y1="220" x2="230" y2="220" marker-end="url(#arrow)" stroke="#999"/>
|
||||
|
||||
<line x1="230" y1="280" x2="350" y2="280" marker-end="url(#arrow)"/>
|
||||
<line x1="350" y1="300" x2="230" y2="300" marker-end="url(#arrow)" stroke="#999"/>
|
||||
|
||||
<!-- LLM to Vector Search -->
|
||||
<line x1="440" y1="320" x2="400" y2="370" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Vector Search back to LLM -->
|
||||
<path d="M 400 370 Q 340 340 380 320" stroke="#999" stroke-dasharray="5,5" marker-end="url(#arrow-double)" opacity="0.7"/>
|
||||
|
||||
<!-- Bot Response arrow -->
|
||||
<path d="M 530 250 Q 600 150 630 85" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- start.bas to Bot Response -->
|
||||
<path d="M 140 180 Q 140 85 630 85" stroke="#999" stroke-dasharray="5,5" marker-end="url(#arrow-double)" opacity="0.7"/>
|
||||
</g>
|
||||
|
||||
<!-- Labels on arrows -->
|
||||
<text x="290" y="195" font-family="Arial, sans-serif" font-size="11" fill="#718096">Commands</text>
|
||||
<text x="290" y="235" font-family="Arial, sans-serif" font-size="11" fill="#718096">Results</text>
|
||||
|
||||
<text x="420" y="345" font-family="Arial, sans-serif" font-size="11" fill="#718096">Query</text>
|
||||
<text x="320" y="345" font-family="Arial, sans-serif" font-size="11" fill="#718096">Context</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(600, 380)">
|
||||
<rect x="0" y="0" width="180" height="100" fill="none" stroke="#4A5568" stroke-width="1" rx="5" opacity="0.5"/>
|
||||
<text x="90" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Flow Legend</text>
|
||||
|
||||
<line x1="10" y1="40" x2="40" y2="40" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<text x="50" y="45" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Direct flow</text>
|
||||
|
||||
<line x1="10" y1="60" x2="40" y2="60" stroke="#999" stroke-width="2" stroke-dasharray="5,5" marker-end="url(#arrow-double)" opacity="0.7"/>
|
||||
<text x="50" y="65" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Feedback/Return</text>
|
||||
|
||||
<line x1="10" y1="80" x2="40" y2="80" stroke="#888" stroke-width="2"/>
|
||||
<line x1="40" y1="80" x2="10" y2="80" stroke="#999" stroke-width="2"/>
|
||||
<text x="50" y="85" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Bidirectional</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.8 KiB |
|
|
@ -1,98 +1,98 @@
|
|||
<svg width="800" height="900" viewBox="0 0 800 900" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="900" viewBox="0 0 800 900" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#4B5563"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Auto-Bootstrap Process</text>
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="bold" fill="#1F2937">Auto-Bootstrap Process</text>
|
||||
|
||||
<!-- Start: ./botserver (First Run) -->
|
||||
<rect x="325" y="50" width="150" height="40" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="400" y="75" text-anchor="middle" font-family="monospace" font-size="14" fill="#90CDF4">./botserver</text>
|
||||
<text x="400" y="75" text-anchor="middle" font-family="monospace" font-size="20" fill="#1E40AF">./botserver</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="90" x2="400" y2="120" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Detect System -->
|
||||
<rect x="300" y="120" width="200" height="60" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
|
||||
<text x="400" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">Detect System</text>
|
||||
<text x="400" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#CBD5E0">(Linux/Mac)</text>
|
||||
<text x="400" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EA580C">Detect System</text>
|
||||
<text x="400" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1F2937">(Linux/Mac)</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="180" x2="400" y2="210" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Main Process Container -->
|
||||
<rect x="50" y="210" width="700" height="280" fill="none" stroke="#4A5568" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<text x="400" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#A0AEC0">Auto-Bootstrap Process</text>
|
||||
<text x="400" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#374151">Auto-Bootstrap Process</text>
|
||||
|
||||
<!-- Component Grid -->
|
||||
<g id="components">
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="100" y="260" width="140" height="100" fill="none" stroke="#4A90E2" stroke-width="2" rx="8"/>
|
||||
<text x="170" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#63B3ED">PostgreSQL</text>
|
||||
<text x="170" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#90CDF4">16.2</text>
|
||||
<text x="170" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Install</text>
|
||||
<text x="170" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Configure</text>
|
||||
<text x="170" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Migrate</text>
|
||||
<text x="170" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#2563EB">PostgreSQL</text>
|
||||
<text x="170" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1E40AF">16.2</text>
|
||||
<text x="170" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Install</text>
|
||||
<text x="170" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Configure</text>
|
||||
<text x="170" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Migrate</text>
|
||||
|
||||
<!-- Valkey -->
|
||||
<rect x="260" y="260" width="140" height="100" fill="none" stroke="#E53E3E" stroke-width="2" rx="8"/>
|
||||
<text x="330" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">Valkey</text>
|
||||
<text x="330" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FEB2B2">Cache</text>
|
||||
<text x="330" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Install</text>
|
||||
<text x="330" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Configure</text>
|
||||
<text x="330" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Start</text>
|
||||
<text x="330" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EF4444">Valkey</text>
|
||||
<text x="330" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#DC2626">Cache</text>
|
||||
<text x="330" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Install</text>
|
||||
<text x="330" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Configure</text>
|
||||
<text x="330" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Start</text>
|
||||
|
||||
<!-- SeaweedFS -->
|
||||
<rect x="420" y="260" width="140" height="100" fill="none" stroke="#38A169" stroke-width="2" rx="8"/>
|
||||
<text x="490" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#48BB78">SeaweedFS</text>
|
||||
<text x="490" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#68D391">Storage</text>
|
||||
<text x="490" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Install</text>
|
||||
<text x="490" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Configure</text>
|
||||
<text x="490" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Start</text>
|
||||
<text x="490" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#047857">SeaweedFS</text>
|
||||
<text x="490" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#059669">Storage</text>
|
||||
<text x="490" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Install</text>
|
||||
<text x="490" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Configure</text>
|
||||
<text x="490" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Start</text>
|
||||
|
||||
<!-- Qdrant -->
|
||||
<rect x="580" y="260" width="140" height="100" fill="none" stroke="#38D4B2" stroke-width="2" rx="8"/>
|
||||
<text x="650" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#4FD1C5">Qdrant</text>
|
||||
<text x="650" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#81E6D9">Vectors</text>
|
||||
<text x="650" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Install</text>
|
||||
<text x="650" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Configure</text>
|
||||
<text x="650" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Start</text>
|
||||
<text x="650" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#0891B2">Qdrant</text>
|
||||
<text x="650" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#0891B2">Vectors</text>
|
||||
<text x="650" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Install</text>
|
||||
<text x="650" y="340" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Configure</text>
|
||||
<text x="650" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Start</text>
|
||||
</g>
|
||||
|
||||
<!-- LLM Models -->
|
||||
<rect x="150" y="380" width="500" height="80" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<text x="400" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">LLM Models (Optional)</text>
|
||||
<text x="400" y="430" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Download BGE embeddings</text>
|
||||
<text x="400" y="445" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">✓ Download Llama model (if local)</text>
|
||||
<text x="400" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#9333EA">LLM Models (Optional)</text>
|
||||
<text x="400" y="430" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Download BGE embeddings</text>
|
||||
<text x="400" y="445" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#059669">✓ Download Llama model (if local)</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="490" x2="400" y2="520" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Generate .env file -->
|
||||
<rect x="275" y="520" width="250" height="80" fill="none" stroke="#ED8936" stroke-width="2" rx="8"/>
|
||||
<text x="400" y="545" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#F6AD55">Generate .env file</text>
|
||||
<text x="400" y="565" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">• Secure passwords</text>
|
||||
<text x="400" y="580" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">• Connection URLs</text>
|
||||
<text x="400" y="595" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">• Port assignments</text>
|
||||
<text x="400" y="545" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#D97706">Generate .env file</text>
|
||||
<text x="400" y="565" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">• Secure passwords</text>
|
||||
<text x="400" y="580" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">• Connection URLs</text>
|
||||
<text x="400" y="595" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">• Port assignments</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="600" x2="400" y2="630" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Load Templates -->
|
||||
<rect x="275" y="630" width="250" height="80" fill="none" stroke="#9F7AEA" stroke-width="2" rx="8"/>
|
||||
<text x="400" y="655" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#B794F4">Load Templates</text>
|
||||
<text x="400" y="675" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">• Scan .gbai dirs</text>
|
||||
<text x="400" y="690" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">• Create bots</text>
|
||||
<text x="400" y="705" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">• Index documents</text>
|
||||
<text x="400" y="655" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#9333EA">Load Templates</text>
|
||||
<text x="400" y="675" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">• Scan .gbai dirs</text>
|
||||
<text x="400" y="690" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">• Create bots</text>
|
||||
<text x="400" y="705" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">• Index documents</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="710" x2="400" y2="740" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Start Web Server -->
|
||||
<rect x="275" y="740" width="250" height="60" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<text x="400" y="765" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">Start Web Server</text>
|
||||
<text x="400" y="785" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#9AE6B4">localhost:8080</text>
|
||||
<text x="400" y="765" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#059669">Start Web Server</text>
|
||||
<text x="400" y="785" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#10B981">localhost:8080</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.5 KiB |
129
docs/src/chapter-01/assets/bootstrap-process.svg.backup
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 880 980" 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="980" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="25" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Auto-Bootstrap Process</text>
|
||||
|
||||
<!-- Start: ./botserver (First Run) -->
|
||||
<rect x="325" y="50" width="150" height="40" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="75" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#4B5563" filter="url(#textShadow)">./botserver</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="90" x2="400" y2="120" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Detect System -->
|
||||
<rect x="300" y="120" width="200" height="60" fill="none" stroke="#EA580C" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="145" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Detect System</text>
|
||||
<text x="400" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">(Linux/Mac)</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="180" x2="400" y2="210" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Main Process Container -->
|
||||
<rect x="50" y="210" width="700" height="280" fill="none" stroke="#2563EB" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6" filter="url(#shadow)"/>
|
||||
<text x="400" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Auto-Bootstrap Process</text>
|
||||
|
||||
<!-- Component Grid -->
|
||||
<g id="components">
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="100" y="260" width="140" height="100" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="170" y="285" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">PostgreSQL</text>
|
||||
<text x="170" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">16.2</text>
|
||||
<text x="170" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Install</text>
|
||||
<text x="170" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Configure</text>
|
||||
<text x="170" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Migrate</text>
|
||||
|
||||
<!-- Valkey -->
|
||||
<rect x="260" y="260" width="140" height="100" fill="none" stroke="#DC2626" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="330" y="285" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Valkey</text>
|
||||
<text x="330" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Cache</text>
|
||||
<text x="330" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Install</text>
|
||||
<text x="330" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Configure</text>
|
||||
<text x="330" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Start</text>
|
||||
|
||||
<!-- SeaweedFS -->
|
||||
<rect x="420" y="260" width="140" height="100" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="490" y="285" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">SeaweedFS</text>
|
||||
<text x="490" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Storage</text>
|
||||
<text x="490" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Install</text>
|
||||
<text x="490" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Configure</text>
|
||||
<text x="490" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Start</text>
|
||||
|
||||
<!-- Qdrant -->
|
||||
<rect x="580" y="260" width="140" height="100" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="650" y="285" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Qdrant</text>
|
||||
<text x="650" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Vectors</text>
|
||||
<text x="650" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Install</text>
|
||||
<text x="650" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Configure</text>
|
||||
<text x="650" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Start</text>
|
||||
</g>
|
||||
|
||||
<!-- LLM Models -->
|
||||
<rect x="150" y="380" width="500" height="80" fill="none" stroke="#7C3AED" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">LLM Models (Optional)</text>
|
||||
<text x="400" y="430" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Download BGE embeddings</text>
|
||||
<text x="400" y="445" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">✓ Download Llama model (if local)</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="490" x2="400" y2="520" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Generate .env file -->
|
||||
<rect x="275" y="520" width="250" height="80" fill="none" stroke="#EA580C" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="545" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Generate .env file</text>
|
||||
<text x="400" y="565" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Secure passwords</text>
|
||||
<text x="400" y="580" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Connection URLs</text>
|
||||
<text x="400" y="595" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Port assignments</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="600" x2="400" y2="630" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Load Templates -->
|
||||
<rect x="275" y="630" width="250" height="80" fill="none" stroke="#7C3AED" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="655" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Load Templates</text>
|
||||
<text x="400" y="675" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Scan .gbai dirs</text>
|
||||
<text x="400" y="690" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Create bots</text>
|
||||
<text x="400" y="705" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Index documents</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="400" y1="710" x2="400" y2="740" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Start Web Server -->
|
||||
<rect x="275" y="740" width="250" height="60" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="765" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Start Web Server</text>
|
||||
<text x="400" y="785" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">localhost:8080</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 10 KiB |
188
docs/src/chapter-01/assets/quick-start-bootstrap-wide.svg
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
<svg width="1400" height="900" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
/* Light theme defaults */
|
||||
.neon-blue { stroke: #4A90E2; stroke-width: 2.6; }
|
||||
.neon-orange { stroke: #F5A623; stroke-width: 2.6; }
|
||||
.neon-purple { stroke: #BD10E0; stroke-width: 2.6; }
|
||||
.neon-green { stroke: #7ED321; stroke-width: 2.6; }
|
||||
.neon-cyan { stroke: #50E3C2; stroke-width: 2.6; }
|
||||
.main-text { fill: #1a1a1a; }
|
||||
.secondary-text { fill: #666; }
|
||||
.arrow-color { stroke: #666; fill: #666; }
|
||||
|
||||
/* Dark theme with subtle neon effects */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.neon-blue {
|
||||
stroke: #00D4FF;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00D4FF) drop-shadow(0 0 8px #00A0FF);
|
||||
}
|
||||
.neon-orange {
|
||||
stroke: #FF9500;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #FF9500) drop-shadow(0 0 8px #FF7700);
|
||||
}
|
||||
.neon-purple {
|
||||
stroke: #E040FB;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #E040FB) drop-shadow(0 0 8px #D500F9);
|
||||
}
|
||||
.neon-green {
|
||||
stroke: #00FF88;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00FF88) drop-shadow(0 0 8px #00E676);
|
||||
}
|
||||
.neon-cyan {
|
||||
stroke: #00E5EA;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00E5EA) drop-shadow(0 0 8px #00BCD4);
|
||||
}
|
||||
.main-text { fill: #FFFFFF; }
|
||||
.secondary-text { fill: #B0B0B0; }
|
||||
.arrow-color { stroke: #B0B0B0; fill: #B0B0B0; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
<marker id="arrow" markerWidth="13" markerHeight="13" refX="11.7" refY="3.9" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,7.8 L11.7,3.9 z" class="arrow-color"/>
|
||||
</marker>
|
||||
<marker id="arrow-small" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,6 L9,3 z" class="arrow-color"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title (well separated from content) -->
|
||||
<text x="700" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="32" font-weight="600" class="main-text">Bootstrap Flow</text>
|
||||
|
||||
<!-- MAIN FLOW DIAGRAM (Upper Section) -->
|
||||
|
||||
<!-- Phase 1: Start -->
|
||||
<g id="phase-start">
|
||||
<rect x="40" y="100" width="160" height="70" fill="none" class="neon-blue" rx="6.5"/>
|
||||
<text x="120" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="500" class="main-text">./botserver</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow from Start to OS Detection -->
|
||||
<line x1="200" y1="135" x2="250" y2="135" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Phase 2: OS Detection -->
|
||||
<g id="phase-detection">
|
||||
<rect x="250" y="100" width="180" height="70" fill="none" class="neon-orange" rx="6.5"/>
|
||||
<text x="340" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="500" class="main-text">OS Detection</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow from OS Detection to Component Installation -->
|
||||
<line x1="430" y1="135" x2="490" y2="135" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Phase 3: Component Installation -->
|
||||
<g id="phase-components">
|
||||
<!-- Label -->
|
||||
<text x="620" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" font-weight="500" class="secondary-text">Component Installation</text>
|
||||
|
||||
<!-- Components in 2x2 grid with proper widths -->
|
||||
<rect x="490" y="120" width="120" height="50" fill="none" class="neon-blue" rx="5"/>
|
||||
<text x="550" y="151" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">PostgreSQL</text>
|
||||
|
||||
<rect x="630" y="120" width="120" height="50" fill="none" class="neon-purple" rx="5"/>
|
||||
<text x="690" y="151" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">Valkey</text>
|
||||
|
||||
<rect x="490" y="190" width="120" height="50" fill="none" class="neon-green" rx="5"/>
|
||||
<text x="550" y="221" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">SeaweedFS</text>
|
||||
|
||||
<rect x="630" y="190" width="120" height="50" fill="none" class="neon-cyan" rx="5"/>
|
||||
<text x="690" y="221" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">Qdrant</text>
|
||||
|
||||
<!-- Merge lines -->
|
||||
<g class="arrow-color" stroke-width="1.5" fill="none" opacity="0.5">
|
||||
<line x1="550" y1="170" x2="550" y2="180"/>
|
||||
<line x1="690" y1="170" x2="690" y2="180"/>
|
||||
<line x1="550" y1="180" x2="690" y2="180"/>
|
||||
<line x1="620" y1="180" x2="620" y2="260"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to Configuration -->
|
||||
<line x1="620" y1="260" x2="620" y2="330" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Phase 4: Configuration & Setup -->
|
||||
<g id="phase-config">
|
||||
<rect x="490" y="330" width="260" height="70" fill="none" class="neon-purple" rx="6.5"/>
|
||||
<text x="620" y="375" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="500" class="main-text">Configuration & Setup</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow from Configuration to Bot Deployment section -->
|
||||
<line x1="750" y1="365" x2="820" y2="365" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Phase 5: Bot Deployment (vertical flow) -->
|
||||
<g id="phase-deployment">
|
||||
<!-- Label -->
|
||||
<text x="1030" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" font-weight="500" class="secondary-text">Bot Deployment</text>
|
||||
|
||||
<!-- Scan templates with proper width -->
|
||||
<rect x="880" y="120" width="300" height="60" fill="none" class="neon-orange" rx="6.5"/>
|
||||
<text x="1030" y="158" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" class="main-text">Scan templates/ directory</text>
|
||||
|
||||
<!-- Dashed arrow -->
|
||||
<line x1="1030" y1="180" x2="1030" y2="230" class="arrow-color" stroke-width="2.6" stroke-dasharray="3.9,3.9" marker-end="url(#arrow)" opacity="0.5"/>
|
||||
|
||||
<!-- Load packages with proper width -->
|
||||
<rect x="880" y="230" width="300" height="60" fill="none" class="neon-orange" rx="6.5"/>
|
||||
<text x="1030" y="268" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" class="main-text">Load .gbai packages</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="1030" y1="290" x2="1030" y2="340" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Start Web Server -->
|
||||
<rect x="880" y="340" width="300" height="60" fill="none" class="neon-green" rx="6.5"/>
|
||||
<text x="1030" y="378" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="500" class="main-text">Start Web Server</text>
|
||||
</g>
|
||||
|
||||
<!-- PROGRESS INDICATOR (Bottom Section) -->
|
||||
<g id="process-flow">
|
||||
<!-- Large flow arrow at bottom -->
|
||||
<defs>
|
||||
<linearGradient id="flowGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||
<stop offset="0%" style="stop-color:#4A90E2;stop-opacity:0.3" />
|
||||
<stop offset="50%" style="stop-color:#BD10E0;stop-opacity:0.3" />
|
||||
<stop offset="100%" style="stop-color:#7ED321;stop-opacity:0.3" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<!-- Flow visualization bar -->
|
||||
<rect x="120" y="500" width="1060" height="80" fill="url(#flowGradient)" rx="10" opacity="0.2"/>
|
||||
|
||||
<!-- Stage indicators -->
|
||||
<circle cx="120" cy="540" r="8" class="neon-blue" fill="none"/>
|
||||
<circle cx="340" cy="540" r="8" class="neon-orange" fill="none"/>
|
||||
<circle cx="620" cy="540" r="8" class="neon-purple" fill="none"/>
|
||||
<circle cx="1030" cy="540" r="8" class="neon-green" fill="none"/>
|
||||
|
||||
<!-- Connecting lines -->
|
||||
<line x1="128" y1="540" x2="332" y2="540" class="arrow-color" stroke-width="2" opacity="0.4"/>
|
||||
<line x1="348" y1="540" x2="612" y2="540" class="arrow-color" stroke-width="2" opacity="0.4"/>
|
||||
<line x1="628" y1="540" x2="1022" y2="540" class="arrow-color" stroke-width="2" opacity="0.4"/>
|
||||
|
||||
<!-- Stage labels -->
|
||||
<text x="120" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Start</text>
|
||||
<text x="340" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Detect</text>
|
||||
<text x="620" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Install & Configure</text>
|
||||
<text x="1030" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Deploy</text>
|
||||
</g>
|
||||
|
||||
<!-- Description text (well-spaced at bottom) -->
|
||||
<text x="700" y="720" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" class="secondary-text">
|
||||
Automatic bootstrap process: detect OS, install components, configure, and deploy
|
||||
</text>
|
||||
<text x="700" y="755" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" class="secondary-text">
|
||||
Zero configuration required - everything runs from a single binary
|
||||
</text>
|
||||
|
||||
<!-- Optional: Add subtle grid/connection lines in background -->
|
||||
<g opacity="0.05" class="arrow-color">
|
||||
<line x1="120" y1="170" x2="120" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
<line x1="340" y1="170" x2="340" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
<line x1="620" y1="240" x2="620" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
<line x1="1030" y1="400" x2="1030" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.3 KiB |
|
|
@ -1,111 +1,188 @@
|
|||
<svg width="900" height="900" viewBox="0 0 900 900" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="1400" height="900" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
/* Light theme defaults */
|
||||
.neon-blue { stroke: #4A90E2; stroke-width: 2.6; }
|
||||
.neon-orange { stroke: #F5A623; stroke-width: 2.6; }
|
||||
.neon-purple { stroke: #BD10E0; stroke-width: 2.6; }
|
||||
.neon-green { stroke: #7ED321; stroke-width: 2.6; }
|
||||
.neon-cyan { stroke: #50E3C2; stroke-width: 2.6; }
|
||||
.main-text { fill: #1a1a1a; }
|
||||
.secondary-text { fill: #666; }
|
||||
.arrow-color { stroke: #666; fill: #666; }
|
||||
|
||||
/* Dark theme with subtle neon effects */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.neon-blue {
|
||||
stroke: #00D4FF;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00D4FF) drop-shadow(0 0 8px #00A0FF);
|
||||
}
|
||||
.neon-orange {
|
||||
stroke: #FF9500;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #FF9500) drop-shadow(0 0 8px #FF7700);
|
||||
}
|
||||
.neon-purple {
|
||||
stroke: #E040FB;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #E040FB) drop-shadow(0 0 8px #D500F9);
|
||||
}
|
||||
.neon-green {
|
||||
stroke: #00FF88;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00FF88) drop-shadow(0 0 8px #00E676);
|
||||
}
|
||||
.neon-cyan {
|
||||
stroke: #00E5EA;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00E5EA) drop-shadow(0 0 8px #00BCD4);
|
||||
}
|
||||
.main-text { fill: #FFFFFF; }
|
||||
.secondary-text { fill: #B0B0B0; }
|
||||
.arrow-color { stroke: #B0B0B0; fill: #B0B0B0; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<marker id="arrow" markerWidth="13" markerHeight="13" refX="11.7" refY="3.9" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,7.8 L11.7,3.9 z" class="arrow-color"/>
|
||||
</marker>
|
||||
<marker id="arrow-small" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,6 L9,3 z" class="arrow-color"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Bootstrap Flow</text>
|
||||
<!-- Title (well separated from content) -->
|
||||
<text x="700" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="32" font-weight="600" class="main-text">Bootstrap Flow</text>
|
||||
|
||||
<!-- Start -->
|
||||
<rect x="350" y="60" width="200" height="50" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="85" text-anchor="middle" font-family="monospace" font-size="14" fill="#90CDF4">./botserver</text>
|
||||
<text x="450" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">(first run)</text>
|
||||
<!-- MAIN FLOW DIAGRAM (Upper Section) -->
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="110" x2="450" y2="140" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- OS Detection -->
|
||||
<rect x="325" y="140" width="250" height="70" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">OS Detection</text>
|
||||
<text x="450" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FED7AA">Linux/Mac/Windows</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="210" x2="450" y2="240" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Component Installation Box -->
|
||||
<rect x="100" y="240" width="700" height="180" fill="none" stroke="#4A5568" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<text x="450" y="265" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#A0AEC0">Component Installation</text>
|
||||
|
||||
<!-- Component Grid -->
|
||||
<g id="components">
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="150" y="290" width="150" height="80" fill="none" stroke="#4A90E2" stroke-width="2" rx="6"/>
|
||||
<text x="225" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#63B3ED">PostgreSQL</text>
|
||||
<text x="225" y="335" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#90CDF4">16.2</text>
|
||||
|
||||
<!-- Valkey -->
|
||||
<rect x="325" y="290" width="150" height="80" fill="none" stroke="#E53E3E" stroke-width="2" rx="6"/>
|
||||
<text x="400" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#FC8181">Valkey</text>
|
||||
<text x="400" y="335" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FEB2B2">Cache</text>
|
||||
|
||||
<!-- SeaweedFS -->
|
||||
<rect x="500" y="290" width="150" height="80" fill="none" stroke="#38A169" stroke-width="2" rx="6"/>
|
||||
<text x="575" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#48BB78">SeaweedFS</text>
|
||||
<text x="575" y="335" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">Storage</text>
|
||||
|
||||
<!-- Qdrant -->
|
||||
<rect x="675" y="290" width="125" height="80" fill="none" stroke="#38D4B2" stroke-width="2" rx="6"/>
|
||||
<text x="737" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#4FD1C5">Qdrant</text>
|
||||
<text x="737" y="335" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#81E6D9">Vectors</text>
|
||||
<!-- Phase 1: Start -->
|
||||
<g id="phase-start">
|
||||
<rect x="40" y="100" width="160" height="70" fill="none" class="neon-blue" rx="6.5"/>
|
||||
<text x="120" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="500" class="main-text">./botserver</text>
|
||||
</g>
|
||||
|
||||
<!-- Connection lines -->
|
||||
<g stroke="#888" stroke-width="1" fill="none" opacity="0.5">
|
||||
<line x1="225" y1="370" x2="225" y2="390"/>
|
||||
<line x1="400" y1="370" x2="400" y2="390"/>
|
||||
<line x1="575" y1="370" x2="575" y2="390"/>
|
||||
<line x1="737" y1="370" x2="737" y2="390"/>
|
||||
<line x1="225" y1="390" x2="737" y2="390"/>
|
||||
<line x1="450" y1="390" x2="450" y2="450"/>
|
||||
<!-- Arrow from Start to OS Detection -->
|
||||
<line x1="200" y1="135" x2="250" y2="135" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Phase 2: OS Detection -->
|
||||
<g id="phase-detection">
|
||||
<rect x="250" y="100" width="180" height="70" fill="none" class="neon-orange" rx="6.5"/>
|
||||
<text x="340" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="500" class="main-text">OS Detection</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="420" x2="450" y2="450" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<!-- Arrow from OS Detection to Component Installation -->
|
||||
<line x1="430" y1="135" x2="490" y2="135" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Configuration & Setup -->
|
||||
<rect x="200" y="450" width="500" height="120" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="475" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">Configuration & Setup</text>
|
||||
<!-- Phase 3: Component Installation -->
|
||||
<g id="phase-components">
|
||||
<!-- Label -->
|
||||
<text x="620" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" font-weight="500" class="secondary-text">Component Installation</text>
|
||||
|
||||
<g font-family="Arial, sans-serif" font-size="12" fill="#E9D8FD">
|
||||
<text x="250" y="505">• Generate credentials</text>
|
||||
<text x="250" y="525">• Create .env file</text>
|
||||
<text x="480" y="505">• Initialize databases</text>
|
||||
<text x="480" y="525">• Create storage buckets</text>
|
||||
<!-- Components in 2x2 grid with proper widths -->
|
||||
<rect x="490" y="120" width="120" height="50" fill="none" class="neon-blue" rx="5"/>
|
||||
<text x="550" y="151" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">PostgreSQL</text>
|
||||
|
||||
<rect x="630" y="120" width="120" height="50" fill="none" class="neon-purple" rx="5"/>
|
||||
<text x="690" y="151" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">Valkey</text>
|
||||
|
||||
<rect x="490" y="190" width="120" height="50" fill="none" class="neon-green" rx="5"/>
|
||||
<text x="550" y="221" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">SeaweedFS</text>
|
||||
|
||||
<rect x="630" y="190" width="120" height="50" fill="none" class="neon-cyan" rx="5"/>
|
||||
<text x="690" y="221" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="main-text">Qdrant</text>
|
||||
|
||||
<!-- Merge lines -->
|
||||
<g class="arrow-color" stroke-width="1.5" fill="none" opacity="0.5">
|
||||
<line x1="550" y1="170" x2="550" y2="180"/>
|
||||
<line x1="690" y1="170" x2="690" y2="180"/>
|
||||
<line x1="550" y1="180" x2="690" y2="180"/>
|
||||
<line x1="620" y1="180" x2="620" y2="260"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="570" x2="450" y2="600" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<!-- Arrow to Configuration -->
|
||||
<line x1="620" y1="260" x2="620" y2="330" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Bot Deployment Box -->
|
||||
<rect x="150" y="600" width="600" height="200" fill="none" stroke="#4A5568" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6"/>
|
||||
<text x="450" y="625" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#A0AEC0">Bot Deployment</text>
|
||||
<!-- Phase 4: Configuration & Setup -->
|
||||
<g id="phase-config">
|
||||
<rect x="490" y="330" width="260" height="70" fill="none" class="neon-purple" rx="6.5"/>
|
||||
<text x="620" y="375" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="500" class="main-text">Configuration & Setup</text>
|
||||
</g>
|
||||
|
||||
<!-- Deployment Steps -->
|
||||
<rect x="200" y="650" width="500" height="40" fill="none" stroke="#FBBF24" stroke-width="1" rx="6"/>
|
||||
<text x="450" y="675" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FCD34D">Scan templates/ directory</text>
|
||||
<!-- Arrow from Configuration to Bot Deployment section -->
|
||||
<line x1="750" y1="365" x2="820" y2="365" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="690" x2="450" y2="710" stroke="#888" stroke-width="1" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
<!-- Phase 5: Bot Deployment (vertical flow) -->
|
||||
<g id="phase-deployment">
|
||||
<!-- Label -->
|
||||
<text x="1030" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" font-weight="500" class="secondary-text">Bot Deployment</text>
|
||||
|
||||
<rect x="200" y="710" width="500" height="60" fill="none" stroke="#68D391" stroke-width="1" rx="6"/>
|
||||
<text x="450" y="735" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#9AE6B4">Load .gbai packages</text>
|
||||
<text x="350" y="755" font-family="monospace" font-size="11" fill="#A0AEC0">• default.gbai</text>
|
||||
<text x="500" y="755" font-family="monospace" font-size="11" fill="#A0AEC0">• announcements.gbai</text>
|
||||
<!-- Scan templates with proper width -->
|
||||
<rect x="880" y="120" width="300" height="60" fill="none" class="neon-orange" rx="6.5"/>
|
||||
<text x="1030" y="158" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" class="main-text">Scan templates/ directory</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="770" x2="450" y2="790" stroke="#888" stroke-width="1" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
<!-- Dashed arrow -->
|
||||
<line x1="1030" y1="180" x2="1030" y2="230" class="arrow-color" stroke-width="2.6" stroke-dasharray="3.9,3.9" marker-end="url(#arrow)" opacity="0.5"/>
|
||||
|
||||
<rect x="200" y="790" width="500" height="60" fill="none" stroke="#81E6D9" stroke-width="1" rx="6"/>
|
||||
<text x="450" y="815" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#B2F5EA">Upload to object storage</text>
|
||||
<text x="450" y="835" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#B2F5EA">Index documents • Register in database</text>
|
||||
<!-- Load packages with proper width -->
|
||||
<rect x="880" y="230" width="300" height="60" fill="none" class="neon-orange" rx="6.5"/>
|
||||
<text x="1030" y="268" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" class="main-text">Load .gbai packages</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="850" x2="450" y2="880" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
<!-- Arrow -->
|
||||
<line x1="1030" y1="290" x2="1030" y2="340" class="arrow-color" stroke-width="2.6" marker-end="url(#arrow)" opacity="0.7"/>
|
||||
|
||||
<!-- Start Web Server -->
|
||||
<rect x="275" y="880" width="350" height="70" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="905" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">Start Web Server</text>
|
||||
<text x="450" y="925" text-anchor="middle" font-family="monospace" font-size="12" fill="#9AE6B4">http://localhost:8080</text>
|
||||
<!-- Start Web Server -->
|
||||
<rect x="880" y="340" width="300" height="60" fill="none" class="neon-green" rx="6.5"/>
|
||||
<text x="1030" y="378" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="500" class="main-text">Start Web Server</text>
|
||||
</g>
|
||||
|
||||
<!-- PROGRESS INDICATOR (Bottom Section) -->
|
||||
<g id="process-flow">
|
||||
<!-- Large flow arrow at bottom -->
|
||||
<defs>
|
||||
<linearGradient id="flowGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||
<stop offset="0%" style="stop-color:#4A90E2;stop-opacity:0.3" />
|
||||
<stop offset="50%" style="stop-color:#BD10E0;stop-opacity:0.3" />
|
||||
<stop offset="100%" style="stop-color:#7ED321;stop-opacity:0.3" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<!-- Flow visualization bar -->
|
||||
<rect x="120" y="500" width="1060" height="80" fill="url(#flowGradient)" rx="10" opacity="0.2"/>
|
||||
|
||||
<!-- Stage indicators -->
|
||||
<circle cx="120" cy="540" r="8" class="neon-blue" fill="none"/>
|
||||
<circle cx="340" cy="540" r="8" class="neon-orange" fill="none"/>
|
||||
<circle cx="620" cy="540" r="8" class="neon-purple" fill="none"/>
|
||||
<circle cx="1030" cy="540" r="8" class="neon-green" fill="none"/>
|
||||
|
||||
<!-- Connecting lines -->
|
||||
<line x1="128" y1="540" x2="332" y2="540" class="arrow-color" stroke-width="2" opacity="0.4"/>
|
||||
<line x1="348" y1="540" x2="612" y2="540" class="arrow-color" stroke-width="2" opacity="0.4"/>
|
||||
<line x1="628" y1="540" x2="1022" y2="540" class="arrow-color" stroke-width="2" opacity="0.4"/>
|
||||
|
||||
<!-- Stage labels -->
|
||||
<text x="120" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Start</text>
|
||||
<text x="340" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Detect</text>
|
||||
<text x="620" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Install & Configure</text>
|
||||
<text x="1030" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">Deploy</text>
|
||||
</g>
|
||||
|
||||
<!-- Description text (well-spaced at bottom) -->
|
||||
<text x="700" y="720" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" class="secondary-text">
|
||||
Automatic bootstrap process: detect OS, install components, configure, and deploy
|
||||
</text>
|
||||
<text x="700" y="755" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" class="secondary-text">
|
||||
Zero configuration required - everything runs from a single binary
|
||||
</text>
|
||||
|
||||
<!-- Optional: Add subtle grid/connection lines in background -->
|
||||
<g opacity="0.05" class="arrow-color">
|
||||
<line x1="120" y1="170" x2="120" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
<line x1="340" y1="170" x2="340" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
<line x1="620" y1="240" x2="620" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
<line x1="1030" y1="400" x2="1030" y2="500" stroke-width="1" stroke-dasharray="2,4"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 9.3 KiB |
142
docs/src/chapter-01/assets/quick-start-bootstrap.svg.backup
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 980" 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="980" 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)">Bootstrap Flow</text>
|
||||
|
||||
<!-- Start -->
|
||||
<rect x="350" y="60" width="200" height="50" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#4B5563" filter="url(#textShadow)">./botserver</text>
|
||||
<text x="450" y="100" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">(first run)</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="110" x2="450" y2="140" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- OS Detection -->
|
||||
<rect x="325" y="140" width="250" height="70" fill="none" stroke="#EA580C" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">OS Detection</text>
|
||||
<text x="450" y="185" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Linux/Mac/Windows</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="210" x2="450" y2="240" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Component Installation Box -->
|
||||
<rect x="100" y="240" width="700" height="180" fill="none" stroke="#2563EB" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6" filter="url(#shadow)"/>
|
||||
<text x="450" y="265" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Component Installation</text>
|
||||
|
||||
<!-- Component Grid -->
|
||||
<g id="components">
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="150" y="290" width="150" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="225" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">PostgreSQL</text>
|
||||
<text x="225" y="335" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">16.2</text>
|
||||
|
||||
<!-- Valkey -->
|
||||
<rect x="325" y="290" width="150" height="80" fill="none" stroke="#DC2626" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="400" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Valkey</text>
|
||||
<text x="400" y="335" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Cache</text>
|
||||
|
||||
<!-- SeaweedFS -->
|
||||
<rect x="500" y="290" width="150" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="575" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">SeaweedFS</text>
|
||||
<text x="575" y="335" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Storage</text>
|
||||
|
||||
<!-- Qdrant -->
|
||||
<rect x="675" y="290" width="125" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="737" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Qdrant</text>
|
||||
<text x="737" y="335" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Vectors</text>
|
||||
</g>
|
||||
|
||||
<!-- Connection lines -->
|
||||
<g stroke="#6B7280" stroke-width="2" fill="none" opacity="0.5">
|
||||
<line x1="225" y1="370" x2="225" y2="390">
|
||||
<line x1="400" y1="370" x2="400" y2="390">
|
||||
<line x1="575" y1="370" x2="575" y2="390">
|
||||
<line x1="737" y1="370" x2="737" y2="390">
|
||||
<line x1="225" y1="390" x2="737" y2="390">
|
||||
<line x1="450" y1="390" x2="450" y2="450">
|
||||
</g>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="420" x2="450" y2="450" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Configuration & Setup -->
|
||||
<rect x="200" y="450" width="500" height="120" fill="none" stroke="#7C3AED" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="475" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Configuration & Setup</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="250" y="505" filter="url(#textShadow)">• Generate credentials</text>
|
||||
<text x="250" y="525" filter="url(#textShadow)">• Create .env file</text>
|
||||
<text x="480" y="505" filter="url(#textShadow)">• Initialize databases</text>
|
||||
<text x="480" y="525" filter="url(#textShadow)">• Create storage buckets</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="570" x2="450" y2="600" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Bot Deployment Box -->
|
||||
<rect x="150" y="600" width="600" height="200" fill="none" stroke="#2563EB" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6" filter="url(#shadow)"/>
|
||||
<text x="450" y="625" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Bot Deployment</text>
|
||||
|
||||
<!-- Deployment Steps -->
|
||||
<rect x="200" y="650" width="500" height="40" fill="none" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="450" y="675" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Scan templates/ directory</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="690" x2="450" y2="710" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)" opacity="0.7">
|
||||
|
||||
<rect x="200" y="710" width="500" height="60" fill="none" stroke="#059669" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="450" y="735" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Load .gbai packages</text>
|
||||
<text x="350" y="755" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• default.gbai</text>
|
||||
<text x="500" y="755" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• announcements.gbai</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="770" x2="450" y2="790" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)" opacity="0.7">
|
||||
|
||||
<rect x="200" y="790" width="500" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="450" y="815" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Upload to object storage</text>
|
||||
<text x="450" y="835" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Index documents • Register in database</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="850" x2="450" y2="880" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Start Web Server -->
|
||||
<rect x="275" y="880" width="350" height="70" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="905" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Start Web Server</text>
|
||||
<text x="450" y="925" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">http://localhost:8080</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#4B5563"/>
|
||||
</marker>
|
||||
<marker id="arrow-double" markerWidth="10" markerHeight="10" refX="5" refY="3" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,6 L5,3 z" fill="#999"/>
|
||||
|
|
@ -10,15 +10,15 @@
|
|||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Session Manager Architecture</text>
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="bold" fill="#1F2937">Session Manager Architecture</text>
|
||||
|
||||
<!-- User Input -->
|
||||
<rect x="50" y="60" width="150" height="50" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="125" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">User Input</text>
|
||||
<text x="125" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1E40AF">User Input</text>
|
||||
|
||||
<!-- Bot Response -->
|
||||
<rect x="600" y="60" width="150" height="50" fill="none" stroke="#68D391" stroke-width="2" rx="8"/>
|
||||
<text x="675" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#9AE6B4">Bot Response</text>
|
||||
<text x="675" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#10B981">Bot Response</text>
|
||||
|
||||
<!-- Arrows down from User Input and up to Bot Response -->
|
||||
<line x1="125" y1="110" x2="125" y2="150" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
|
@ -26,12 +26,12 @@
|
|||
|
||||
<!-- WebSocket/HTTP boxes -->
|
||||
<rect x="50" y="150" width="150" height="60" fill="none" stroke="#F6AD55" stroke-width="2" rx="6"/>
|
||||
<text x="125" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#FBD38D">WebSocket</text>
|
||||
<text x="125" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FED7AA">/HTTP</text>
|
||||
<text x="125" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EA580C">WebSocket</text>
|
||||
<text x="125" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#FED7AA">/HTTP</text>
|
||||
|
||||
<rect x="600" y="150" width="150" height="60" fill="none" stroke="#F6AD55" stroke-width="2" rx="6"/>
|
||||
<text x="675" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#FBD38D">WebSocket</text>
|
||||
<text x="675" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FED7AA">/HTTP</text>
|
||||
<text x="675" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EA580C">WebSocket</text>
|
||||
<text x="675" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#FED7AA">/HTTP</text>
|
||||
|
||||
<!-- Arrows to/from Session Manager -->
|
||||
<line x1="125" y1="210" x2="125" y2="250" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
|
@ -39,10 +39,10 @@
|
|||
|
||||
<!-- Session Manager Box -->
|
||||
<rect x="100" y="250" width="600" height="130" fill="none" stroke="#B794F4" stroke-width="3" rx="10"/>
|
||||
<text x="400" y="280" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#D6BCFA">Session Manager</text>
|
||||
<text x="400" y="280" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#9333EA">Session Manager</text>
|
||||
|
||||
<!-- Session Manager Steps -->
|
||||
<g font-family="Arial, sans-serif" font-size="12" fill="#E9D8FD">
|
||||
<g font-family="Arial, sans-serif" font-size="18" fill="#7C3AED">
|
||||
<text x="150" y="310">1. Validate Token</text>
|
||||
<text x="150" y="330">2. Load Session</text>
|
||||
<text x="150" y="350">3. Update State</text>
|
||||
|
|
@ -58,20 +58,20 @@
|
|||
|
||||
<!-- Database boxes -->
|
||||
<rect x="150" y="420" width="200" height="80" fill="none" stroke="#E53E3E" stroke-width="2" rx="8"/>
|
||||
<text x="250" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">Valkey</text>
|
||||
<text x="250" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FEB2B2">(Cache)</text>
|
||||
<text x="250" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EF4444">Valkey</text>
|
||||
<text x="250" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#DC2626">(Cache)</text>
|
||||
|
||||
<rect x="450" y="420" width="200" height="80" fill="none" stroke="#4A90E2" stroke-width="2" rx="8"/>
|
||||
<text x="550" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#63B3ED">PostgreSQL</text>
|
||||
<text x="550" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#90CDF4">(Persist)</text>
|
||||
<text x="550" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#2563EB">PostgreSQL</text>
|
||||
<text x="550" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1E40AF">(Persist)</text>
|
||||
|
||||
<!-- Sync arrow between databases -->
|
||||
<path d="M 350 460 L 450 460" stroke="#888" stroke-width="2" marker-end="url(#arrow-double)" stroke-dasharray="5,5" opacity="0.7"/>
|
||||
<text x="400" y="455" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Sync Every</text>
|
||||
<text x="400" y="475" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Message</text>
|
||||
<text x="400" y="455" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">Sync Every</text>
|
||||
<text x="400" y="475" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">Message</text>
|
||||
|
||||
<!-- Process Flow Numbers -->
|
||||
<g font-family="Arial, sans-serif" font-size="10" fill="#718096">
|
||||
<g font-family="Arial, sans-serif" font-size="16" fill="#374151">
|
||||
<circle cx="125" cy="130" r="12" fill="none" stroke="#718096" stroke-width="1"/>
|
||||
<text x="125" y="134" text-anchor="middle">1</text>
|
||||
|
||||
|
|
@ -91,9 +91,9 @@
|
|||
<!-- Features box -->
|
||||
<g id="features" transform="translate(50, 520)">
|
||||
<rect x="0" y="0" width="700" height="60" fill="none" stroke="#4A5568" stroke-width="1" rx="5" stroke-dasharray="2,2" opacity="0.5"/>
|
||||
<text x="350" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Key Features</text>
|
||||
<text x="350" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#1F2937">Key Features</text>
|
||||
|
||||
<g font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">
|
||||
<g font-family="Arial, sans-serif" font-size="16" fill="#374151">
|
||||
<text x="50" y="45">• Real-time WebSocket support</text>
|
||||
<text x="250" y="45">• Automatic session persistence</text>
|
||||
<text x="450" y="45">• Redis-compatible caching</text>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 6.1 KiB |
130
docs/src/chapter-01/assets/session-manager.svg.backup
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?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="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Session Manager Architecture</text>
|
||||
|
||||
<!-- User Input -->
|
||||
<rect x="50" y="60" width="150" height="50" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="125" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">User Input</text>
|
||||
|
||||
<!-- Bot Response -->
|
||||
<rect x="600" y="60" width="150" height="50" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="675" 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 Response</text>
|
||||
|
||||
<!-- Arrows down from User Input and up to Bot Response -->
|
||||
<line x1="125" y1="110" x2="125" y2="150" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<line x1="675" y1="150" x2="675" y2="110" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- WebSocket/HTTP boxes -->
|
||||
<rect x="50" y="150" width="150" height="60" fill="none" stroke="#EA580C" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="125" y="175" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">WebSocket</text>
|
||||
<text x="125" y="195" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">/HTTP</text>
|
||||
|
||||
<rect x="600" y="150" width="150" height="60" fill="none" stroke="#EA580C" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="675" y="175" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">WebSocket</text>
|
||||
<text x="675" y="195" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">/HTTP</text>
|
||||
|
||||
<!-- Arrows to/from Session Manager -->
|
||||
<line x1="125" y1="210" x2="125" y2="250" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<line x1="675" y1="250" x2="675" y2="210" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Session Manager Box -->
|
||||
<rect x="100" y="250" width="600" height="130" fill="none" stroke="#7C3AED" stroke-width="2" rx="10" filter="url(#shadow)"/>
|
||||
<text x="400" y="280" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Session Manager</text>
|
||||
|
||||
<!-- Session Manager Steps -->
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="150" y="310" filter="url(#textShadow)">1. Validate Token</text>
|
||||
<text x="150" y="330" filter="url(#textShadow)">2. Load Session</text>
|
||||
<text x="150" y="350" filter="url(#textShadow)">3. Update State</text>
|
||||
|
||||
<text x="450" y="310" filter="url(#textShadow)">4. Execute BASIC</text>
|
||||
<text x="450" y="330" filter="url(#textShadow)">5. Generate Response</text>
|
||||
<text x="450" y="350" filter="url(#textShadow)">6. Save History</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrows down to databases -->
|
||||
<line x1="250" y1="380" x2="250" y2="420" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
<line x1="550" y1="380" x2="550" y2="420" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- Database boxes -->
|
||||
<rect x="150" y="420" width="200" height="80" fill="none" stroke="#DC2626" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="250" y="450" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Valkey</text>
|
||||
<text x="250" y="470" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">(Cache)</text>
|
||||
|
||||
<rect x="450" y="420" width="200" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="550" y="450" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">PostgreSQL</text>
|
||||
<text x="550" y="470" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">(Persist)</text>
|
||||
|
||||
<!-- Sync arrow between databases -->
|
||||
<path d="M 350 460 L 450 460" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow-double)" stroke-dasharray="5,5" opacity="0.7">
|
||||
<text x="400" y="455" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Sync Every</text>
|
||||
<text x="400" y="475" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Message</text>
|
||||
|
||||
<!-- Process Flow Numbers -->
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<circle cx="125" cy="130" r="12" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="125" y="134" text-anchor="middle" filter="url(#textShadow)">1</text>
|
||||
|
||||
<circle cx="125" cy="230" r="12" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="125" y="234" text-anchor="middle" filter="url(#textShadow)">2</text>
|
||||
|
||||
<circle cx="400" cy="315" r="12" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="400" y="319" text-anchor="middle" filter="url(#textShadow)">3</text>
|
||||
|
||||
<circle cx="675" cy="230" r="12" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="675" y="234" text-anchor="middle" filter="url(#textShadow)">4</text>
|
||||
|
||||
<circle cx="675" cy="130" r="12" fill="none" stroke="#2563EB" stroke-width="2">
|
||||
<text x="675" y="134" text-anchor="middle" filter="url(#textShadow)">5</text>
|
||||
</g>
|
||||
|
||||
<!-- Features box -->
|
||||
<g id="features" transform="translate(50, 520)">
|
||||
<rect x="0" y="0" width="700" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="5" stroke-dasharray="2,2" opacity="0.5" filter="url(#shadow)"/>
|
||||
<text x="350" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Key Features</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="50" y="45" filter="url(#textShadow)">• Real-time WebSocket support</text>
|
||||
<text x="250" y="45" filter="url(#textShadow)">• Automatic session persistence</text>
|
||||
<text x="450" y="45" filter="url(#textShadow)">• Redis-compatible caching</text>
|
||||
<text x="600" y="45" filter="url(#textShadow)">• ACID compliance</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
|
@ -1,75 +1,75 @@
|
|||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#4B5563"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="300" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Session State Flow</text>
|
||||
<text x="300" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="bold" fill="#1F2937">Session State Flow</text>
|
||||
|
||||
<!-- Browser Opens -->
|
||||
<rect x="200" y="60" width="200" height="50" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">Browser</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#CBD5E0">Opens</text>
|
||||
<text x="300" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1E40AF">Browser</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1F2937">Opens</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="110" x2="300" y2="150" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- CREATE State -->
|
||||
<rect x="200" y="150" width="200" height="80" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">CREATE</text>
|
||||
<text x="300" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#9AE6B4">New UUID</text>
|
||||
<text x="300" y="210" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#9AE6B4">Token Gen</text>
|
||||
<text x="300" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#059669">CREATE</text>
|
||||
<text x="300" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#10B981">New UUID</text>
|
||||
<text x="300" y="210" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#10B981">Token Gen</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="230" x2="300" y2="270" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- ACTIVE State -->
|
||||
<rect x="200" y="270" width="200" height="80" fill="none" stroke="#4299E1" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="295" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#63B3ED">ACTIVE</text>
|
||||
<text x="300" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#90CDF4">Chatting</text>
|
||||
<text x="300" y="330" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#90CDF4">Messages</text>
|
||||
<text x="300" y="295" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#2563EB">ACTIVE</text>
|
||||
<text x="300" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1E40AF">Chatting</text>
|
||||
<text x="300" y="330" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1E40AF">Messages</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="350" x2="300" y2="390" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- IDLE State -->
|
||||
<rect x="200" y="390" width="200" height="80" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="415" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">IDLE</text>
|
||||
<text x="300" y="435" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FED7AA">No Input</text>
|
||||
<text x="300" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FED7AA">30min Timer</text>
|
||||
<text x="300" y="415" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EA580C">IDLE</text>
|
||||
<text x="300" y="435" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#FED7AA">No Input</text>
|
||||
<text x="300" y="450" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#FED7AA">30min Timer</text>
|
||||
|
||||
<!-- User Returns Loop -->
|
||||
<path d="M 400 430 Q 480 360 480 310 Q 480 260 400 310"
|
||||
stroke="#888" stroke-width="2" fill="none" marker-end="url(#arrow)" stroke-dasharray="5,5" opacity="0.7"/>
|
||||
<text x="490" y="360" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">User Returns</text>
|
||||
<text x="490" y="360" font-family="Arial, sans-serif" font-size="16" fill="#374151">User Returns</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="470" x2="300" y2="510" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- EXPIRE State -->
|
||||
<rect x="200" y="510" width="200" height="80" fill="none" stroke="#FC8181" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="535" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">EXPIRE</text>
|
||||
<text x="300" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FEB2B2">7d Anon</text>
|
||||
<text x="300" y="570" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FEB2B2">Never Auth</text>
|
||||
<text x="300" y="535" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EF4444">EXPIRE</text>
|
||||
<text x="300" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#DC2626">7d Anon</text>
|
||||
<text x="300" y="570" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#DC2626">Never Auth</text>
|
||||
|
||||
<!-- Retry Loop -->
|
||||
<path d="M 200 550 Q 120 400 120 200 Q 120 150 200 190"
|
||||
stroke="#888" stroke-width="2" fill="none" marker-end="url(#arrow)" stroke-dasharray="5,5" opacity="0.7"/>
|
||||
<text x="90" y="360" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Retry</text>
|
||||
<text x="90" y="360" font-family="Arial, sans-serif" font-size="16" fill="#374151">Retry</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="590" x2="300" y2="630" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- CLEANUP State -->
|
||||
<rect x="200" y="630" width="200" height="80" fill="none" stroke="#718096" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="655" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#A0AEC0">CLEANUP</text>
|
||||
<text x="300" y="675" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#CBD5E0">Archive</text>
|
||||
<text x="300" y="690" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#CBD5E0">Delete</text>
|
||||
<text x="300" y="655" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#374151">CLEANUP</text>
|
||||
<text x="300" y="675" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1F2937">Archive</text>
|
||||
<text x="300" y="690" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1F2937">Delete</text>
|
||||
|
||||
<!-- State Duration Labels -->
|
||||
<g id="durations" font-family="Arial, sans-serif" font-size="10" fill="#718096">
|
||||
<g id="durations" font-family="Arial, sans-serif" font-size="16" fill="#374151">
|
||||
<text x="420" y="195" text-anchor="start">Instant</text>
|
||||
<text x="420" y="315" text-anchor="start">Active use</text>
|
||||
<text x="420" y="435" text-anchor="start">30 minutes</text>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
108
docs/src/chapter-01/assets/session-states.svg.backup
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?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="300" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Session State Flow</text>
|
||||
|
||||
<!-- Browser Opens -->
|
||||
<rect x="200" y="60" width="200" height="50" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Browser</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Opens</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="110" x2="300" y2="150" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- CREATE State -->
|
||||
<rect x="200" y="150" width="200" height="80" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="175" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">CREATE</text>
|
||||
<text x="300" y="195" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">New UUID</text>
|
||||
<text x="300" y="210" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Token Gen</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="230" x2="300" y2="270" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- ACTIVE State -->
|
||||
<rect x="200" y="270" width="200" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="295" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">ACTIVE</text>
|
||||
<text x="300" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Chatting</text>
|
||||
<text x="300" y="330" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Messages</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="350" x2="300" y2="390" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- IDLE State -->
|
||||
<rect x="200" y="390" width="200" height="80" fill="none" stroke="#EA580C" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="415" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">IDLE</text>
|
||||
<text x="300" y="435" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">No Input</text>
|
||||
<text x="300" y="450" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">30min Timer</text>
|
||||
|
||||
<!-- User Returns Loop -->
|
||||
<path d="M 400 430 Q 480 360 480 310 Q 480 260 400 310" stroke="#6B7280" stroke-width="2" fill="none" marker-end="url(#arrow)" stroke-dasharray="5,5" opacity="0.7">
|
||||
<text x="490" y="360" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">User Returns</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="470" x2="300" y2="510" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- EXPIRE State -->
|
||||
<rect x="200" y="510" width="200" height="80" fill="none" stroke="#DC2626" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="535" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">EXPIRE</text>
|
||||
<text x="300" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">7d Anon</text>
|
||||
<text x="300" y="570" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Never Auth</text>
|
||||
|
||||
<!-- Retry Loop -->
|
||||
<path d="M 200 550 Q 120 400 120 200 Q 120 150 200 190" stroke="#6B7280" stroke-width="2" fill="none" marker-end="url(#arrow)" stroke-dasharray="5,5" opacity="0.7">
|
||||
<text x="90" y="360" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Retry</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="590" x2="300" y2="630" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- CLEANUP State -->
|
||||
<rect x="200" y="630" width="200" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="655" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">CLEANUP</text>
|
||||
<text x="300" y="675" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Archive</text>
|
||||
<text x="300" y="690" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Delete</text>
|
||||
|
||||
<!-- State Duration Labels -->
|
||||
<g id="durations" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="420" y="195" text-anchor="start" filter="url(#textShadow)">Instant</text>
|
||||
<text x="420" y="315" text-anchor="start" filter="url(#textShadow)">Active use</text>
|
||||
<text x="420" y="435" text-anchor="start" filter="url(#textShadow)">30 minutes</text>
|
||||
<text x="420" y="555" text-anchor="start" filter="url(#textShadow)">7 days / Never</text>
|
||||
<text x="420" y="675" text-anchor="start" filter="url(#textShadow)">Permanent</text>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.9 KiB |
|
|
@ -1,37 +1,37 @@
|
|||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#4B5563"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="350" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Tool Execution Flow</text>
|
||||
<text x="350" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="bold" fill="#1F2937">Tool Execution Flow</text>
|
||||
|
||||
<!-- User Input -->
|
||||
<rect x="200" y="60" width="300" height="50" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="350" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" fill="#90CDF4">User: "I want to enroll in</text>
|
||||
<text x="350" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" fill="#90CDF4">Computer Science"</text>
|
||||
<text x="350" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" fill="#1E40AF">User: "I want to enroll in</text>
|
||||
<text x="350" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" fill="#1E40AF">Computer Science"</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="350" y1="110" x2="350" y2="140" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- LLM Analyzes -->
|
||||
<rect x="225" y="140" width="250" height="80" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<text x="350" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">LLM Analyzes</text>
|
||||
<text x="350" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#E9D8FD">"enrollment need"</text>
|
||||
<text x="350" y="200" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Intent detection</text>
|
||||
<text x="350" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#9333EA">LLM Analyzes</text>
|
||||
<text x="350" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#7C3AED">"enrollment need"</text>
|
||||
<text x="350" y="200" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">Intent detection</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="350" y1="220" x2="350" y2="250" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Scan Available Tools -->
|
||||
<rect x="175" y="250" width="350" height="100" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
|
||||
<text x="350" y="275" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">Scan Available Tools</text>
|
||||
<text x="350" y="275" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EA580C">Scan Available Tools</text>
|
||||
|
||||
<g font-family="monospace" font-size="12">
|
||||
<text x="220" y="305" fill="#68D391">• enrollment.bas ✓</text>
|
||||
<text x="220" y="325" fill="#A0AEC0">• other-tools.bas</text>
|
||||
<g font-family="monospace" font-size="18">
|
||||
<text x="220" y="305" fill="#059669">• enrollment.bas ✓</text>
|
||||
<text x="220" y="325" fill="#374151">• other-tools.bas</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow down -->
|
||||
|
|
@ -39,9 +39,9 @@
|
|||
|
||||
<!-- Collect Parameters -->
|
||||
<rect x="175" y="380" width="350" height="120" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8"/>
|
||||
<text x="350" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">Collect Parameters</text>
|
||||
<text x="350" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#0891B2">Collect Parameters</text>
|
||||
|
||||
<g font-family="Arial, sans-serif" font-size="12" fill="#B2F5EA">
|
||||
<g font-family="Arial, sans-serif" font-size="18" fill="#0E7490">
|
||||
<text x="220" y="435">• name: (ask user)</text>
|
||||
<text x="220" y="455">• email: (ask user)</text>
|
||||
<text x="220" y="475">• course: "Comp Sci"</text>
|
||||
|
|
@ -52,9 +52,9 @@
|
|||
|
||||
<!-- Execute enrollment.bas -->
|
||||
<rect x="175" y="530" width="350" height="100" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<text x="350" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">Execute enrollment.bas</text>
|
||||
<text x="350" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#059669">Execute enrollment.bas</text>
|
||||
|
||||
<g font-family="Arial, sans-serif" font-size="12" fill="#9AE6B4">
|
||||
<g font-family="Arial, sans-serif" font-size="18" fill="#10B981">
|
||||
<text x="220" y="585">• Save to CSV</text>
|
||||
<text x="220" y="605">• Return confirmation</text>
|
||||
</g>
|
||||
|
|
@ -64,11 +64,11 @@
|
|||
|
||||
<!-- Bot Response -->
|
||||
<rect x="175" y="660" width="350" height="60" fill="none" stroke="#68D391" stroke-width="2" rx="8"/>
|
||||
<text x="350" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" fill="#9AE6B4">"Welcome to Computer Science!"</text>
|
||||
<text x="350" y="705" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">Confirmation sent to user</text>
|
||||
<text x="350" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" fill="#10B981">"Welcome to Computer Science!"</text>
|
||||
<text x="350" y="705" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">Confirmation sent to user</text>
|
||||
|
||||
<!-- Side annotations -->
|
||||
<g font-family="Arial, sans-serif" font-size="10" fill="#718096">
|
||||
<g font-family="Arial, sans-serif" font-size="16" fill="#374151">
|
||||
<!-- Time indicators -->
|
||||
<text x="50" y="180" text-anchor="end">~100ms</text>
|
||||
<text x="50" y="300" text-anchor="end">~50ms</text>
|
||||
|
|
@ -93,9 +93,9 @@
|
|||
<!-- Tool example box -->
|
||||
<g id="tool-example" transform="translate(50, 740)">
|
||||
<rect x="0" y="0" width="600" height="120" fill="none" stroke="#4A5568" stroke-width="1" rx="5" stroke-dasharray="2,2" opacity="0.5"/>
|
||||
<text x="300" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">enrollment.bas</text>
|
||||
<text x="300" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#1F2937">enrollment.bas</text>
|
||||
|
||||
<g font-family="monospace" font-size="11" fill="#A0AEC0">
|
||||
<g font-family="monospace" font-size="16" fill="#374151">
|
||||
<text x="20" y="45">' Student enrollment tool</text>
|
||||
<text x="20" y="65">PARAM name, email, course</text>
|
||||
<text x="20" y="85">SAVE "enrollments.csv", name, email, course, NOW()</text>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
150
docs/src/chapter-01/assets/tool-execution-flow.svg.backup
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 900 1000" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<!-- Arrow markers -->
|
||||
<marker id="arrow" markerWidth="12" markerHeight="12" refX="11" refY="6" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,12 L12,6 z" fill="#2563EB"/>
|
||||
</marker>
|
||||
|
||||
<!-- Gradient definitions -->
|
||||
<linearGradient id="blueGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#3B82F6;stop-opacity:0.1" />
|
||||
<stop offset="100%" style="stop-color:#2563EB;stop-opacity:0.05" />
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="greenGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#10B981;stop-opacity:0.1" />
|
||||
<stop offset="100%" style="stop-color:#059669;stop-opacity:0.05" />
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="purpleGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#8B5CF6;stop-opacity:0.1" />
|
||||
<stop offset="100%" style="stop-color:#7C3AED;stop-opacity:0.05" />
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="orangeGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#F97316;stop-opacity:0.1" />
|
||||
<stop offset="100%" style="stop-color:#EA580C;stop-opacity:0.05" />
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="tealGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#06B6D4;stop-opacity:0.1" />
|
||||
<stop offset="100%" style="stop-color:#0891B2;stop-opacity:0.05" />
|
||||
</linearGradient>
|
||||
|
||||
<!-- Drop shadow -->
|
||||
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="3"/>
|
||||
<feOffset dx="2" dy="2" result="offsetblur"/>
|
||||
<feComponentTransfer>
|
||||
<feFuncA type="linear" slope="0.15"/>
|
||||
</feComponentTransfer>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
</defs>
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="900" height="1000" fill="#FAFAFA"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="40" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="24" font-weight="700" fill="#1F2937">Tool Execution Flow</text>
|
||||
<text x="450" y="65" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#6B7280">How the bot understands and executes user commands</text>
|
||||
|
||||
<!-- Step 1: User Input -->
|
||||
<rect x="200" y="100" width="500" height="80" fill="url(#blueGradient)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="130" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#2563EB">1. User Input</text>
|
||||
<text x="450" y="155" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">"I want to enroll in Computer Science"</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="180" x2="450" y2="220" stroke="#2563EB" stroke-width="3" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Step 2: LLM Analysis -->
|
||||
<rect x="200" y="220" width="500" height="100" fill="url(#purpleGradient)" stroke="#7C3AED" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="250" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#7C3AED">2. LLM Analyzes Intent</text>
|
||||
<text x="450" y="275" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">Detects: "enrollment request"</text>
|
||||
<text x="450" y="300" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#6B7280">Natural language understanding</text>
|
||||
|
||||
<!-- Time indicator -->
|
||||
<rect x="720" y="255" width="80" height="30" fill="#F3F4F6" rx="15"/>
|
||||
<text x="760" y="275" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#6B7280">~100ms</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="320" x2="450" y2="360" stroke="#7C3AED" stroke-width="3" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Step 3: Scan Available Tools -->
|
||||
<rect x="150" y="360" width="600" height="120" fill="url(#orangeGradient)" stroke="#EA580C" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="390" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#EA580C">3. Scan Available Tools</text>
|
||||
|
||||
<g transform="translate(250, 415)">
|
||||
<rect x="0" y="0" width="180" height="40" fill="#059669" fill-opacity="0.1" stroke="#059669" stroke-width="2" rx="6"/>
|
||||
<text x="90" y="26" text-anchor="middle" font-family="monospace" font-size="16" font-weight="600" fill="#059669">✓ enrollment.bas</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(470, 415)">
|
||||
<rect x="0" y="0" width="180" height="40" fill="#6B7280" fill-opacity="0.1" stroke="#6B7280" stroke-width="1" rx="6" stroke-dasharray="4,2"/>
|
||||
<text x="90" y="26" text-anchor="middle" font-family="monospace" font-size="16" fill="#6B7280">other-tools.bas</text>
|
||||
</g>
|
||||
|
||||
<!-- Time indicator -->
|
||||
<rect x="720" y="395" width="80" height="30" fill="#F3F4F6" rx="15"/>
|
||||
<text x="760" y="415" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#6B7280">~50ms</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="480" x2="450" y2="520" stroke="#EA580C" stroke-width="3" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Step 4: Collect Parameters -->
|
||||
<rect x="150" y="520" width="600" height="140" fill="url(#tealGradient)" stroke="#0891B2" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="550" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#0891B2">4. Collect Parameters</text>
|
||||
|
||||
<g transform="translate(200, 570)">
|
||||
<rect x="0" y="0" width="500" height="70" fill="white" stroke="#E5E7EB" stroke-width="1" rx="6"/>
|
||||
<text x="20" y="30" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">• Name: </text>
|
||||
<text x="100" y="30" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#6B7280">(ask user)</text>
|
||||
<text x="20" y="50" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">• Email: </text>
|
||||
<text x="100" y="50" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#6B7280">(ask user)</text>
|
||||
<text x="250" y="30" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">• Course: </text>
|
||||
<text x="340" y="30" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#059669">"Computer Science"</text>
|
||||
</g>
|
||||
|
||||
<!-- Time indicator -->
|
||||
<rect x="720" y="575" width="100" height="30" fill="#F3F4F6" rx="15"/>
|
||||
<text x="770" y="595" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#6B7280">Interactive</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="660" x2="450" y2="700" stroke="#0891B2" stroke-width="3" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Step 5: Execute Script -->
|
||||
<rect x="150" y="700" width="600" height="120" fill="url(#greenGradient)" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="730" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#059669">5. Execute enrollment.bas</text>
|
||||
|
||||
<g transform="translate(250, 750)">
|
||||
<circle cx="15" cy="15" r="8" fill="#059669"/>
|
||||
<path d="M10,15 L13,18 L20,11" stroke="white" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<text x="35" y="20" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">Save to enrollments.csv</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(250, 780)">
|
||||
<circle cx="15" cy="15" r="8" fill="#059669"/>
|
||||
<path d="M10,15 L13,18 L20,11" stroke="white" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<text x="35" y="20" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">Generate confirmation</text>
|
||||
</g>
|
||||
|
||||
<!-- Time indicator -->
|
||||
<rect x="720" y="745" width="80" height="30" fill="#F3F4F6" rx="15"/>
|
||||
<text x="760" y="765" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#6B7280">~200ms</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="450" y1="820" x2="450" y2="860" stroke="#059669" stroke-width="3" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- Step 6: Bot Response -->
|
||||
<rect x="200" y="860" width="500" height="80" fill="#059669" fill-opacity="0.1" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="450" y="890" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#059669">6. Bot Response</text>
|
||||
<text x="450" y="915" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" fill="#1F2937">"Welcome to Computer Science, John!"</text>
|
||||
|
||||
<!-- Time indicator -->
|
||||
<rect x="720" y="885" width="80" height="30" fill="#F3F4F6" rx="15"/>
|
||||
<text x="760" y="905" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#6B7280">Instant</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.1 KiB |
|
|
@ -1,17 +1,17 @@
|
|||
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#4B5563"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Package Structure</text>
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="bold" fill="#1F2937">Package Structure</text>
|
||||
|
||||
<!-- Root Package -->
|
||||
<rect x="300" y="60" width="200" height="50" fill="none" stroke="#4299E1" stroke-width="2" rx="8"/>
|
||||
<text x="400" y="85" text-anchor="middle" font-family="monospace" font-size="14" font-weight="bold" fill="#63B3ED">my-bot.gbai/</text>
|
||||
<text x="400" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#90CDF4">(Package Root)</text>
|
||||
<text x="400" y="85" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#2563EB">my-bot.gbai/</text>
|
||||
<text x="400" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1E40AF">(Package Root)</text>
|
||||
|
||||
<!-- Connection Lines from Root -->
|
||||
<g stroke="#888" stroke-width="1" fill="none">
|
||||
|
|
@ -31,33 +31,33 @@
|
|||
<g id="folders">
|
||||
<!-- .gbdialog -->
|
||||
<rect x="70" y="180" width="160" height="80" fill="none" stroke="#F6AD55" stroke-width="2" rx="6"/>
|
||||
<text x="150" y="205" text-anchor="middle" font-family="monospace" font-size="13" font-weight="bold" fill="#FBD38D">.gbdialog</text>
|
||||
<text x="150" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FED7AA">Dialog Scripts</text>
|
||||
<text x="150" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">Conversation Logic</text>
|
||||
<text x="150" y="205" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#EA580C">.gbdialog</text>
|
||||
<text x="150" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#FED7AA">Dialog Scripts</text>
|
||||
<text x="150" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">Conversation Logic</text>
|
||||
|
||||
<!-- .gbkb -->
|
||||
<rect x="200" y="180" width="160" height="80" fill="none" stroke="#4FD1C5" stroke-width="2" rx="6"/>
|
||||
<text x="280" y="205" text-anchor="middle" font-family="monospace" font-size="13" font-weight="bold" fill="#81E6D9">.gbkb</text>
|
||||
<text x="280" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#B2F5EA">Knowledge Base</text>
|
||||
<text x="280" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">Documents</text>
|
||||
<text x="280" y="205" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#0891B2">.gbkb</text>
|
||||
<text x="280" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#0E7490">Knowledge Base</text>
|
||||
<text x="280" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">Documents</text>
|
||||
|
||||
<!-- .gbot -->
|
||||
<rect x="320" y="180" width="160" height="80" fill="none" stroke="#B794F4" stroke-width="2" rx="6"/>
|
||||
<text x="400" y="205" text-anchor="middle" font-family="monospace" font-size="13" font-weight="bold" fill="#D6BCFA">.gbot</text>
|
||||
<text x="400" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">Configuration</text>
|
||||
<text x="400" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">Bot Settings</text>
|
||||
<text x="400" y="205" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#9333EA">.gbot</text>
|
||||
<text x="400" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C3AED">Configuration</text>
|
||||
<text x="400" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">Bot Settings</text>
|
||||
|
||||
<!-- .gbtheme -->
|
||||
<rect x="440" y="180" width="160" height="80" fill="none" stroke="#FC8181" stroke-width="2" rx="6"/>
|
||||
<text x="520" y="205" text-anchor="middle" font-family="monospace" font-size="13" font-weight="bold" fill="#FC8181">.gbtheme</text>
|
||||
<text x="520" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FEB2B2">(optional)</text>
|
||||
<text x="520" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">UI Theme</text>
|
||||
<text x="520" y="205" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#EF4444">.gbtheme</text>
|
||||
<text x="520" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#DC2626">(optional)</text>
|
||||
<text x="520" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">UI Theme</text>
|
||||
|
||||
<!-- .gbdrive -->
|
||||
<rect x="570" y="180" width="160" height="80" fill="none" stroke="#68D391" stroke-width="2" rx="6"/>
|
||||
<text x="650" y="205" text-anchor="middle" font-family="monospace" font-size="13" font-weight="bold" fill="#68D391">.gbdrive</text>
|
||||
<text x="650" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#9AE6B4">(optional)</text>
|
||||
<text x="650" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">File Storage</text>
|
||||
<text x="650" y="205" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#059669">.gbdrive</text>
|
||||
<text x="650" y="225" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#10B981">(optional)</text>
|
||||
<text x="650" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">File Storage</text>
|
||||
</g>
|
||||
|
||||
<!-- Connection lines to file types -->
|
||||
|
|
@ -73,35 +73,35 @@
|
|||
<g id="file-types">
|
||||
<!-- Scripts -->
|
||||
<rect x="80" y="300" width="140" height="60" fill="none" stroke="#F6AD55" stroke-width="1" rx="4" stroke-dasharray="3,3" opacity="0.7"/>
|
||||
<text x="150" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#FBD38D">Scripts</text>
|
||||
<text x="150" y="345" text-anchor="middle" font-family="monospace" font-size="11" fill="#A0AEC0">.bas files</text>
|
||||
<text x="150" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#EA580C">Scripts</text>
|
||||
<text x="150" y="345" text-anchor="middle" font-family="monospace" font-size="16" fill="#374151">.bas files</text>
|
||||
|
||||
<!-- Documents -->
|
||||
<rect x="210" y="300" width="140" height="60" fill="none" stroke="#4FD1C5" stroke-width="1" rx="4" stroke-dasharray="3,3" opacity="0.7"/>
|
||||
<text x="280" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#81E6D9">Docs</text>
|
||||
<text x="280" y="345" text-anchor="middle" font-family="monospace" font-size="11" fill="#A0AEC0">PDF/TXT</text>
|
||||
<text x="280" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#0891B2">Docs</text>
|
||||
<text x="280" y="345" text-anchor="middle" font-family="monospace" font-size="16" fill="#374151">PDF/TXT</text>
|
||||
|
||||
<!-- Config -->
|
||||
<rect x="330" y="300" width="140" height="60" fill="none" stroke="#B794F4" stroke-width="1" rx="4" stroke-dasharray="3,3" opacity="0.7"/>
|
||||
<text x="400" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#D6BCFA">Config</text>
|
||||
<text x="400" y="345" text-anchor="middle" font-family="monospace" font-size="11" fill="#A0AEC0">.csv</text>
|
||||
<text x="400" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#9333EA">Config</text>
|
||||
<text x="400" y="345" text-anchor="middle" font-family="monospace" font-size="16" fill="#374151">.csv</text>
|
||||
|
||||
<!-- Styles -->
|
||||
<rect x="450" y="300" width="140" height="60" fill="none" stroke="#FC8181" stroke-width="1" rx="4" stroke-dasharray="3,3" opacity="0.7"/>
|
||||
<text x="520" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#FC8181">Styles</text>
|
||||
<text x="520" y="345" text-anchor="middle" font-family="monospace" font-size="11" fill="#A0AEC0">CSS/HTML</text>
|
||||
<text x="520" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#EF4444">Styles</text>
|
||||
<text x="520" y="345" text-anchor="middle" font-family="monospace" font-size="16" fill="#374151">CSS/HTML</text>
|
||||
|
||||
<!-- Storage -->
|
||||
<rect x="580" y="300" width="140" height="60" fill="none" stroke="#68D391" stroke-width="1" rx="4" stroke-dasharray="3,3" opacity="0.7"/>
|
||||
<text x="650" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#68D391">Storage</text>
|
||||
<text x="650" y="345" text-anchor="middle" font-family="monospace" font-size="11" fill="#A0AEC0">S3 Link</text>
|
||||
<text x="650" y="325" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#059669">Storage</text>
|
||||
<text x="650" y="345" text-anchor="middle" font-family="monospace" font-size="16" fill="#374151">S3 Link</text>
|
||||
</g>
|
||||
|
||||
<!-- Example Structure -->
|
||||
<g id="example" transform="translate(100, 400)">
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#CBD5E0">Example Directory Structure:</text>
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">Example Directory Structure:</text>
|
||||
|
||||
<g font-family="monospace" font-size="12" fill="#A0AEC0">
|
||||
<g font-family="monospace" font-size="18" fill="#374151">
|
||||
<text x="0" y="30">botname.gbai/</text>
|
||||
<text x="20" y="50">├── botname.gbdialog/</text>
|
||||
<text x="40" y="70">│ ├── start.bas</text>
|
||||
|
|
@ -120,9 +120,9 @@
|
|||
<!-- Notes -->
|
||||
<g id="notes" transform="translate(450, 430)">
|
||||
<rect x="0" y="0" width="300" height="120" fill="none" stroke="#4A5568" stroke-width="1" rx="5" stroke-dasharray="2,2" opacity="0.5"/>
|
||||
<text x="150" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#CBD5E0">Key Points</text>
|
||||
<text x="150" y="20" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#1F2937">Key Points</text>
|
||||
|
||||
<g font-family="Arial, sans-serif" font-size="11" fill="#A0AEC0">
|
||||
<g font-family="Arial, sans-serif" font-size="16" fill="#374151">
|
||||
<text x="10" y="45">• Folder name = Bot name</text>
|
||||
<text x="10" y="65">• Only .gbdialog is required</text>
|
||||
<text x="10" y="85">• start.bas is the entry point</text>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
163
docs/src/chapter-02/assets/package-structure.svg.backup
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?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="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Package Structure</text>
|
||||
|
||||
<!-- Root Package -->
|
||||
<rect x="300" y="60" width="200" height="50" fill="none" stroke="#2563EB" stroke-width="2" rx="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="#4B5563" filter="url(#textShadow)">my-bot.gbai/</text>
|
||||
<text x="400" y="100" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">(Package Root)</text>
|
||||
|
||||
<!-- Connection Lines from Root -->
|
||||
<g stroke="#6B7280" stroke-width="2" fill="none">
|
||||
<line x1="400" y1="110" x2="400" y2="140">
|
||||
<!-- Horizontal spread -->
|
||||
<line x1="400" y1="140" x2="150" y2="140">
|
||||
<line x1="400" y1="140" x2="650" y2="140">
|
||||
<!-- Vertical lines to components -->
|
||||
<line x1="150" y1="140" x2="150" y2="180">
|
||||
<line x1="280" y1="140" x2="280" y2="180">
|
||||
<line x1="400" y1="140" x2="400" y2="180">
|
||||
<line x1="520" y1="140" x2="520" y2="180">
|
||||
<line x1="650" y1="140" x2="650" y2="180">
|
||||
</g>
|
||||
|
||||
<!-- Component Folders -->
|
||||
<g id="folders">
|
||||
<!-- .gbdialog -->
|
||||
<rect x="70" y="180" width="160" height="80" fill="none" stroke="#EA580C" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="150" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">.gbdialog</text>
|
||||
<text x="150" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Dialog Scripts</text>
|
||||
<text x="150" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Conversation Logic</text>
|
||||
|
||||
<!-- .gbkb -->
|
||||
<rect x="200" y="180" width="160" height="80" fill="none" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="280" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">.gbkb</text>
|
||||
<text x="280" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Knowledge Base</text>
|
||||
<text x="280" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Documents</text>
|
||||
|
||||
<!-- .gbot -->
|
||||
<rect x="320" y="180" width="160" height="80" fill="none" stroke="#7C3AED" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="400" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">.gbot</text>
|
||||
<text x="400" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Configuration</text>
|
||||
<text x="400" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Bot Settings</text>
|
||||
|
||||
<!-- .gbtheme -->
|
||||
<rect x="440" y="180" width="160" height="80" fill="none" stroke="#DC2626" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="520" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">.gbtheme</text>
|
||||
<text x="520" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">(optional)</text>
|
||||
<text x="520" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">UI Theme</text>
|
||||
|
||||
<!-- .gbdrive -->
|
||||
<rect x="570" y="180" width="160" height="80" fill="none" stroke="#059669" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="650" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">.gbdrive</text>
|
||||
<text x="650" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">(optional)</text>
|
||||
<text x="650" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">File Storage</text>
|
||||
</g>
|
||||
|
||||
<!-- Connection lines to file types -->
|
||||
<g stroke="#6B7280" stroke-width="2" fill="none" opacity="0.6">
|
||||
<line x1="150" y1="260" x2="150" y2="300">
|
||||
<line x1="280" y1="260" x2="280" y2="300">
|
||||
<line x1="400" y1="260" x2="400" y2="300">
|
||||
<line x1="520" y1="260" x2="520" y2="300">
|
||||
<line x1="650" y1="260" x2="650" y2="300">
|
||||
</g>
|
||||
|
||||
<!-- File Types -->
|
||||
<g id="file-types">
|
||||
<!-- Scripts -->
|
||||
<rect x="80" y="300" width="140" height="60" fill="none" stroke="#EA580C" stroke-width="2" rx="4" stroke-dasharray="3,3" opacity="0.7" filter="url(#shadow)"/>
|
||||
<text x="150" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Scripts</text>
|
||||
<text x="150" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">.bas files</text>
|
||||
|
||||
<!-- Documents -->
|
||||
<rect x="210" y="300" width="140" height="60" fill="none" stroke="#2563EB" stroke-width="2" rx="4" stroke-dasharray="3,3" opacity="0.7" filter="url(#shadow)"/>
|
||||
<text x="280" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Docs</text>
|
||||
<text x="280" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">PDF/TXT</text>
|
||||
|
||||
<!-- Config -->
|
||||
<rect x="330" y="300" width="140" height="60" fill="none" stroke="#7C3AED" stroke-width="2" rx="4" stroke-dasharray="3,3" opacity="0.7" filter="url(#shadow)"/>
|
||||
<text x="400" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Config</text>
|
||||
<text x="400" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">.csv</text>
|
||||
|
||||
<!-- Styles -->
|
||||
<rect x="450" y="300" width="140" height="60" fill="none" stroke="#DC2626" stroke-width="2" rx="4" stroke-dasharray="3,3" opacity="0.7" filter="url(#shadow)"/>
|
||||
<text x="520" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Styles</text>
|
||||
<text x="520" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">CSS/HTML</text>
|
||||
|
||||
<!-- Storage -->
|
||||
<rect x="580" y="300" width="140" height="60" fill="none" stroke="#059669" stroke-width="2" rx="4" stroke-dasharray="3,3" opacity="0.7" filter="url(#shadow)"/>
|
||||
<text x="650" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Storage</text>
|
||||
<text x="650" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">S3 Link</text>
|
||||
</g>
|
||||
|
||||
<!-- Example Structure -->
|
||||
<g id="example" transform="translate(100, 400)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Example Directory Structure:</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="0" y="30" filter="url(#textShadow)">botname.gbai/</text>
|
||||
<text x="20" y="50" filter="url(#textShadow)">├── botname.gbdialog/</text>
|
||||
<text x="40" y="70" filter="url(#textShadow)">│ ├── start.bas</text>
|
||||
<text x="40" y="90" filter="url(#textShadow)">│ ├── auth.bas</text>
|
||||
<text x="40" y="110" filter="url(#textShadow)">│ └── tools/</text>
|
||||
<text x="20" y="130" filter="url(#textShadow)">├── botname.gbkb/</text>
|
||||
<text x="40" y="150" filter="url(#textShadow)">│ ├── collection1/</text>
|
||||
<text x="40" y="170" filter="url(#textShadow)">│ └── collection2/</text>
|
||||
<text x="20" y="190" filter="url(#textShadow)">├── botname.gbot/</text>
|
||||
<text x="40" y="210" filter="url(#textShadow)">│ └── config.csv</text>
|
||||
<text x="20" y="230" filter="url(#textShadow)">└── botname.gbtheme/</text>
|
||||
<text x="40" y="250" filter="url(#textShadow)"> └── default.css</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Notes -->
|
||||
<g id="notes" transform="translate(450, 430)">
|
||||
<rect x="0" y="0" width="300" height="120" fill="none" stroke="#2563EB" stroke-width="2" rx="5" stroke-dasharray="2,2" opacity="0.5" filter="url(#shadow)"/>
|
||||
<text x="150" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Key Points</text>
|
||||
|
||||
<g font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
<text x="10" y="45" filter="url(#textShadow)">• Folder name = Bot name</text>
|
||||
<text x="10" y="65" filter="url(#textShadow)">• Only .gbdialog is required</text>
|
||||
<text x="10" y="85" filter="url(#textShadow)">• start.bas is the entry point</text>
|
||||
<text x="10" y="105" filter="url(#textShadow)">• Deploy by copying folder</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -1,83 +1,83 @@
|
|||
<svg width="600" height="800" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="600" height="800" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#888"/>
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#4B5563"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="300" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">Template Deployment Flow</text>
|
||||
<text x="300" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="bold" fill="#1F2937">Template Deployment Flow</text>
|
||||
|
||||
<!-- Templates folder -->
|
||||
<rect x="225" y="60" width="150" height="50" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">templates/</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#CBD5E0">Source folder</text>
|
||||
<text x="300" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1E40AF">templates/</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">Source folder</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="110" x2="300" y2="140" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- SCAN -->
|
||||
<rect x="200" y="140" width="200" height="70" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">SCAN</text>
|
||||
<text x="300" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FED7AA">Find all .gbai folders</text>
|
||||
<text x="300" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EA580C">SCAN</text>
|
||||
<text x="300" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#FED7AA">Find all .gbai folders</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="210" x2="300" y2="240" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- VALIDATE -->
|
||||
<rect x="200" y="240" width="200" height="90" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="265" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">VALIDATE</text>
|
||||
<text x="300" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">Check required structure</text>
|
||||
<text x="300" y="300" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• start.bas exists?</text>
|
||||
<text x="300" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Folders match name?</text>
|
||||
<text x="300" y="265" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#9333EA">VALIDATE</text>
|
||||
<text x="300" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C3AED">Check required structure</text>
|
||||
<text x="300" y="300" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• start.bas exists?</text>
|
||||
<text x="300" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Folders match name?</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="330" x2="300" y2="360" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- UPLOAD -->
|
||||
<rect x="200" y="360" width="200" height="90" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="385" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">UPLOAD</text>
|
||||
<text x="300" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#9AE6B4">Copy to object storage</text>
|
||||
<text x="300" y="420" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Templates → S3/Drive</text>
|
||||
<text x="300" y="435" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Assets → CDN paths</text>
|
||||
<text x="300" y="385" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#059669">UPLOAD</text>
|
||||
<text x="300" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#10B981">Copy to object storage</text>
|
||||
<text x="300" y="420" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Templates → S3/Drive</text>
|
||||
<text x="300" y="435" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Assets → CDN paths</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="450" x2="300" y2="480" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- INDEX -->
|
||||
<rect x="200" y="480" width="200" height="90" fill="none" stroke="#4FD1C5" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="505" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#81E6D9">INDEX</text>
|
||||
<text x="300" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#B2F5EA">Process knowledge base</text>
|
||||
<text x="300" y="540" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Extract text</text>
|
||||
<text x="300" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Generate embeddings</text>
|
||||
<text x="300" y="570" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Store in Qdrant</text>
|
||||
<text x="300" y="505" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#0891B2">INDEX</text>
|
||||
<text x="300" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#0E7490">Process knowledge base</text>
|
||||
<text x="300" y="540" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Extract text</text>
|
||||
<text x="300" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Generate embeddings</text>
|
||||
<text x="300" y="570" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Store in Qdrant</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="580" x2="300" y2="610" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- REGISTER -->
|
||||
<rect x="200" y="610" width="200" height="90" fill="none" stroke="#FBBF24" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="635" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FCD34D">REGISTER</text>
|
||||
<text x="300" y="655" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FDE68A">Create in database</text>
|
||||
<text x="300" y="670" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Bot record</text>
|
||||
<text x="300" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Configuration</text>
|
||||
<text x="300" y="700" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• URL mapping</text>
|
||||
<text x="300" y="635" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#FCD34D">REGISTER</text>
|
||||
<text x="300" y="655" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#FDE68A">Create in database</text>
|
||||
<text x="300" y="670" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Bot record</text>
|
||||
<text x="300" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Configuration</text>
|
||||
<text x="300" y="700" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• URL mapping</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="710" x2="300" y2="740" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- ACTIVATE -->
|
||||
<rect x="200" y="740" width="200" height="90" fill="none" stroke="#FC8181" stroke-width="2" rx="8"/>
|
||||
<text x="300" y="765" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">ACTIVATE</text>
|
||||
<text x="300" y="785" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FEB2B2">Start serving</text>
|
||||
<text x="300" y="800" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• /bot-name endpoint</text>
|
||||
<text x="300" y="815" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• WebSocket ready</text>
|
||||
<text x="300" y="830" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">• Sessions enabled</text>
|
||||
<text x="300" y="765" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#EF4444">ACTIVATE</text>
|
||||
<text x="300" y="785" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#DC2626">Start serving</text>
|
||||
<text x="300" y="800" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• /bot-name endpoint</text>
|
||||
<text x="300" y="815" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• WebSocket ready</text>
|
||||
<text x="300" y="830" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">• Sessions enabled</text>
|
||||
|
||||
<!-- Process time indicator -->
|
||||
<g id="time-indicator" transform="translate(450, 450)">
|
||||
<circle cx="0" cy="0" r="40" fill="none" stroke="#4A5568" stroke-width="1" opacity="0.5"/>
|
||||
<text x="0" y="0" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#CBD5E0">5-10s</text>
|
||||
<text x="0" y="15" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#A0AEC0">per bot</text>
|
||||
<text x="0" y="0" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#1F2937">5-10s</text>
|
||||
<text x="0" y="15" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#374151">per bot</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 6.1 KiB |
114
docs/src/chapter-02/assets/template-deployment-flow.svg.backup
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 680 880" 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="680" height="880" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<text x="300" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Template Deployment Flow</text>
|
||||
|
||||
<!-- Templates folder -->
|
||||
<rect x="225" y="60" width="150" height="50" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">templates/</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Source folder</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="110" x2="300" y2="140" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- SCAN -->
|
||||
<rect x="200" y="140" width="200" height="70" fill="none" stroke="#EA580C" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">SCAN</text>
|
||||
<text x="300" y="185" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Find all .gbai folders</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="210" x2="300" y2="240" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- VALIDATE -->
|
||||
<rect x="200" y="240" width="200" height="90" fill="none" stroke="#7C3AED" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="265" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">VALIDATE</text>
|
||||
<text x="300" y="285" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Check required structure</text>
|
||||
<text x="300" y="300" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• start.bas exists?</text>
|
||||
<text x="300" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Folders match name?</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="330" x2="300" y2="360" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- UPLOAD -->
|
||||
<rect x="200" y="360" width="200" height="90" fill="none" stroke="#059669" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="385" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">UPLOAD</text>
|
||||
<text x="300" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Copy to object storage</text>
|
||||
<text x="300" y="420" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Templates → S3/Drive</text>
|
||||
<text x="300" y="435" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Assets → CDN paths</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="450" x2="300" y2="480" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- INDEX -->
|
||||
<rect x="200" y="480" width="200" height="90" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="505" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">INDEX</text>
|
||||
<text x="300" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)" font-weight="600">Process knowledge base</text>
|
||||
<text x="300" y="540" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Extract text</text>
|
||||
<text x="300" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Generate embeddings</text>
|
||||
<text x="300" y="570" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Store in Qdrant</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="580" x2="300" y2="610" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- REGISTER -->
|
||||
<rect x="200" y="610" width="200" height="90" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="635" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">REGISTER</text>
|
||||
<text x="300" y="655" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Create in database</text>
|
||||
<text x="300" y="670" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Bot record</text>
|
||||
<text x="300" y="685" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Configuration</text>
|
||||
<text x="300" y="700" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• URL mapping</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="710" x2="300" y2="740" stroke="#6B7280" stroke-width="2" marker-end="url(#arrow)">
|
||||
|
||||
<!-- ACTIVATE -->
|
||||
<rect x="200" y="740" width="200" height="90" fill="none" stroke="#DC2626" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="765" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">ACTIVATE</text>
|
||||
<text x="300" y="785" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Start serving</text>
|
||||
<text x="300" y="800" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• /bot-name endpoint</text>
|
||||
<text x="300" y="815" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• WebSocket ready</text>
|
||||
<text x="300" y="830" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Sessions enabled</text>
|
||||
|
||||
<!-- Process time indicator -->
|
||||
<g id="time-indicator" transform="translate(450, 450)">
|
||||
<circle cx="0" cy="0" r="40" fill="none" stroke="#2563EB" stroke-width="2" opacity="0.5">
|
||||
<text x="0" y="0" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">5-10s</text>
|
||||
<text x="0" y="15" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">per bot</text>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.3 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="750" height="400" viewBox="0 0 750 400" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="750" height="400" viewBox="0 0 750 400" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Beautiful gradients with vibrant colors -->
|
||||
|
|
@ -90,30 +90,30 @@
|
|||
|
||||
<!-- Title with better padding -->
|
||||
<rect x="200" y="10" width="350" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8"/>
|
||||
<text x="375" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
<text x="375" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="600" fill="#1e293b">
|
||||
Semantic Caching Architecture
|
||||
</text>
|
||||
|
||||
<!-- User Query -->
|
||||
<rect x="50" y="70" width="130" height="45" fill="url(#userQueryGrad)" stroke="#667eea" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="115" y="95" text-anchor="middle" font-family="system-ui" sans-serif" font-size="13" font-weight="600" fill="#1e293b">User Query</text>
|
||||
<text x="115" y="108" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">"What's the policy?"</text>
|
||||
<text x="115" y="95" text-anchor="middle" font-family="system-ui" sans-serif" font-size="20" font-weight="600" fill="#1e293b">User Query</text>
|
||||
<text x="115" y="108" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">"What's the policy?"</text>
|
||||
|
||||
<!-- Arrow to Generate Key -->
|
||||
<path d="M 180 92 L 220 92" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7"/>
|
||||
|
||||
<!-- Generate Key -->
|
||||
<rect x="220" y="70" width="130" height="45" fill="url(#keyGenGrad)" stroke="#f5576c" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="285" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">Generate Key</text>
|
||||
<text x="285" y="108" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">Hash + Embed</text>
|
||||
<text x="285" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">Generate Key</text>
|
||||
<text x="285" y="108" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Hash + Embed</text>
|
||||
|
||||
<!-- Arrow to Check Valkey -->
|
||||
<path d="M 350 92 L 390 92" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7"/>
|
||||
|
||||
<!-- Check Valkey -->
|
||||
<rect x="390" y="70" width="130" height="45" fill="url(#valkeyGrad)" stroke="#ee5a24" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="455" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">Check Valkey</text>
|
||||
<text x="455" y="108" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">Memory Store</text>
|
||||
<text x="455" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">Check Valkey</text>
|
||||
<text x="455" y="108" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Memory Store</text>
|
||||
|
||||
<!-- Arrow to Decision -->
|
||||
<path d="M 520 92 L 560 92" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7"/>
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
<!-- Hit/Miss Decision Diamond with glow -->
|
||||
<g filter="url(#glowEffect)">
|
||||
<path d="M 610 70 L 650 92 L 610 114 L 570 92 Z" fill="rgba(139, 92, 246, 0.2)" stroke="#8b5cf6" stroke-width="2.5"/>
|
||||
<text x="610" y="97" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">Hit?</text>
|
||||
<text x="610" y="97" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">Hit?</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow down from Generate Key to Embedding -->
|
||||
|
|
@ -129,45 +129,45 @@
|
|||
|
||||
<!-- Embedding Hash -->
|
||||
<rect x="210" y="160" width="150" height="45" fill="url(#embedGrad)" stroke="#00f2fe" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="285" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">Embedding Hash</text>
|
||||
<text x="285" y="198" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">384D Vector</text>
|
||||
<text x="285" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">Embedding Hash</text>
|
||||
<text x="285" y="198" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">384D Vector</text>
|
||||
|
||||
<!-- Arrow down from Embedding Hash -->
|
||||
<path d="M 285 205 L 285 250" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7"/>
|
||||
|
||||
<!-- Semantic Search -->
|
||||
<rect x="210" y="250" width="150" height="45" fill="url(#semanticGrad)" stroke="#38f9d7" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="285" y="275" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">Semantic Search</text>
|
||||
<text x="285" y="288" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">Similarity > 0.95</text>
|
||||
<text x="285" y="275" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">Semantic Search</text>
|
||||
<text x="285" y="288" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Similarity > 0.95</text>
|
||||
|
||||
<!-- Cache Hit path (success) -->
|
||||
<path d="M 610 70 L 610 40 L 455 40" stroke="url(#hitPathGrad)" stroke-width="3" fill="none" opacity="0.8" stroke-linecap="round"/>
|
||||
<rect x="330" y="25" width="125" height="30" fill="rgba(16, 185, 129, 0.1)" stroke="#10b981" stroke-width="1.5" stroke-dasharray="4,2" rx="6"/>
|
||||
<text x="392" y="44" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#047857">✓ Cache Hit</text>
|
||||
<text x="392" y="44" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#047857">✓ Cache Hit</text>
|
||||
|
||||
<!-- Miss path -->
|
||||
<path d="M 610 114 L 610 160" stroke="url(#missPathGrad)" stroke-width="3" fill="none" marker-end="url(#arrowMiss)" opacity="0.8" stroke-linecap="round"/>
|
||||
<text x="630" y="140" text-anchor="start" font-family="system-ui, sans-serif" font-size="10" font-weight="500" fill="#d97706">Miss</text>
|
||||
<text x="630" y="140" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#d97706">Miss</text>
|
||||
|
||||
<!-- Generate New Response -->
|
||||
<rect x="530" y="160" width="150" height="45" fill="url(#generateGrad)" stroke="#fa709a" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="605" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">Generate New</text>
|
||||
<text x="605" y="198" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">LLM Response</text>
|
||||
<text x="605" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">Generate New</text>
|
||||
<text x="605" y="198" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">LLM Response</text>
|
||||
|
||||
<!-- Arrow down from Generate New -->
|
||||
<path d="M 605 205 L 605 250" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7"/>
|
||||
|
||||
<!-- Store in Valkey -->
|
||||
<rect x="510" y="250" width="190" height="45" fill="url(#storeGrad)" stroke="#330867" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="605" y="270" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">Store in Valkey</text>
|
||||
<text x="605" y="285" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">TTL: 3600s</text>
|
||||
<text x="605" y="270" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">Store in Valkey</text>
|
||||
<text x="605" y="285" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">TTL: 3600s</text>
|
||||
|
||||
<!-- Performance Metrics Box -->
|
||||
<rect x="50" y="320" width="650" height="60" fill="rgba(99, 102, 241, 0.05)" stroke="#8b5cf6" stroke-width="1" stroke-dasharray="6,3" rx="8"/>
|
||||
<text x="375" y="343" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">
|
||||
<text x="375" y="343" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">
|
||||
Performance Metrics
|
||||
</text>
|
||||
<text x="200" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">Hit Rate: ~85%</text>
|
||||
<text x="375" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">Latency: <50ms</text>
|
||||
<text x="550" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">Cost Reduction: 95%</text>
|
||||
<text x="200" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Hit Rate: ~85%</text>
|
||||
<text x="375" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Latency: <50ms</text>
|
||||
<text x="550" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Cost Reduction: 95%</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 10 KiB |
125
docs/src/chapter-03/assets/caching-architecture.svg.backup
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 830 480" 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="830" height="480" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="750" height="400" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title with better padding -->
|
||||
<rect x="200" y="10" width="350" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8" filter="url(#shadow)">
|
||||
<text x="375" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#4B5563">
|
||||
Semantic Caching Architecture
|
||||
</text>
|
||||
|
||||
<!-- User Query -->
|
||||
<rect x="50" y="70" width="130" height="45" fill="url(#userQueryGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="115" y="95" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">User Query</text>
|
||||
<text x="115" y="108" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">"What's the policy?"</text>
|
||||
|
||||
<!-- Arrow to Generate Key -->
|
||||
<path d="M 180 92 L 220 92" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7">
|
||||
|
||||
<!-- Generate Key -->
|
||||
<rect x="220" y="70" width="130" height="45" fill="url(#keyGenGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="285" y="95" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Generate Key</text>
|
||||
<text x="285" y="108" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Hash + Embed</text>
|
||||
|
||||
<!-- Arrow to Check Valkey -->
|
||||
<path d="M 350 92 L 390 92" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7">
|
||||
|
||||
<!-- Check Valkey -->
|
||||
<rect x="390" y="70" width="130" height="45" fill="url(#valkeyGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="455" y="95" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Check Valkey</text>
|
||||
<text x="455" y="108" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Memory Store</text>
|
||||
|
||||
<!-- Arrow to Decision -->
|
||||
<path d="M 520 92 L 560 92" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7">
|
||||
|
||||
<!-- Hit/Miss Decision Diamond with glow -->
|
||||
<g filter="url(#glowEffect)">
|
||||
<path d="M 610 70 L 650 92 L 610 114 L 570 92 Z" fill="rgba(139, 92, 246, 0.2)" stroke="#2563EB" stroke-width="2.5">
|
||||
<text x="610" y="97" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Hit?</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow down from Generate Key to Embedding -->
|
||||
<path d="M 285 115 L 285 160" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7">
|
||||
|
||||
<!-- Embedding Hash -->
|
||||
<rect x="210" y="160" width="150" height="45" fill="url(#embedGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="285" y="185" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Embedding Hash</text>
|
||||
<text x="285" y="198" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">384D Vector</text>
|
||||
|
||||
<!-- Arrow down from Embedding Hash -->
|
||||
<path d="M 285 205 L 285 250" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7">
|
||||
|
||||
<!-- Semantic Search -->
|
||||
<rect x="210" y="250" width="150" height="45" fill="url(#semanticGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="285" y="275" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Semantic Search</text>
|
||||
<text x="285" y="288" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Similarity > 0.95</text>
|
||||
|
||||
<!-- Cache Hit path (success) -->
|
||||
<path d="M 610 70 L 610 40 L 455 40" stroke="url(#hitPathGrad)" stroke-width="3" fill="none" opacity="0.8" stroke-linecap="round">
|
||||
<rect x="330" y="25" width="125" height="30" fill="rgba(16, 185, 129, 0.1)" stroke="#2563EB" stroke-width="2" stroke-dasharray="4,2" rx="6" filter="url(#shadow)">
|
||||
<text x="392" y="44" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">✓ Cache Hit</text>
|
||||
|
||||
<!-- Miss path -->
|
||||
<path d="M 610 114 L 610 160" stroke="url(#missPathGrad)" stroke-width="3" fill="none" marker-end="url(#arrowMiss)" opacity="0.8" stroke-linecap="round">
|
||||
<text x="630" y="140" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Miss</text>
|
||||
|
||||
<!-- Generate New Response -->
|
||||
<rect x="530" y="160" width="150" height="45" fill="url(#generateGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="605" y="185" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Generate New</text>
|
||||
<text x="605" y="198" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">LLM Response</text>
|
||||
|
||||
<!-- Arrow down from Generate New -->
|
||||
<path d="M 605 205 L 605 250" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrowCache)" opacity="0.7">
|
||||
|
||||
<!-- Store in Valkey -->
|
||||
<rect x="510" y="250" width="190" height="45" fill="url(#storeGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="605" y="270" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Store in Valkey</text>
|
||||
<text x="605" y="285" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">TTL: 3600s</text>
|
||||
|
||||
<!-- Performance Metrics Box -->
|
||||
<rect x="50" y="320" width="650" height="60" fill="rgba(99, 102, 241, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="6,3" rx="8" filter="url(#shadow)">
|
||||
<text x="375" y="343" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Performance Metrics
|
||||
</text>
|
||||
<text x="200" y="365" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Hit Rate: ~85%</text>
|
||||
<text x="375" y="365" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Latency: <50ms</text>
|
||||
<text x="550" y="365" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Cost Reduction: 95%</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.3 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="900" height="450" viewBox="0 0 900 450" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="900" height="450" viewBox="0 0 900 450" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Gradient for original documents -->
|
||||
|
|
@ -42,164 +42,164 @@
|
|||
<rect x="0" y="0" width="900" height="450" fill="#fafafa"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="600" fill="#1e293b">
|
||||
Vector Database Storage Requirements: The Real Mathematics
|
||||
</text>
|
||||
|
||||
<!-- Original Documents Section -->
|
||||
<rect x="50" y="60" width="180" height="380" fill="url(#origGrad)" stroke="#3b82f6" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="140" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="140" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Original Documents
|
||||
</text>
|
||||
<text x="140" y="105" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#475569">
|
||||
<text x="140" y="105" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#475569">
|
||||
1 TB Total
|
||||
</text>
|
||||
|
||||
<!-- File type breakdown -->
|
||||
<rect x="70" y="120" width="140" height="30" fill="rgba(59, 130, 246, 0.05)" stroke="#93c5fd" stroke-width="1"/>
|
||||
<text x="140" y="140" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#1e293b">
|
||||
<text x="140" y="140" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#1e293b">
|
||||
PDF: 400 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="155" width="140" height="25" fill="rgba(59, 130, 246, 0.05)" stroke="#93c5fd" stroke-width="1"/>
|
||||
<text x="140" y="172" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#1e293b">
|
||||
<text x="140" y="172" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#1e293b">
|
||||
DOCX: 250 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="185" width="140" height="20" fill="rgba(59, 130, 246, 0.05)" stroke="#93c5fd" stroke-width="1"/>
|
||||
<text x="140" y="200" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#1e293b">
|
||||
<text x="140" y="200" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#1e293b">
|
||||
XLSX: 150 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="210" width="140" height="15" fill="rgba(59, 130, 246, 0.05)" stroke="#93c5fd" stroke-width="1"/>
|
||||
<text x="140" y="223" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#1e293b">
|
||||
<text x="140" y="223" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#1e293b">
|
||||
TXT: 100 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="230" width="140" height="15" fill="rgba(59, 130, 246, 0.05)" stroke="#93c5fd" stroke-width="1"/>
|
||||
<text x="140" y="243" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#1e293b">
|
||||
<text x="140" y="243" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#1e293b">
|
||||
HTML: 50 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="250" width="140" height="10" fill="rgba(59, 130, 246, 0.05)" stroke="#93c5fd" stroke-width="1"/>
|
||||
<text x="140" y="258" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="140" y="258" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Other: 50 GB
|
||||
</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<path d="M 240 250 L 290 250" stroke="#4a5568" stroke-width="3" fill="none" marker-end="url(#arrowhead2)" opacity="0.7"/>
|
||||
<text x="265" y="240" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">
|
||||
<text x="265" y="240" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Processing
|
||||
</text>
|
||||
|
||||
<!-- Vector Database Storage -->
|
||||
<rect x="300" y="60" width="250" height="380" fill="url(#vectorGrad)" stroke="#10b981" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="425" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="425" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Vector DB Storage
|
||||
</text>
|
||||
<text x="425" y="105" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#475569">
|
||||
<text x="425" y="105" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#475569">
|
||||
~3.5 TB Required
|
||||
</text>
|
||||
|
||||
<!-- Storage breakdown -->
|
||||
<rect x="320" y="120" width="210" height="50" fill="rgba(16, 185, 129, 0.05)" stroke="#86efac" stroke-width="1" stroke-dasharray="3,2"/>
|
||||
<text x="425" y="135" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#1e293b">
|
||||
<text x="425" y="135" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#1e293b">
|
||||
Raw Text Extracted
|
||||
</text>
|
||||
<text x="425" y="150" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="425" y="150" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
~800 GB (cleaned)
|
||||
</text>
|
||||
<text x="425" y="163" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">
|
||||
<text x="425" y="163" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Deduplication reduces 20%
|
||||
</text>
|
||||
|
||||
<rect x="320" y="175" width="210" height="60" fill="rgba(16, 185, 129, 0.05)" stroke="#86efac" stroke-width="1" stroke-dasharray="3,2"/>
|
||||
<text x="425" y="190" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#1e293b">
|
||||
<text x="425" y="190" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#1e293b">
|
||||
Vector Embeddings
|
||||
</text>
|
||||
<text x="425" y="205" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="425" y="205" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
~1.2 TB (384-dim floats)
|
||||
</text>
|
||||
<text x="425" y="218" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">
|
||||
<text x="425" y="218" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
4 bytes × 384 × ~800M chunks
|
||||
</text>
|
||||
<text x="425" y="230" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">
|
||||
<text x="425" y="230" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
= 1,228 GB
|
||||
</text>
|
||||
|
||||
<rect x="320" y="240" width="210" height="55" fill="rgba(16, 185, 129, 0.05)" stroke="#86efac" stroke-width="1" stroke-dasharray="3,2"/>
|
||||
<text x="425" y="255" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#1e293b">
|
||||
<text x="425" y="255" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#1e293b">
|
||||
HNSW Index
|
||||
</text>
|
||||
<text x="425" y="270" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="425" y="270" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
~600 GB
|
||||
</text>
|
||||
<text x="425" y="283" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">
|
||||
<text x="425" y="283" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Graph structure + links
|
||||
</text>
|
||||
|
||||
<rect x="320" y="300" width="210" height="50" fill="rgba(16, 185, 129, 0.05)" stroke="#86efac" stroke-width="1" stroke-dasharray="3,2"/>
|
||||
<text x="425" y="315" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#1e293b">
|
||||
<text x="425" y="315" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#1e293b">
|
||||
Metadata + Positions
|
||||
</text>
|
||||
<text x="425" y="330" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="425" y="330" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
~400 GB
|
||||
</text>
|
||||
<text x="425" y="343" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">
|
||||
<text x="425" y="343" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Doc refs, chunks, offsets
|
||||
</text>
|
||||
|
||||
<rect x="320" y="355" width="210" height="45" fill="rgba(16, 185, 129, 0.05)" stroke="#86efac" stroke-width="1" stroke-dasharray="3,2"/>
|
||||
<text x="425" y="370" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#1e293b">
|
||||
<text x="425" y="370" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#1e293b">
|
||||
Cache + Auxiliary
|
||||
</text>
|
||||
<text x="425" y="385" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="425" y="385" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
~500 GB
|
||||
</text>
|
||||
<text x="425" y="395" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">
|
||||
<text x="425" y="395" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Query cache, temp indices
|
||||
</text>
|
||||
|
||||
<!-- Total comparison -->
|
||||
<rect x="570" y="150" width="300" height="200" fill="url(#multiGrad)" stroke="#f59e0b" stroke-width="2" stroke-dasharray="5,3" rx="8" filter="url(#shadow)"/>
|
||||
<text x="720" y="175" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="720" y="175" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Storage Multiplication Factor
|
||||
</text>
|
||||
|
||||
<text x="590" y="205" font-family="system-ui, sans-serif" font-size="12" fill="#1e293b">
|
||||
<text x="590" y="205" font-family="system-ui, sans-serif" font-size="18" fill="#1e293b">
|
||||
Original Documents: 1.0 TB
|
||||
</text>
|
||||
<text x="590" y="230" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">
|
||||
<text x="590" y="230" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
Vector DB Total: 3.5 TB
|
||||
</text>
|
||||
<text x="590" y="255" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#dc2626">
|
||||
<text x="590" y="255" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#dc2626">
|
||||
Multiplication Factor: 3.5×
|
||||
</text>
|
||||
|
||||
<text x="590" y="285" font-family="system-ui, sans-serif" font-size="11" fill="#64748b">
|
||||
<text x="590" y="285" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
With redundancy/backup:
|
||||
</text>
|
||||
<text x="590" y="305" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">
|
||||
<text x="590" y="305" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
Production Total: 7.0 TB (2× replica)
|
||||
</text>
|
||||
|
||||
<text x="720" y="335" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" font-style="italic" fill="#64748b">
|
||||
<text x="720" y="335" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-style="italic" fill="#64748b">
|
||||
Reality: You need 3.5-7× your document storage
|
||||
</text>
|
||||
|
||||
<!-- Visual indicators -->
|
||||
<g transform="translate(820, 80)">
|
||||
<circle cx="0" cy="0" r="3" fill="#3b82f6"/>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">Input</text>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">Input</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(820, 100)">
|
||||
<circle cx="0" cy="0" r="3" fill="#10b981"/>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">Storage</text>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">Storage</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(820, 120)">
|
||||
<circle cx="0" cy="0" r="3" fill="#f59e0b"/>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="9" fill="#64748b">Factor</text>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">Factor</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.6 KiB |
204
docs/src/chapter-03/assets/context-window.svg.backup
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 530" 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="530" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="900" height="450" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#4B5563">
|
||||
Vector Database Storage Requirements: The Real Mathematics
|
||||
</text>
|
||||
|
||||
<!-- Original Documents Section -->
|
||||
<rect x="50" y="60" width="180" height="380" fill="url(#origGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="140" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Original Documents
|
||||
</text>
|
||||
<text x="140" y="105" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
1 TB Total
|
||||
</text>
|
||||
|
||||
<!-- File type breakdown -->
|
||||
<rect x="70" y="120" width="140" height="30" fill="rgba(59, 130, 246, 0.05)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="140" y="140" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
PDF: 400 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="155" width="140" height="25" fill="rgba(59, 130, 246, 0.05)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="140" y="172" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
DOCX: 250 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="185" width="140" height="20" fill="rgba(59, 130, 246, 0.05)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="140" y="200" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
XLSX: 150 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="210" width="140" height="15" fill="rgba(59, 130, 246, 0.05)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="140" y="223" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
TXT: 100 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="230" width="140" height="15" fill="rgba(59, 130, 246, 0.05)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="140" y="243" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
HTML: 50 GB
|
||||
</text>
|
||||
|
||||
<rect x="70" y="250" width="140" height="10" fill="rgba(59, 130, 246, 0.05)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="140" y="258" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Other: 50 GB
|
||||
</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<path d="M 240 250 L 290 250" stroke="#2563EB" stroke-width="3" fill="none" marker-end="url(#arrowhead2)" opacity="0.7">
|
||||
<text x="265" y="240" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Processing
|
||||
</text>
|
||||
|
||||
<!-- Vector Database Storage -->
|
||||
<rect x="300" y="60" width="250" height="380" fill="url(#vectorGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="425" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Vector DB Storage
|
||||
</text>
|
||||
<text x="425" y="105" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
~3.5 TB Required
|
||||
</text>
|
||||
|
||||
<!-- Storage breakdown -->
|
||||
<rect x="320" y="120" width="210" height="50" fill="rgba(16, 185, 129, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="3,2" rx="8" filter="url(#shadow)">
|
||||
<text x="425" y="135" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Raw Text Extracted
|
||||
</text>
|
||||
<text x="425" y="150" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
~800 GB (cleaned)
|
||||
</text>
|
||||
<text x="425" y="163" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Deduplication reduces 20%
|
||||
</text>
|
||||
|
||||
<rect x="320" y="175" width="210" height="60" fill="rgba(16, 185, 129, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="3,2" rx="8" filter="url(#shadow)">
|
||||
<text x="425" y="190" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Vector Embeddings
|
||||
</text>
|
||||
<text x="425" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
~1.2 TB (384-dim floats)
|
||||
</text>
|
||||
<text x="425" y="218" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
4 bytes × 384 × ~800M chunks
|
||||
</text>
|
||||
<text x="425" y="230" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
= 1,228 GB
|
||||
</text>
|
||||
|
||||
<rect x="320" y="240" width="210" height="55" fill="rgba(16, 185, 129, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="3,2" rx="8" filter="url(#shadow)">
|
||||
<text x="425" y="255" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
HNSW Index
|
||||
</text>
|
||||
<text x="425" y="270" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
~600 GB
|
||||
</text>
|
||||
<text x="425" y="283" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Graph structure + links
|
||||
</text>
|
||||
|
||||
<rect x="320" y="300" width="210" height="50" fill="rgba(16, 185, 129, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="3,2" rx="8" filter="url(#shadow)">
|
||||
<text x="425" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Metadata + Positions
|
||||
</text>
|
||||
<text x="425" y="330" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
~400 GB
|
||||
</text>
|
||||
<text x="425" y="343" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Doc refs, chunks, offsets
|
||||
</text>
|
||||
|
||||
<rect x="320" y="355" width="210" height="45" fill="rgba(16, 185, 129, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="3,2" rx="8" filter="url(#shadow)">
|
||||
<text x="425" y="370" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Cache + Auxiliary
|
||||
</text>
|
||||
<text x="425" y="385" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
~500 GB
|
||||
</text>
|
||||
<text x="425" y="395" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Query cache, temp indices
|
||||
</text>
|
||||
|
||||
<!-- Total comparison -->
|
||||
<rect x="570" y="150" width="300" height="200" fill="url(#multiGrad)" stroke="#2563EB" stroke-width="2" stroke-dasharray="5,3" rx="8" filter="url(#shadow)">
|
||||
<text x="720" y="175" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Storage Multiplication Factor
|
||||
</text>
|
||||
|
||||
<text x="590" y="205" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Original Documents: 1.0 TB
|
||||
</text>
|
||||
<text x="590" y="230" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Vector DB Total: 3.5 TB
|
||||
</text>
|
||||
<text x="590" y="255" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Multiplication Factor: 3.5×
|
||||
</text>
|
||||
|
||||
<text x="590" y="285" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
With redundancy/backup:
|
||||
</text>
|
||||
<text x="590" y="305" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Production Total: 7.0 TB (2× replica)
|
||||
</text>
|
||||
|
||||
<text x="720" y="335" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-style="italic" fill="#4B5563">
|
||||
Reality: You need 3.5-7× your document storage
|
||||
</text>
|
||||
|
||||
<!-- Visual indicators -->
|
||||
<g transform="translate(820, 80)">
|
||||
<circle cx="0" cy="0" r="3" fill="#4B5563">
|
||||
<text x="10" y="4" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Input</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(820, 100)">
|
||||
<circle cx="0" cy="0" r="3" fill="#4B5563">
|
||||
<text x="10" y="4" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Storage</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(820, 120)">
|
||||
<circle cx="0" cy="0" r="3" fill="#4B5563">
|
||||
<text x="10" y="4" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Factor</text>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and filters -->
|
||||
<defs>
|
||||
<!-- Gradient for input layer -->
|
||||
|
|
@ -54,16 +54,16 @@
|
|||
<rect x="0" y="0" width="800" height="600" fill="#ffffff"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="600" fill="#1a202c">
|
||||
<text x="400" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="26" font-weight="600" fill="#1a202c">
|
||||
Knowledge Base Architecture Pipeline
|
||||
</text>
|
||||
|
||||
<!-- Document Ingestion Layer -->
|
||||
<rect x="100" y="60" width="600" height="60" fill="url(#inputGrad)" stroke="#667eea" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#2d3748">
|
||||
<text x="400" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#2d3748">
|
||||
Document Ingestion Layer
|
||||
</text>
|
||||
<text x="400" y="105" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#4a5568">
|
||||
<text x="400" y="105" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#4a5568">
|
||||
PDF • Word • Excel • Text • HTML • Markdown
|
||||
</text>
|
||||
|
||||
|
|
@ -72,10 +72,10 @@
|
|||
|
||||
<!-- Preprocessing Pipeline -->
|
||||
<rect x="100" y="140" width="600" height="60" fill="url(#processGrad)" stroke="#00d2ff" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="165" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#2d3748">
|
||||
<text x="400" y="165" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#2d3748">
|
||||
Preprocessing Pipeline
|
||||
</text>
|
||||
<text x="400" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#4a5568">
|
||||
<text x="400" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#4a5568">
|
||||
Extraction • Cleaning • Normalization • Validation
|
||||
</text>
|
||||
|
||||
|
|
@ -84,10 +84,10 @@
|
|||
|
||||
<!-- Chunking Engine -->
|
||||
<rect x="100" y="220" width="600" height="60" fill="url(#processGrad)" stroke="#06ffa5" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="245" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#2d3748">
|
||||
<text x="400" y="245" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#2d3748">
|
||||
Intelligent Chunking Engine
|
||||
</text>
|
||||
<text x="400" y="265" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#4a5568">
|
||||
<text x="400" y="265" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#4a5568">
|
||||
Semantic Segmentation • Overlap Management • Metadata Preservation
|
||||
</text>
|
||||
|
||||
|
|
@ -96,10 +96,10 @@
|
|||
|
||||
<!-- Embedding Generation -->
|
||||
<rect x="100" y="300" width="600" height="60" fill="url(#embedGrad)" stroke="#f5576c" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="325" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#2d3748">
|
||||
<text x="400" y="325" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#2d3748">
|
||||
Embedding Generation
|
||||
</text>
|
||||
<text x="400" y="345" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#4a5568">
|
||||
<text x="400" y="345" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#4a5568">
|
||||
BGE Models • Transformer Architecture • Dimensionality: 384/768
|
||||
</text>
|
||||
|
||||
|
|
@ -108,10 +108,10 @@
|
|||
|
||||
<!-- Vector Index Layer -->
|
||||
<rect x="100" y="380" width="600" height="60" fill="url(#indexGrad)" stroke="#fa709a" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="405" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#2d3748">
|
||||
<text x="400" y="405" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#2d3748">
|
||||
Vector Index Layer
|
||||
</text>
|
||||
<text x="400" y="425" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#4a5568">
|
||||
<text x="400" y="425" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#4a5568">
|
||||
HNSW Algorithm • Quantization • Distributed Sharding
|
||||
</text>
|
||||
|
||||
|
|
@ -120,31 +120,31 @@
|
|||
|
||||
<!-- Retrieval Engine -->
|
||||
<rect x="100" y="460" width="600" height="60" fill="url(#retrievalGrad)" stroke="#30cfd0" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="485" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#2d3748">
|
||||
<text x="400" y="485" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#2d3748">
|
||||
Semantic Retrieval Engine
|
||||
</text>
|
||||
<text x="400" y="505" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#4a5568">
|
||||
<text x="400" y="505" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#4a5568">
|
||||
Cosine Similarity • Hybrid Search • Re-ranking • Context Injection
|
||||
</text>
|
||||
|
||||
<!-- Side labels -->
|
||||
<g transform="translate(50, 290)">
|
||||
<text x="0" y="0" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#718096" transform="rotate(-90)">
|
||||
<text x="0" y="0" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#374151" transform="rotate(-90)">
|
||||
Data Flow Direction
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Stage indicators on the right -->
|
||||
<text x="730" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#718096">Raw Docs</text>
|
||||
<text x="730" y="175" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#718096">Clean Text</text>
|
||||
<text x="730" y="255" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#718096">Chunks</text>
|
||||
<text x="730" y="335" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#718096">Vectors</text>
|
||||
<text x="730" y="415" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#718096">Index</text>
|
||||
<text x="730" y="495" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#718096">Results</text>
|
||||
<text x="730" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#374151">Raw Docs</text>
|
||||
<text x="730" y="175" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#374151">Clean Text</text>
|
||||
<text x="730" y="255" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#374151">Chunks</text>
|
||||
<text x="730" y="335" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#374151">Vectors</text>
|
||||
<text x="730" y="415" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#374151">Index</text>
|
||||
<text x="730" y="495" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#374151">Results</text>
|
||||
|
||||
<!-- Performance metrics -->
|
||||
<rect x="100" y="540" width="600" height="40" fill="#f7fafc" stroke="#cbd5e0" stroke-width="1" stroke-dasharray="5,5" rx="4"/>
|
||||
<text x="400" y="565" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#4a5568" font-style="italic">
|
||||
<text x="400" y="565" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#4a5568" font-style="italic">
|
||||
Pipeline processes ~1000 documents/minute • Query latency <50ms (p99) • 95% semantic accuracy
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.7 KiB |
137
docs/src/chapter-03/assets/kb-architecture-pipeline.svg.backup
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
<?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)">
|
||||
<!-- Define gradients and filters -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="800" height="600" fill="#1F2937" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="24" font-weight="600" fill="#4B5563">
|
||||
Knowledge Base Architecture Pipeline
|
||||
</text>
|
||||
|
||||
<!-- Document Ingestion Layer -->
|
||||
<rect x="100" y="60" width="600" height="60" fill="url(#inputGrad)" stroke="#2563EB" stroke-width="2" rx="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="600" fill="#4B5563">
|
||||
Document Ingestion Layer
|
||||
</text>
|
||||
<text x="400" y="105" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
PDF • Word • Excel • Text • HTML • Markdown
|
||||
</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<path d="M 400 120 L 400 140" stroke="#2563EB" stroke-width="3" fill="none" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
|
||||
<!-- Preprocessing Pipeline -->
|
||||
<rect x="100" y="140" width="600" height="60" fill="url(#processGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Preprocessing Pipeline
|
||||
</text>
|
||||
<text x="400" y="185" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Extraction • Cleaning • Normalization • Validation
|
||||
</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<path d="M 400 200 L 400 220" stroke="#2563EB" stroke-width="3" fill="none" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
|
||||
<!-- Chunking Engine -->
|
||||
<rect x="100" y="220" width="600" height="60" fill="url(#processGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Intelligent Chunking Engine
|
||||
</text>
|
||||
<text x="400" y="265" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Semantic Segmentation • Overlap Management • Metadata Preservation
|
||||
</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<path d="M 400 280 L 400 300" stroke="#2563EB" stroke-width="3" fill="none" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
|
||||
<!-- Embedding Generation -->
|
||||
<rect x="100" y="300" width="600" height="60" fill="url(#embedGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Embedding Generation
|
||||
</text>
|
||||
<text x="400" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
BGE Models • Transformer Architecture • Dimensionality: 384/768
|
||||
</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<path d="M 400 360 L 400 380" stroke="#2563EB" stroke-width="3" fill="none" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
|
||||
<!-- Vector Index Layer -->
|
||||
<rect x="100" y="380" width="600" height="60" fill="url(#indexGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Vector Index Layer
|
||||
</text>
|
||||
<text x="400" y="425" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
HNSW Algorithm • Quantization • Distributed Sharding
|
||||
</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<path d="M 400 440 L 400 460" stroke="#2563EB" stroke-width="3" fill="none" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
|
||||
<!-- Retrieval Engine -->
|
||||
<rect x="100" y="460" width="600" height="60" fill="url(#retrievalGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="485" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Semantic Retrieval Engine
|
||||
</text>
|
||||
<text x="400" y="505" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Cosine Similarity • Hybrid Search • Re-ranking • Context Injection
|
||||
</text>
|
||||
|
||||
<!-- Side labels -->
|
||||
<g transform="translate(50, 290)">
|
||||
<text x="0" y="0" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" transform="rotate(-90)">
|
||||
Data Flow Direction
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Stage indicators on the right -->
|
||||
<text x="730" y="95" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Raw Docs</text>
|
||||
<text x="730" y="175" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Clean Text</text>
|
||||
<text x="730" y="255" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Chunks</text>
|
||||
<text x="730" y="335" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Vectors</text>
|
||||
<text x="730" y="415" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Index</text>
|
||||
<text x="730" y="495" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Results</text>
|
||||
|
||||
<!-- Performance metrics -->
|
||||
<rect x="100" y="540" width="600" height="40" fill="#4B5563" stroke="#2563EB" stroke-width="2" stroke-dasharray="5,5" rx="4" filter="url(#shadow)">
|
||||
<text x="400" y="565" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" font-style="italic">
|
||||
Pipeline processes ~1000 documents/minute • Query latency <50ms (p99) • 95% semantic accuracy
|
||||
</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.1 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="900" height="500" viewBox="0 0 900 500" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="900" height="500" viewBox="0 0 900 500" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Gradient for query stage -->
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="35" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="24" font-weight="600" fill="#1a202c">
|
||||
<text x="450" y="35" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="28" font-weight="600" fill="#1a202c">
|
||||
Semantic Search Pipeline
|
||||
</text>
|
||||
|
||||
|
|
@ -79,9 +79,9 @@
|
|||
<!-- Stage 1: User Query -->
|
||||
<g transform="translate(50, 0)">
|
||||
<rect x="0" y="0" width="160" height="80" fill="url(#queryGrad)" stroke="#667eea" stroke-width="2" rx="10" filter="url(#dropShadow)"/>
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui" font-size="14" font-weight="600" fill="#2d3748">User Query</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">"What's the return</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">policy?"</text>
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui" font-size="20" font-weight="600" fill="#2d3748">User Query</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">"What's the return</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">policy?"</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow 1 -->
|
||||
|
|
@ -90,9 +90,9 @@
|
|||
<!-- Stage 2: Query Embedding -->
|
||||
<g transform="translate(250, 0)">
|
||||
<rect x="0" y="0" width="160" height="80" fill="url(#embedSearchGrad)" stroke="#f5576c" stroke-width="2" rx="10" filter="url(#dropShadow)"/>
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui" font-size="14" font-weight="600" fill="#2d3748">Embedding</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">Transform to</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">384D vector</text>
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui" font-size="20" font-weight="600" fill="#2d3748">Embedding</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">Transform to</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">384D vector</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow 2 -->
|
||||
|
|
@ -101,9 +101,9 @@
|
|||
<!-- Stage 3: Vector Search -->
|
||||
<g transform="translate(450, 0)">
|
||||
<rect x="0" y="0" width="180" height="80" fill="url(#searchGrad)" stroke="#00f2fe" stroke-width="2" rx="10" filter="url(#dropShadow)"/>
|
||||
<text x="90" y="30" text-anchor="middle" font-family="system-ui" font-size="14" font-weight="600" fill="#2d3748">Vector Search</text>
|
||||
<text x="90" y="50" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">Cosine similarity</text>
|
||||
<text x="90" y="65" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">in vector space</text>
|
||||
<text x="90" y="30" text-anchor="middle" font-family="system-ui" font-size="20" font-weight="600" fill="#2d3748">Vector Search</text>
|
||||
<text x="90" y="50" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">Cosine similarity</text>
|
||||
<text x="90" y="65" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">in vector space</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow 3 -->
|
||||
|
|
@ -112,16 +112,16 @@
|
|||
<!-- Stage 4: Ranking -->
|
||||
<g transform="translate(670, 0)">
|
||||
<rect x="0" y="0" width="160" height="80" fill="url(#rankGrad)" stroke="#38f9d7" stroke-width="2" rx="10" filter="url(#dropShadow)"/>
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui" font-size="14" font-weight="600" fill="#2d3748">Re-ranking</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">Score & sort</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">by relevance</text>
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui" font-size="20" font-weight="600" fill="#2d3748">Re-ranking</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">Score & sort</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">by relevance</text>
|
||||
</g>
|
||||
|
||||
<!-- Collections being searched (below main flow) -->
|
||||
<g transform="translate(450, 140)">
|
||||
<rect x="0" y="0" width="180" height="60" fill="rgba(79, 172, 254, 0.1)" stroke="#4facfe" stroke-width="1.5" stroke-dasharray="5,5" rx="8"/>
|
||||
<text x="90" y="25" text-anchor="middle" font-family="system-ui" font-size="12" font-weight="500" fill="#2d3748">Active Collections</text>
|
||||
<text x="90" y="45" text-anchor="middle" font-family="system-ui" font-size="10" fill="#4a5568">policies • procedures • faq</text>
|
||||
<text x="90" y="25" text-anchor="middle" font-family="system-ui" font-size="18" font-weight="500" fill="#2d3748">Active Collections</text>
|
||||
<text x="90" y="45" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">policies • procedures • faq</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow from Vector Search to Collections -->
|
||||
|
|
@ -130,10 +130,10 @@
|
|||
<!-- Results -->
|
||||
<g transform="translate(350, 250)">
|
||||
<rect x="0" y="0" width="380" height="100" fill="url(#resultGrad)" stroke="#fa709a" stroke-width="2" rx="10" filter="url(#dropShadow)"/>
|
||||
<text x="190" y="30" text-anchor="middle" font-family="system-ui" font-size="14" font-weight="600" fill="#2d3748">Retrieved Context</text>
|
||||
<text x="60" y="55" text-anchor="start" font-family="system-ui" font-size="11" fill="#4a5568">1. "Refund policy: 30 days..." (0.92)</text>
|
||||
<text x="60" y="75" text-anchor="start" font-family="system-ui" font-size="11" fill="#4a5568">2. "Return procedures..." (0.87)</text>
|
||||
<text x="60" y="95" text-anchor="start" font-family="system-ui" font-size="11" fill="#4a5568">3. "Warranty information..." (0.81)</text>
|
||||
<text x="190" y="30" text-anchor="middle" font-family="system-ui" font-size="20" font-weight="600" fill="#2d3748">Retrieved Context</text>
|
||||
<text x="60" y="55" text-anchor="start" font-family="system-ui" font-size="16" fill="#4a5568">1. "Refund policy: 30 days..." (0.92)</text>
|
||||
<text x="60" y="75" text-anchor="start" font-family="system-ui" font-size="16" fill="#4a5568">2. "Return procedures..." (0.87)</text>
|
||||
<text x="60" y="95" text-anchor="start" font-family="system-ui" font-size="16" fill="#4a5568">3. "Warranty information..." (0.81)</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to Results -->
|
||||
|
|
@ -142,8 +142,8 @@
|
|||
<!-- LLM Integration -->
|
||||
<g transform="translate(350, 370)">
|
||||
<rect x="0" y="0" width="380" height="60" fill="rgba(102, 126, 234, 0.1)" stroke="#667eea" stroke-width="2" stroke-dasharray="8,4" rx="10"/>
|
||||
<text x="190" y="25" text-anchor="middle" font-family="system-ui" font-size="13" font-weight="600" fill="#2d3748">Context Injection to LLM</text>
|
||||
<text x="190" y="45" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568">Retrieved chunks provided as context for response generation</text>
|
||||
<text x="190" y="25" text-anchor="middle" font-family="system-ui" font-size="20" font-weight="600" fill="#2d3748">Context Injection to LLM</text>
|
||||
<text x="190" y="45" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568">Retrieved chunks provided as context for response generation</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to LLM -->
|
||||
|
|
@ -153,13 +153,13 @@
|
|||
|
||||
<!-- Side annotations -->
|
||||
<g transform="translate(40, 180)">
|
||||
<text x="0" y="0" text-anchor="start" font-family="system-ui" font-size="10" fill="#718096" font-style="italic">Automatic</text>
|
||||
<text x="0" y="15" text-anchor="start" font-family="system-ui" font-size="10" fill="#718096" font-style="italic">Process</text>
|
||||
<text x="0" y="0" text-anchor="start" font-family="system-ui" font-size="16" fill="#374151" font-style="italic">Automatic</text>
|
||||
<text x="0" y="15" text-anchor="start" font-family="system-ui" font-size="16" fill="#374151" font-style="italic">Process</text>
|
||||
</g>
|
||||
|
||||
<!-- Performance metrics -->
|
||||
<rect x="50" y="450" width="800" height="35" fill="rgba(203, 213, 224, 0.1)" stroke="#cbd5e0" stroke-width="1" stroke-dasharray="5,5" rx="6"/>
|
||||
<text x="450" y="472" text-anchor="middle" font-family="system-ui" font-size="11" fill="#4a5568" font-style="italic">
|
||||
<text x="450" y="472" text-anchor="middle" font-family="system-ui" font-size="16" fill="#4a5568" font-style="italic">
|
||||
Search latency: ~20ms • Embedding: BGE-small (384D) • Similarity threshold: 0.7 • Top-K: 5 chunks
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
138
docs/src/chapter-03/assets/search-pipeline.svg.backup
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 580" 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="580" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background with subtle gradient -->
|
||||
<rect x="0" y="0" width="900" height="500" fill="url(#bgGrad)" rx="8" filter="url(#shadow)">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="35" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="24" font-weight="600" fill="#4B5563">
|
||||
Semantic Search Pipeline
|
||||
</text>
|
||||
|
||||
<!-- Main flow container -->
|
||||
<g transform="translate(0, 70)">
|
||||
|
||||
<!-- Stage 1: User Query -->
|
||||
<g transform="translate(50, 0)">
|
||||
<rect x="0" y="0" width="160" height="80" fill="url(#queryGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#dropShadow)">
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">User Query</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">"What's the return</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">policy?"</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow 1 -->
|
||||
<path d="M 210 40 L 250 40" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#searchArrow)" opacity="0.6">
|
||||
|
||||
<!-- Stage 2: Query Embedding -->
|
||||
<g transform="translate(250, 0)">
|
||||
<rect x="0" y="0" width="160" height="80" fill="url(#embedSearchGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#dropShadow)">
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Embedding</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Transform to</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">384D vector</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow 2 -->
|
||||
<path d="M 410 40 L 450 40" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#searchArrow)" opacity="0.6">
|
||||
|
||||
<!-- Stage 3: Vector Search -->
|
||||
<g transform="translate(450, 0)">
|
||||
<rect x="0" y="0" width="180" height="80" fill="url(#searchGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#dropShadow)">
|
||||
<text x="90" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Vector Search</text>
|
||||
<text x="90" y="50" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Cosine similarity</text>
|
||||
<text x="90" y="65" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">in vector space</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow 3 -->
|
||||
<path d="M 630 40 L 670 40" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#searchArrow)" opacity="0.6">
|
||||
|
||||
<!-- Stage 4: Ranking -->
|
||||
<g transform="translate(670, 0)">
|
||||
<rect x="0" y="0" width="160" height="80" fill="url(#rankGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#dropShadow)">
|
||||
<text x="80" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Re-ranking</text>
|
||||
<text x="80" y="50" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Score & sort</text>
|
||||
<text x="80" y="65" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">by relevance</text>
|
||||
</g>
|
||||
|
||||
<!-- Collections being searched (below main flow) -->
|
||||
<g transform="translate(450, 140)">
|
||||
<rect x="0" y="0" width="180" height="60" fill="rgba(79, 172, 254, 0.1)" stroke="#2563EB" stroke-width="2" stroke-dasharray="5,5" rx="8" filter="url(#shadow)">
|
||||
<text x="90" y="25" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Active Collections</text>
|
||||
<text x="90" y="45" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">policies • procedures • faq</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow from Vector Search to Collections -->
|
||||
<path d="M 540 80 L 540 140" stroke="#2563EB" stroke-width="2" stroke-dasharray="4,4" fill="none" marker-end="url(#searchArrow)" opacity="0.4">
|
||||
|
||||
<!-- Results -->
|
||||
<g transform="translate(350, 250)">
|
||||
<rect x="0" y="0" width="380" height="100" fill="url(#resultGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#dropShadow)">
|
||||
<text x="190" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Retrieved Context</text>
|
||||
<text x="60" y="55" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1. "Refund policy: 30 days..." (0.92)</text>
|
||||
<text x="60" y="75" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">2. "Return procedures..." (0.87)</text>
|
||||
<text x="60" y="95" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">3. "Warranty information..." (0.81)</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to Results -->
|
||||
<path d="M 750 80 L 750 120 L 540 120 L 540 250" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#searchArrow)" opacity="0.6">
|
||||
|
||||
<!-- LLM Integration -->
|
||||
<g transform="translate(350, 370)">
|
||||
<rect x="0" y="0" width="380" height="60" fill="rgba(102, 126, 234, 0.1)" stroke="#2563EB" stroke-width="2" stroke-dasharray="8,4" rx="10" filter="url(#shadow)">
|
||||
<text x="190" y="25" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Context Injection to LLM</text>
|
||||
<text x="190" y="45" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Retrieved chunks provided as context for response generation</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow to LLM -->
|
||||
<path d="M 540 350 L 540 370" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#searchArrow)" opacity="0.6">
|
||||
|
||||
</g>
|
||||
|
||||
<!-- Side annotations -->
|
||||
<g transform="translate(40, 180)">
|
||||
<text x="0" y="0" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" font-style="italic" filter="url(#textShadow)">Automatic</text>
|
||||
<text x="0" y="15" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" font-style="italic" filter="url(#textShadow)" font-weight="600">Process</text>
|
||||
</g>
|
||||
|
||||
<!-- Performance metrics -->
|
||||
<rect x="50" y="450" width="800" height="35" fill="rgba(203, 213, 224, 0.1)" stroke="#2563EB" stroke-width="2" stroke-dasharray="5,5" rx="6" filter="url(#shadow)">
|
||||
<text x="450" y="472" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" font-style="italic">
|
||||
Search latency: ~20ms • Embedding: BGE-small (384D) • Similarity threshold: 0.7 • Top-K: 5 chunks
|
||||
</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.7 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="900" height="500" viewBox="0 0 900 500" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="900" height="500" viewBox="0 0 900 500" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Gradient for original context -->
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
<rect x="0" y="0" width="900" height="500" fill="#fafafa"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="600" fill="#1e293b">
|
||||
LLM Context Compression Strategies
|
||||
</text>
|
||||
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
<g transform="translate(50, 60)">
|
||||
<!-- Original context -->
|
||||
<rect x="0" y="0" width="800" height="60" fill="url(#origContextGrad)" stroke="#dc2626" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="10" y="20" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="10" y="20" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Original Context: 10,000 tokens
|
||||
</text>
|
||||
<rect x="10" y="30" width="780" height="20" fill="#fee2e2" rx="3"/>
|
||||
|
|
@ -84,14 +84,14 @@
|
|||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 450 130 L 450 160" stroke="#4a5568" stroke-width="3" fill="none" marker-end="url(#arrowhead3)" opacity="0.7"/>
|
||||
<text x="470" y="150" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#475569">
|
||||
<text x="470" y="150" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#475569">
|
||||
Compression Level 4
|
||||
</text>
|
||||
|
||||
<!-- Compressed context -->
|
||||
<g transform="translate(200, 170)">
|
||||
<rect x="0" y="0" width="500" height="60" fill="url(#compContextGrad)" stroke="#10b981" stroke-width="2" rx="6" filter="url(#shadow)"/>
|
||||
<text x="10" y="20" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="10" y="20" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Compressed Context: 4,096 tokens (fits LLM window)
|
||||
</text>
|
||||
<rect x="10" y="30" width="480" height="20" fill="#dcfce7" rx="3"/>
|
||||
|
|
@ -107,27 +107,27 @@
|
|||
|
||||
<!-- Compression Techniques -->
|
||||
<g transform="translate(50, 260)">
|
||||
<text x="400" y="0" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="0" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#1e293b">
|
||||
Compression Techniques (Level 4)
|
||||
</text>
|
||||
|
||||
<!-- Technique 1: Semantic Deduplication -->
|
||||
<g transform="translate(0, 30)">
|
||||
<rect x="0" y="0" width="190" height="140" fill="url(#tech1Grad)" stroke="#8b5cf6" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
Semantic Deduplication
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Remove redundant info
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Merge similar chunks
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Keep unique facts
|
||||
</text>
|
||||
<rect x="10" y="85" width="170" height="25" fill="rgba(139, 92, 246, 0.1)" rx="4"/>
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#7c3aed">
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#7c3aed">
|
||||
Reduction: 30-40%
|
||||
</text>
|
||||
|
||||
|
|
@ -142,20 +142,20 @@
|
|||
<!-- Technique 2: Relevance Scoring -->
|
||||
<g transform="translate(205, 30)">
|
||||
<rect x="0" y="0" width="190" height="140" fill="url(#tech2Grad)" stroke="#3b82f6" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
Relevance Scoring
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Score by query match
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Keep top-k relevant
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Drop low scores
|
||||
</text>
|
||||
<rect x="10" y="85" width="170" height="25" fill="rgba(59, 130, 246, 0.1)" rx="4"/>
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#2563eb">
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#2563eb">
|
||||
Reduction: 40-50%
|
||||
</text>
|
||||
|
||||
|
|
@ -168,20 +168,20 @@
|
|||
<!-- Technique 3: Hierarchical Summary -->
|
||||
<g transform="translate(410, 30)">
|
||||
<rect x="0" y="0" width="190" height="140" fill="url(#tech3Grad)" stroke="#06b6d4" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
Hierarchical Summary
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Extract key points
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Create abstracts
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Preserve details
|
||||
</text>
|
||||
<rect x="10" y="85" width="170" height="25" fill="rgba(6, 182, 212, 0.1)" rx="4"/>
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#0891b2">
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#0891b2">
|
||||
Reduction: 50-60%
|
||||
</text>
|
||||
|
||||
|
|
@ -200,28 +200,28 @@
|
|||
<!-- Technique 4: Token Optimization -->
|
||||
<g transform="translate(615, 30)">
|
||||
<rect x="0" y="0" width="185" height="140" fill="url(#tech4Grad)" stroke="#f59e0b" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="92" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">
|
||||
<text x="92" y="20" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
Token Optimization
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="40" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Remove stopwords
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="55" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Compress phrases
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="10" y="70" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Use abbreviations
|
||||
</text>
|
||||
<rect x="10" y="85" width="165" height="25" fill="rgba(245, 158, 11, 0.1)" rx="4"/>
|
||||
<text x="92" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" font-weight="500" fill="#d97706">
|
||||
<text x="92" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#d97706">
|
||||
Reduction: 20-30%
|
||||
</text>
|
||||
|
||||
<!-- Text compression visual -->
|
||||
<text x="92" y="122" text-anchor="middle" font-family="monospace" font-size="9" fill="#92400e">
|
||||
<text x="92" y="122" text-anchor="middle" font-family="monospace" font-size="16" fill="#92400e">
|
||||
ABCDEF → ABC
|
||||
</text>
|
||||
<text x="92" y="133" text-anchor="middle" font-family="monospace" font-size="9" fill="#92400e">
|
||||
<text x="92" y="133" text-anchor="middle" font-family="monospace" font-size="16" fill="#92400e">
|
||||
GHIJKL → GHI
|
||||
</text>
|
||||
</g>
|
||||
|
|
@ -229,7 +229,7 @@
|
|||
|
||||
<!-- Performance note -->
|
||||
<rect x="50" y="440" width="800" height="40" fill="rgba(99, 102, 241, 0.05)" stroke="#6366f1" stroke-width="1.5" stroke-dasharray="6,3" rx="6"/>
|
||||
<text x="450" y="465" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-style="italic" fill="#4f46e5">
|
||||
<text x="450" y="465" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-style="italic" fill="#4f46e5">
|
||||
Compression Level 4 achieves 60-75% reduction while maintaining 95%+ information retention
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
218
docs/src/chapter-03/assets/storage-breakdown.svg.backup
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 580" 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="580" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="900" height="500" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#4B5563">
|
||||
LLM Context Compression Strategies
|
||||
</text>
|
||||
|
||||
<!-- Context Window Visualization -->
|
||||
<g transform="translate(50, 60)">
|
||||
<!-- Original context -->
|
||||
<rect x="0" y="0" width="800" height="60" fill="url(#origContextGrad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="10" y="20" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Original Context: 10,000 tokens
|
||||
</text>
|
||||
<rect x="10" y="30" width="780" height="20" fill="#1F2937" rx="3" filter="url(#shadow)">
|
||||
|
||||
<!-- Document chunks visualization -->
|
||||
<rect x="10" y="30" width="100" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="112" y="30" width="120" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="234" y="30" width="90" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="326" y="30" width="110" height="20" fill="#1F2937" rx="2" filter="url(#shadow)">
|
||||
<rect x="438" y="30" width="95" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="535" y="30" width="105" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="642" y="30" width="80" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="724" y="30" width="66" height="20" fill="#1F2937" rx="2" filter="url(#shadow)">
|
||||
</g>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 450 130 L 450 160" stroke="#2563EB" stroke-width="3" fill="none" marker-end="url(#arrowhead3)" opacity="0.7">
|
||||
<text x="470" y="150" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Compression Level 4
|
||||
</text>
|
||||
|
||||
<!-- Compressed context -->
|
||||
<g transform="translate(200, 170)">
|
||||
<rect x="0" y="0" width="500" height="60" fill="url(#compContextGrad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="10" y="20" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Compressed Context: 4,096 tokens (fits LLM window)
|
||||
</text>
|
||||
<rect x="10" y="30" width="480" height="20" fill="#4B5563" rx="3" filter="url(#shadow)">
|
||||
|
||||
<!-- Compressed chunks -->
|
||||
<rect x="10" y="30" width="80" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="92" y="30" width="70" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="164" y="30" width="75" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="241" y="30" width="85" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="328" y="30" width="90" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="420" y="30" width="70" height="20" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
</g>
|
||||
|
||||
<!-- Compression Techniques -->
|
||||
<g transform="translate(50, 260)">
|
||||
<text x="400" y="0" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Compression Techniques (Level 4)
|
||||
</text>
|
||||
|
||||
<!-- Technique 1: Semantic Deduplication -->
|
||||
<g transform="translate(0, 30)">
|
||||
<rect x="0" y="0" width="190" height="140" fill="url(#tech1Grad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Semantic Deduplication
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Remove redundant info
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Merge similar chunks
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Keep unique facts
|
||||
</text>
|
||||
<rect x="10" y="85" width="170" height="25" fill="rgba(139, 92, 246, 0.1)" rx="4" filter="url(#shadow)">
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Reduction: 30-40%
|
||||
</text>
|
||||
|
||||
<!-- Visual representation -->
|
||||
<g transform="translate(95, 120)">
|
||||
<circle cx="0" cy="0" r="8" fill="#4B5563" opacity="0.3">
|
||||
<circle cx="-15" cy="0" r="8" fill="#4B5563" opacity="0.3">
|
||||
<circle cx="15" cy="0" r="8" fill="#4B5563" opacity="0.3">
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Technique 2: Relevance Scoring -->
|
||||
<g transform="translate(205, 30)">
|
||||
<rect x="0" y="0" width="190" height="140" fill="url(#tech2Grad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Relevance Scoring
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Score by query match
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Keep top-k relevant
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Drop low scores
|
||||
</text>
|
||||
<rect x="10" y="85" width="170" height="25" fill="rgba(59, 130, 246, 0.1)" rx="4" filter="url(#shadow)">
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Reduction: 40-50%
|
||||
</text>
|
||||
|
||||
<!-- Visual bars -->
|
||||
<rect x="50" y="118" width="90" height="4" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="50" y="124" width="70" height="4" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
<rect x="50" y="130" width="40" height="4" fill="#4B5563" rx="2" filter="url(#shadow)">
|
||||
</g>
|
||||
|
||||
<!-- Technique 3: Hierarchical Summary -->
|
||||
<g transform="translate(410, 30)">
|
||||
<rect x="0" y="0" width="190" height="140" fill="url(#tech3Grad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="95" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Hierarchical Summary
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Extract key points
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Create abstracts
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Preserve details
|
||||
</text>
|
||||
<rect x="10" y="85" width="170" height="25" fill="rgba(6, 182, 212, 0.1)" rx="4" filter="url(#shadow)">
|
||||
<text x="95" y="102" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Reduction: 50-60%
|
||||
</text>
|
||||
|
||||
<!-- Tree structure -->
|
||||
<g transform="translate(95, 120)">
|
||||
<circle cx="0" cy="-8" r="4" fill="#4B5563">
|
||||
<circle cx="-15" cy="8" r="3" fill="#4B5563">
|
||||
<circle cx="0" cy="8" r="3" fill="#4B5563">
|
||||
<circle cx="15" cy="8" r="3" fill="#4B5563">
|
||||
<line x1="0" y1="-4" x2="-15" y2="5" stroke="#2563EB" stroke-width="2">
|
||||
<line x1="0" y1="-4" x2="0" y2="5" stroke="#2563EB" stroke-width="2">
|
||||
<line x1="0" y1="-4" x2="15" y2="5" stroke="#2563EB" stroke-width="2">
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Technique 4: Token Optimization -->
|
||||
<g transform="translate(615, 30)">
|
||||
<rect x="0" y="0" width="185" height="140" fill="url(#tech4Grad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="92" y="20" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Token Optimization
|
||||
</text>
|
||||
<text x="10" y="40" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Remove stopwords
|
||||
</text>
|
||||
<text x="10" y="55" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Compress phrases
|
||||
</text>
|
||||
<text x="10" y="70" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Use abbreviations
|
||||
</text>
|
||||
<rect x="10" y="85" width="165" height="25" fill="rgba(245, 158, 11, 0.1)" rx="4" filter="url(#shadow)">
|
||||
<text x="92" y="102" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Reduction: 20-30%
|
||||
</text>
|
||||
|
||||
<!-- Text compression visual -->
|
||||
<text x="92" y="122" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
ABCDEF → ABC
|
||||
</text>
|
||||
<text x="92" y="133" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
GHIJKL → GHI
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Performance note -->
|
||||
<rect x="50" y="440" width="800" height="40" fill="rgba(99, 102, 241, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="6,3" rx="6" filter="url(#shadow)">
|
||||
<text x="450" y="465" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-style="italic" fill="#4B5563">
|
||||
Compression Level 4 achieves 60-75% reduction while maintaining 95%+ information retention
|
||||
</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="900" height="400" viewBox="0 0 900 400" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="900" height="400" viewBox="0 0 900 400" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Gradient for bars -->
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
<rect x="0" y="0" width="900" height="400" fill="#fafafa"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="600" fill="#1e293b">
|
||||
Storage Components per 1TB of Documents
|
||||
</text>
|
||||
|
||||
|
|
@ -67,61 +67,61 @@
|
|||
<line x1="100" y1="60" x2="100" y2="320" stroke="#475569" stroke-width="2"/>
|
||||
|
||||
<!-- Y-axis labels -->
|
||||
<text x="90" y="325" text-anchor="end" font-family="system-ui, sans-serif" font-size="11" fill="#64748b">0 GB</text>
|
||||
<text x="90" y="260" text-anchor="end" font-family="system-ui, sans-serif" font-size="11" fill="#64748b">250 GB</text>
|
||||
<text x="90" y="195" text-anchor="end" font-family="system-ui, sans-serif" font-size="11" fill="#64748b">500 GB</text>
|
||||
<text x="90" y="130" text-anchor="end" font-family="system-ui, sans-serif" font-size="11" fill="#64748b">750 GB</text>
|
||||
<text x="90" y="65" text-anchor="end" font-family="system-ui, sans-serif" font-size="11" fill="#64748b">1000 GB</text>
|
||||
<text x="90" y="325" text-anchor="end" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">0 GB</text>
|
||||
<text x="90" y="260" text-anchor="end" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">250 GB</text>
|
||||
<text x="90" y="195" text-anchor="end" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">500 GB</text>
|
||||
<text x="90" y="130" text-anchor="end" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">750 GB</text>
|
||||
<text x="90" y="65" text-anchor="end" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">1000 GB</text>
|
||||
|
||||
<!-- Y-axis title -->
|
||||
<text x="30" y="190" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" fill="#475569" transform="rotate(-90 30 190)">
|
||||
<text x="30" y="190" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" fill="#475569" transform="rotate(-90 30 190)">
|
||||
Storage Size (GB)
|
||||
</text>
|
||||
|
||||
<!-- Bars -->
|
||||
<!-- Original -->
|
||||
<rect x="150" y="60" width="80" height="260" fill="url(#barGrad1)" stroke="#3b82f6" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="190" y="80" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="white">1000</text>
|
||||
<text x="190" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">Original</text>
|
||||
<text x="190" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">1000 GB</text>
|
||||
<text x="190" y="80" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="white">1000</text>
|
||||
<text x="190" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">Original</text>
|
||||
<text x="190" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">1000 GB</text>
|
||||
|
||||
<!-- Text Extracted -->
|
||||
<rect x="260" y="112" width="80" height="208" fill="url(#barGrad2)" stroke="#10b981" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="300" y="132" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="white">800</text>
|
||||
<text x="300" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">Extracted</text>
|
||||
<text x="300" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">800 GB</text>
|
||||
<text x="300" y="132" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="white">800</text>
|
||||
<text x="300" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">Extracted</text>
|
||||
<text x="300" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">800 GB</text>
|
||||
|
||||
<!-- Embeddings -->
|
||||
<rect x="370" y="8" width="80" height="312" fill="url(#barGrad3)" stroke="#8b5cf6" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="410" y="28" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="white">1200</text>
|
||||
<text x="410" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">Embeddings</text>
|
||||
<text x="410" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">1200 GB</text>
|
||||
<text x="410" y="28" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="white">1200</text>
|
||||
<text x="410" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">Embeddings</text>
|
||||
<text x="410" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">1200 GB</text>
|
||||
|
||||
<!-- Index -->
|
||||
<rect x="480" y="164" width="80" height="156" fill="url(#barGrad4)" stroke="#f59e0b" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="520" y="184" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="white">600</text>
|
||||
<text x="520" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">Index</text>
|
||||
<text x="520" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">600 GB</text>
|
||||
<text x="520" y="184" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="white">600</text>
|
||||
<text x="520" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">Index</text>
|
||||
<text x="520" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">600 GB</text>
|
||||
|
||||
<!-- Metadata -->
|
||||
<rect x="590" y="216" width="80" height="104" fill="url(#barGrad5)" stroke="#ef4444" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="630" y="236" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="white">400</text>
|
||||
<text x="630" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">Metadata</text>
|
||||
<text x="630" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">400 GB</text>
|
||||
<text x="630" y="236" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="white">400</text>
|
||||
<text x="630" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">Metadata</text>
|
||||
<text x="630" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">400 GB</text>
|
||||
|
||||
<!-- Cache -->
|
||||
<rect x="700" y="190" width="80" height="130" fill="url(#barGrad6)" stroke="#06b6d4" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="740" y="210" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="white">500</text>
|
||||
<text x="740" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">Cache</text>
|
||||
<text x="740" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">500 GB</text>
|
||||
<text x="740" y="210" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="white">500</text>
|
||||
<text x="740" y="340" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">Cache</text>
|
||||
<text x="740" y="355" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">500 GB</text>
|
||||
|
||||
<!-- Total line -->
|
||||
<line x1="150" y1="45" x2="780" y2="45" stroke="#dc2626" stroke-width="3" stroke-dasharray="8,4"/>
|
||||
<rect x="790" y="35" width="90" height="25" fill="#fee2e2" stroke="#dc2626" stroke-width="2" rx="4"/>
|
||||
<text x="835" y="52" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#dc2626">3.5 TB Total</text>
|
||||
<text x="835" y="52" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#dc2626">3.5 TB Total</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g transform="translate(120, 375)">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="11" fill="#475569">Components contribute to 3.5× storage multiplication factor</text>
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Components contribute to 3.5× storage multiplication factor</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.7 KiB |
118
docs/src/chapter-03/assets/storage-multiplication.svg.backup
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 480" 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="480" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="900" height="400" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#4B5563">
|
||||
Storage Components per 1TB of Documents
|
||||
</text>
|
||||
|
||||
<!-- Chart area -->
|
||||
<rect x="100" y="60" width="700" height="260" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
|
||||
<!-- Grid lines -->
|
||||
<line x1="100" y1="125" x2="800" y2="125" stroke="#2563EB" stroke-width="2" stroke-dasharray="2,2" opacity="0.5">
|
||||
<line x1="100" y1="190" x2="800" y2="190" stroke="#2563EB" stroke-width="2" stroke-dasharray="2,2" opacity="0.5">
|
||||
<line x1="100" y1="255" x2="800" y2="255" stroke="#2563EB" stroke-width="2" stroke-dasharray="2,2" opacity="0.5">
|
||||
|
||||
<!-- Axes -->
|
||||
<line x1="100" y1="320" x2="800" y2="320" stroke="#2563EB" stroke-width="2">
|
||||
<line x1="100" y1="60" x2="100" y2="320" stroke="#2563EB" stroke-width="2">
|
||||
|
||||
<!-- Y-axis labels -->
|
||||
<text x="90" y="325" text-anchor="end" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">0 GB</text>
|
||||
<text x="90" y="260" text-anchor="end" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">250 GB</text>
|
||||
<text x="90" y="195" text-anchor="end" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">500 GB</text>
|
||||
<text x="90" y="130" text-anchor="end" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">750 GB</text>
|
||||
<text x="90" y="65" text-anchor="end" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1000 GB</text>
|
||||
|
||||
<!-- Y-axis title -->
|
||||
<text x="30" y="190" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" transform="rotate(-90 30 190)">
|
||||
Storage Size (GB)
|
||||
</text>
|
||||
|
||||
<!-- Bars -->
|
||||
<!-- Original -->
|
||||
<rect x="150" y="60" width="80" height="260" fill="url(#barGrad1)" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)">
|
||||
<text x="190" y="80" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="white" filter="url(#textShadow)">1000</text>
|
||||
<text x="190" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Original</text>
|
||||
<text x="190" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1000 GB</text>
|
||||
|
||||
<!-- Text Extracted -->
|
||||
<rect x="260" y="112" width="80" height="208" fill="url(#barGrad2)" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)">
|
||||
<text x="300" y="132" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="white" filter="url(#textShadow)">800</text>
|
||||
<text x="300" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Extracted</text>
|
||||
<text x="300" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">800 GB</text>
|
||||
|
||||
<!-- Embeddings -->
|
||||
<rect x="370" y="8" width="80" height="312" fill="url(#barGrad3)" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)">
|
||||
<text x="410" y="28" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="white" filter="url(#textShadow)">1200</text>
|
||||
<text x="410" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Embeddings</text>
|
||||
<text x="410" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1200 GB</text>
|
||||
|
||||
<!-- Index -->
|
||||
<rect x="480" y="164" width="80" height="156" fill="url(#barGrad4)" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)">
|
||||
<text x="520" y="184" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="white" filter="url(#textShadow)">600</text>
|
||||
<text x="520" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Index</text>
|
||||
<text x="520" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">600 GB</text>
|
||||
|
||||
<!-- Metadata -->
|
||||
<rect x="590" y="216" width="80" height="104" fill="url(#barGrad5)" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)">
|
||||
<text x="630" y="236" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="white" filter="url(#textShadow)">400</text>
|
||||
<text x="630" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Metadata</text>
|
||||
<text x="630" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">400 GB</text>
|
||||
|
||||
<!-- Cache -->
|
||||
<rect x="700" y="190" width="80" height="130" fill="url(#barGrad6)" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)">
|
||||
<text x="740" y="210" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="white" filter="url(#textShadow)">500</text>
|
||||
<text x="740" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Cache</text>
|
||||
<text x="740" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">500 GB</text>
|
||||
|
||||
<!-- Total line -->
|
||||
<line x1="150" y1="45" x2="780" y2="45" stroke="#2563EB" stroke-width="3" stroke-dasharray="8,4">
|
||||
<rect x="790" y="35" width="90" height="25" fill="#1F2937" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)">
|
||||
<text x="835" y="52" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">3.5 TB Total</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g transform="translate(120, 375)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Components contribute to 3.5× storage multiplication factor</text>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="900" height="450" viewBox="0 0 900 450" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="900" height="450" viewBox="0 0 900 450" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Gradient for embedding section -->
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<rect x="0" y="0" width="900" height="450" fill="#fafafa"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="600" fill="#1e293b">
|
||||
System Technical Specifications
|
||||
</text>
|
||||
|
||||
|
|
@ -47,23 +47,23 @@
|
|||
<!-- Embedding Configuration Section -->
|
||||
<g transform="translate(70, 80)">
|
||||
<rect x="0" y="0" width="350" height="150" fill="url(#embeddingGrad)" stroke="#667eea" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="175" y="25" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#1e293b">
|
||||
<text x="175" y="25" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#1e293b">
|
||||
Embedding Configuration
|
||||
</text>
|
||||
|
||||
<text x="15" y="50" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">
|
||||
<text x="15" y="50" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">
|
||||
Model: bge-small-en-v1.5-f32.gguf
|
||||
</text>
|
||||
<text x="15" y="70" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="70" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Dimensions: 384
|
||||
</text>
|
||||
<text x="15" y="90" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="90" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Format: GGUF (quantized)
|
||||
</text>
|
||||
<text x="15" y="110" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="110" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Server: localhost:8082
|
||||
</text>
|
||||
<text x="15" y="130" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="130" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Memory: ~200MB loaded
|
||||
</text>
|
||||
</g>
|
||||
|
|
@ -71,23 +71,23 @@
|
|||
<!-- LLM Configuration Section -->
|
||||
<g transform="translate(450, 80)">
|
||||
<rect x="0" y="0" width="350" height="150" fill="url(#llmGrad)" stroke="#00d2ff" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="175" y="25" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#1e293b">
|
||||
<text x="175" y="25" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#1e293b">
|
||||
LLM Configuration
|
||||
</text>
|
||||
|
||||
<text x="15" y="50" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">
|
||||
<text x="15" y="50" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">
|
||||
Model: DeepSeek-R1-Distill-Qwen-1.5B
|
||||
</text>
|
||||
<text x="15" y="70" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="70" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Context Size: 4096 tokens
|
||||
</text>
|
||||
<text x="15" y="90" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="90" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Max Predict: 1024 tokens
|
||||
</text>
|
||||
<text x="15" y="110" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="110" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Parallel Requests: 6
|
||||
</text>
|
||||
<text x="15" y="130" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="15" y="130" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Quantization: Q3_K_M
|
||||
</text>
|
||||
</g>
|
||||
|
|
@ -95,54 +95,54 @@
|
|||
<!-- Performance Characteristics Section -->
|
||||
<g transform="translate(70, 250)">
|
||||
<rect x="0" y="0" width="730" height="150" fill="url(#perfGrad)" stroke="#f5576c" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="365" y="25" text-anchor="middle" font-family="system-ui, sans-serif" font-size="15" font-weight="600" fill="#1e293b">
|
||||
<text x="365" y="25" text-anchor="middle" font-family="system-ui, sans-serif" font-size="19" font-weight="600" fill="#1e293b">
|
||||
Performance Characteristics
|
||||
</text>
|
||||
|
||||
<!-- Left column - Vector Index -->
|
||||
<g transform="translate(15, 45)">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">
|
||||
Vector Index: HNSW Algorithm
|
||||
</text>
|
||||
<text x="0" y="20" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="20" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• M=16, ef_construction=200
|
||||
</text>
|
||||
<text x="0" y="40" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="40" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Distance: Cosine Similarity
|
||||
</text>
|
||||
<text x="0" y="60" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="60" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Build: ~1000 docs/minute
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Middle column - Chunking Strategy -->
|
||||
<g transform="translate(250, 45)">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">
|
||||
Chunking Strategy
|
||||
</text>
|
||||
<text x="0" y="20" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="20" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Chunk Size: 512 tokens
|
||||
</text>
|
||||
<text x="0" y="40" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="40" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Overlap: 50 tokens
|
||||
</text>
|
||||
<text x="0" y="60" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="60" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Prompt Compact: Level 4
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Right column - Runtime Metrics -->
|
||||
<g transform="translate(490, 45)">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">
|
||||
Runtime Metrics
|
||||
</text>
|
||||
<text x="0" y="20" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="20" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Query Latency: <50ms p99
|
||||
</text>
|
||||
<text x="0" y="40" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="40" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Memory: ~1GB/million chunks
|
||||
</text>
|
||||
<text x="0" y="60" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="0" y="60" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Cache TTL: 3600 seconds
|
||||
</text>
|
||||
</g>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.6 KiB |
161
docs/src/chapter-03/assets/technical-specs.svg.backup
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 530" 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="530" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="900" height="450" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#4B5563">
|
||||
System Technical Specifications
|
||||
</text>
|
||||
|
||||
<!-- Main container -->
|
||||
<rect x="50" y="50" width="800" height="380" fill="none" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
|
||||
<!-- Embedding Configuration Section -->
|
||||
<g transform="translate(70, 80)">
|
||||
<rect x="0" y="0" width="350" height="150" fill="url(#embeddingGrad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="175" y="25" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Embedding Configuration
|
||||
</text>
|
||||
|
||||
<text x="15" y="50" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Model: bge-small-en-v1.5-f32.gguf
|
||||
</text>
|
||||
<text x="15" y="70" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Dimensions: 384
|
||||
</text>
|
||||
<text x="15" y="90" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Format: GGUF (quantized)
|
||||
</text>
|
||||
<text x="15" y="110" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Server: localhost:8082
|
||||
</text>
|
||||
<text x="15" y="130" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Memory: ~200MB loaded
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- LLM Configuration Section -->
|
||||
<g transform="translate(450, 80)">
|
||||
<rect x="0" y="0" width="350" height="150" fill="url(#llmGrad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="175" y="25" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
LLM Configuration
|
||||
</text>
|
||||
|
||||
<text x="15" y="50" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Model: DeepSeek-R1-Distill-Qwen-1.5B
|
||||
</text>
|
||||
<text x="15" y="70" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Context Size: 4096 tokens
|
||||
</text>
|
||||
<text x="15" y="90" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Max Predict: 1024 tokens
|
||||
</text>
|
||||
<text x="15" y="110" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Parallel Requests: 6
|
||||
</text>
|
||||
<text x="15" y="130" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Quantization: Q3_K_M
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Performance Characteristics Section -->
|
||||
<g transform="translate(70, 250)">
|
||||
<rect x="0" y="0" width="730" height="150" fill="url(#perfGrad)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="365" y="25" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Performance Characteristics
|
||||
</text>
|
||||
|
||||
<!-- Left column - Vector Index -->
|
||||
<g transform="translate(15, 45)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Vector Index: HNSW Algorithm
|
||||
</text>
|
||||
<text x="0" y="20" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• M=16, ef_construction=200
|
||||
</text>
|
||||
<text x="0" y="40" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Distance: Cosine Similarity
|
||||
</text>
|
||||
<text x="0" y="60" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Build: ~1000 docs/minute
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Middle column - Chunking Strategy -->
|
||||
<g transform="translate(250, 45)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Chunking Strategy
|
||||
</text>
|
||||
<text x="0" y="20" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Chunk Size: 512 tokens
|
||||
</text>
|
||||
<text x="0" y="40" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Overlap: 50 tokens
|
||||
</text>
|
||||
<text x="0" y="60" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Prompt Compact: Level 4
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Right column - Runtime Metrics -->
|
||||
<g transform="translate(490, 45)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Runtime Metrics
|
||||
</text>
|
||||
<text x="0" y="20" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Query Latency: <50ms p99
|
||||
</text>
|
||||
<text x="0" y="40" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Memory: ~1GB/million chunks
|
||||
</text>
|
||||
<text x="0" y="60" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Cache TTL: 3600 seconds
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Additional specs indicators -->
|
||||
<g transform="translate(820, 100)">
|
||||
<circle cx="0" cy="0" r="3" fill="#4B5563">
|
||||
<circle cx="0" cy="20" r="3" fill="#4B5563">
|
||||
<circle cx="0" cy="40" r="3" fill="#4B5563">
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.7 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="800" height="420" viewBox="0 0 800 420" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="420" viewBox="0 0 800 420" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and filters -->
|
||||
<defs>
|
||||
<!-- Soft glow filter -->
|
||||
|
|
@ -85,22 +85,22 @@
|
|||
|
||||
<!-- Title with background -->
|
||||
<rect x="250" y="15" width="300" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8"/>
|
||||
<text x="400" y="38" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="19" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="38" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="23" font-weight="600" fill="#1e293b">
|
||||
BASIC LLM Tool Execution Flow
|
||||
</text>
|
||||
|
||||
<!-- Stage 1: User Input -->
|
||||
<rect x="50" y="70" width="140" height="55" fill="url(#userGrad)" stroke="#667eea" stroke-width="2" rx="10" filter="url(#shadow)"/>
|
||||
<text x="120" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">USER</text>
|
||||
<text x="120" y="112" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">"What's the policy?"</text>
|
||||
<text x="120" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">USER</text>
|
||||
<text x="120" y="112" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">"What's the policy?"</text>
|
||||
|
||||
<!-- Elegant flow arrow 1 -->
|
||||
<path d="M 190 97 C 220 97, 230 97, 260 97" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7" stroke-linecap="round"/>
|
||||
|
||||
<!-- Stage 2: LLM Processing -->
|
||||
<rect x="260" y="70" width="280" height="55" fill="url(#llmGrad)" stroke="#00d2ff" stroke-width="2" rx="10" filter="url(#shadow)"/>
|
||||
<text x="400" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">LLM + CONTEXT</text>
|
||||
<text x="400" y="112" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">Understands intent + loaded KBs</text>
|
||||
<text x="400" y="95" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">LLM + CONTEXT</text>
|
||||
<text x="400" y="112" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Understands intent + loaded KBs</text>
|
||||
|
||||
<!-- Elegant flow arrow 2 -->
|
||||
<path d="M 540 97 C 560 97, 580 97, 600 97" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7" stroke-linecap="round"/>
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
<g filter="url(#glow)">
|
||||
<path d="M 650 70 L 700 97 L 650 124 L 600 97 Z" fill="rgba(139, 92, 246, 0.15)" stroke="#8b5cf6" stroke-width="2.5"/>
|
||||
<circle cx="650" cy="97" r="10" fill="#8b5cf6" opacity="0.3"/>
|
||||
<text x="650" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="600" fill="#1e293b">Tool?</text>
|
||||
<text x="650" y="102" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="#1e293b">Tool?</text>
|
||||
</g>
|
||||
|
||||
<!-- Direct Response Path - graceful curve -->
|
||||
|
|
@ -119,40 +119,40 @@
|
|||
|
||||
<!-- Label for direct path -->
|
||||
<rect x="350" y="25" width="100" height="22" fill="rgba(16, 185, 129, 0.1)" rx="5"/>
|
||||
<text x="400" y="40" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" font-weight="500" fill="#047857">Direct Answer</text>
|
||||
<text x="400" y="40" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#047857">Direct Answer</text>
|
||||
|
||||
<!-- Tool Path - smooth descent -->
|
||||
<path d="M 650 124 C 650 160, 650 170, 650 200" stroke="url(#toolPathGrad)" stroke-width="3" fill="none" marker-end="url(#arrowOrange)" opacity="0.8" stroke-linecap="round"/>
|
||||
|
||||
<!-- Label for tool path -->
|
||||
<text x="670" y="165" text-anchor="start" font-family="system-ui, sans-serif" font-size="10" font-weight="500" fill="#d97706">Call Tool</text>
|
||||
<text x="670" y="165" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#d97706">Call Tool</text>
|
||||
|
||||
<!-- Stage 4: BASIC Tool -->
|
||||
<rect x="560" y="200" width="180" height="75" fill="url(#toolGrad)" stroke="#ff6b6b" stroke-width="2" rx="10" filter="url(#shadow)"/>
|
||||
<text x="650" y="225" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">BASIC TOOL</text>
|
||||
<text x="650" y="245" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">enrollment.bas</text>
|
||||
<text x="650" y="260" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">PARAM name, course</text>
|
||||
<text x="650" y="225" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">BASIC TOOL</text>
|
||||
<text x="650" y="245" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">enrollment.bas</text>
|
||||
<text x="650" y="260" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">PARAM name, course</text>
|
||||
|
||||
<!-- Tool Return Path - smooth curve -->
|
||||
<path d="M 560 237 C 490 237, 430 220, 400 195" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.6" stroke-linecap="round"/>
|
||||
|
||||
<!-- Stage 5: Response Generation -->
|
||||
<rect x="310" y="170" width="180" height="55" fill="url(#responseGrad)" stroke="#4facfe" stroke-width="2" rx="10" filter="url(#shadow)"/>
|
||||
<text x="400" y="195" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">RESPONSE</text>
|
||||
<text x="400" y="212" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">Generate natural answer</text>
|
||||
<text x="400" y="195" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">RESPONSE</text>
|
||||
<text x="400" y="212" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Generate natural answer</text>
|
||||
|
||||
<!-- Final Arrow -->
|
||||
<path d="M 310 197 C 280 197, 240 197, 210 197" stroke="#4a5568" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7" stroke-linecap="round"/>
|
||||
|
||||
<!-- Stage 6: Bot Output -->
|
||||
<rect x="50" y="170" width="140" height="55" fill="url(#userGrad)" stroke="#764ba2" stroke-width="2" rx="10" filter="url(#shadow)"/>
|
||||
<text x="120" y="195" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">BOT</text>
|
||||
<text x="120" y="212" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">"30-day return..."</text>
|
||||
<text x="120" y="195" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">BOT</text>
|
||||
<text x="120" y="212" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">"30-day return..."</text>
|
||||
|
||||
<!-- Memory Store - elegant and subtle -->
|
||||
<rect x="350" y="290" width="320" height="55" fill="url(#memoryGrad)" stroke="#f5576c" stroke-width="1.5" stroke-dasharray="6,3" rx="10" opacity="0.8"/>
|
||||
<text x="510" y="315" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="500" fill="#1e293b">MEMORY STORE</text>
|
||||
<text x="510" y="332" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">BOT_MEMORY • Session State • Context</text>
|
||||
<text x="510" y="315" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="500" fill="#1e293b">MEMORY STORE</text>
|
||||
<text x="510" y="332" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">BOT_MEMORY • Session State • Context</text>
|
||||
|
||||
<!-- Memory connection - delicate -->
|
||||
<path d="M 650 275 L 650 290" stroke="#f5576c" stroke-width="1.5" stroke-dasharray="4,4" fill="none" opacity="0.4"/>
|
||||
|
|
@ -160,16 +160,16 @@
|
|||
|
||||
<!-- Performance metrics -->
|
||||
<rect x="50" y="370" width="700" height="35" fill="rgba(99, 102, 241, 0.05)" stroke="#8b5cf6" stroke-width="1" stroke-dasharray="6,3" rx="8"/>
|
||||
<text x="400" y="392" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569" font-style="italic">
|
||||
<text x="400" y="392" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569" font-style="italic">
|
||||
LLM decides tool calls • Zero IF/THEN logic • Natural conversation flow • Context-aware responses
|
||||
</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g transform="translate(50, 260)">
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="10" font-weight="600" fill="#1e293b">Legend:</text>
|
||||
<text x="0" y="0" font-family="system-ui, sans-serif" font-size="16" font-weight="600" fill="#1e293b">Legend:</text>
|
||||
<circle cx="10" cy="15" r="4" fill="#10b981"/>
|
||||
<text x="20" y="19" font-family="system-ui, sans-serif" font-size="9" fill="#475569">Direct response</text>
|
||||
<text x="20" y="19" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Direct response</text>
|
||||
<circle cx="10" cy="30" r="4" fill="#f59e0b"/>
|
||||
<text x="20" y="34" font-family="system-ui, sans-serif" font-size="9" fill="#475569">Tool invocation</text>
|
||||
<text x="20" y="34" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Tool invocation</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
|
@ -0,0 +1,137 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 880 500" 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="500" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and filters -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="800" height="420" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Background accent circles for depth -->
|
||||
<circle cx="120" cy="90" r="45" fill="#4B5563" opacity="0.04">
|
||||
<circle cx="400" cy="90" r="65" fill="#4B5563" opacity="0.04">
|
||||
<circle cx="650" cy="90" r="40" fill="#4B5563" opacity="0.04">
|
||||
<circle cx="650" cy="230" r="50" fill="#4B5563" opacity="0.04">
|
||||
<circle cx="400" cy="330" r="55" fill="#4B5563" opacity="0.04">
|
||||
|
||||
<!-- Title with background -->
|
||||
<rect x="250" y="15" width="300" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="38" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#4B5563">
|
||||
BASIC LLM Tool Execution Flow
|
||||
</text>
|
||||
|
||||
<!-- Stage 1: User Input -->
|
||||
<rect x="50" y="70" width="140" height="55" fill="url(#userGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#shadow)">
|
||||
<text x="120" y="95" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">USER</text>
|
||||
<text x="120" y="112" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">"What's the policy?"</text>
|
||||
|
||||
<!-- Elegant flow arrow 1 -->
|
||||
<path d="M 190 97 C 220 97, 230 97, 260 97" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7" stroke-linecap="round">
|
||||
|
||||
<!-- Stage 2: LLM Processing -->
|
||||
<rect x="260" y="70" width="280" height="55" fill="url(#llmGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#shadow)">
|
||||
<text x="400" y="95" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">LLM + CONTEXT</text>
|
||||
<text x="400" y="112" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Understands intent + loaded KBs</text>
|
||||
|
||||
<!-- Elegant flow arrow 2 -->
|
||||
<path d="M 540 97 C 560 97, 580 97, 600 97" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7" stroke-linecap="round">
|
||||
|
||||
<!-- Stage 3: Decision Diamond -->
|
||||
<g filter="url(#glow)">
|
||||
<path d="M 650 70 L 700 97 L 650 124 L 600 97 Z" fill="rgba(139, 92, 246, 0.15)" stroke="#2563EB" stroke-width="2.5">
|
||||
<circle cx="650" cy="97" r="10" fill="#4B5563" opacity="0.3">
|
||||
<text x="650" y="102" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Tool?</text>
|
||||
</g>
|
||||
|
||||
<!-- Direct Response Path - graceful curve -->
|
||||
<path d="M 650 70 C 650 40, 500 40, 400 40 C 280 40, 140 40, 140 170" stroke="url(#directPathGrad)" stroke-width="2.5" fill="none" marker-end="url(#arrowGreen)" stroke-dasharray="8,4" opacity="0.6" stroke-linecap="round">
|
||||
|
||||
<!-- Label for direct path -->
|
||||
<rect x="350" y="25" width="100" height="22" fill="rgba(16, 185, 129, 0.1)" rx="5" filter="url(#shadow)">
|
||||
<text x="400" y="40" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Direct Answer</text>
|
||||
|
||||
<!-- Tool Path - smooth descent -->
|
||||
<path d="M 650 124 C 650 160, 650 170, 650 200" stroke="url(#toolPathGrad)" stroke-width="3" fill="none" marker-end="url(#arrowOrange)" opacity="0.8" stroke-linecap="round">
|
||||
|
||||
<!-- Label for tool path -->
|
||||
<text x="670" y="165" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Call Tool</text>
|
||||
|
||||
<!-- Stage 4: BASIC Tool -->
|
||||
<rect x="560" y="200" width="180" height="75" fill="url(#toolGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#shadow)">
|
||||
<text x="650" y="225" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">BASIC TOOL</text>
|
||||
<text x="650" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">enrollment.bas</text>
|
||||
<text x="650" y="260" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">PARAM name, course</text>
|
||||
|
||||
<!-- Tool Return Path - smooth curve -->
|
||||
<path d="M 560 237 C 490 237, 430 220, 400 195" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.6" stroke-linecap="round">
|
||||
|
||||
<!-- Stage 5: Response Generation -->
|
||||
<rect x="310" y="170" width="180" height="55" fill="url(#responseGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#shadow)">
|
||||
<text x="400" y="195" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">RESPONSE</text>
|
||||
<text x="400" y="212" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Generate natural answer</text>
|
||||
|
||||
<!-- Final Arrow -->
|
||||
<path d="M 310 197 C 280 197, 240 197, 210 197" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7" stroke-linecap="round">
|
||||
|
||||
<!-- Stage 6: Bot Output -->
|
||||
<rect x="50" y="170" width="140" height="55" fill="url(#userGrad)" stroke="#2563EB" stroke-width="2" rx="10" filter="url(#shadow)">
|
||||
<text x="120" y="195" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563" filter="url(#textShadow)">BOT</text>
|
||||
<text x="120" y="212" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">"30-day return..."</text>
|
||||
|
||||
<!-- Memory Store - elegant and subtle -->
|
||||
<rect x="350" y="290" width="320" height="55" fill="url(#memoryGrad)" stroke="#2563EB" stroke-width="2" stroke-dasharray="6,3" rx="10" opacity="0.8" filter="url(#shadow)">
|
||||
<text x="510" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">MEMORY STORE</text>
|
||||
<text x="510" y="332" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">BOT_MEMORY • Session State • Context</text>
|
||||
|
||||
<!-- Memory connection - delicate -->
|
||||
<path d="M 650 275 L 650 290" stroke="#2563EB" stroke-width="1.5" stroke-dasharray="4,4" fill="none" opacity="0.4">
|
||||
<path d="M 400 225 L 400 290" stroke="#2563EB" stroke-width="1.5" stroke-dasharray="4,4" fill="none" opacity="0.4">
|
||||
|
||||
<!-- Performance metrics -->
|
||||
<rect x="50" y="370" width="700" height="35" fill="rgba(99, 102, 241, 0.05)" stroke="#2563EB" stroke-width="2" stroke-dasharray="6,3" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="392" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" font-style="italic">
|
||||
LLM decides tool calls • Zero IF/THEN logic • Natural conversation flow • Context-aware responses
|
||||
</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g transform="translate(50, 260)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563" filter="url(#textShadow)">Legend:</text>
|
||||
<circle cx="10" cy="15" r="4" fill="#4B5563">
|
||||
<text x="20" y="19" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Direct response</text>
|
||||
<circle cx="10" cy="30" r="4" fill="#4B5563">
|
||||
<text x="20" y="34" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Tool invocation</text>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.8 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#666" opacity="0.8"/>
|
||||
|
|
@ -18,28 +18,28 @@
|
|||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#333">BotServer Data Flow Architecture</text>
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="bold" fill="#333">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="#4A90E2" stroke-width="2" rx="8" opacity="0.8"/>
|
||||
<text x="400" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#333">User Input Layer</text>
|
||||
<text x="400" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#333">User Input Layer</text>
|
||||
|
||||
<!-- Input sources -->
|
||||
<rect x="80" y="95" width="120" height="30" fill="white" stroke="#4A90E2" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="140" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#333">Web UI</text>
|
||||
<text x="140" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#333">Web UI</text>
|
||||
|
||||
<rect x="220" y="95" width="120" height="30" fill="white" stroke="#4A90E2" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="280" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#333">WhatsApp</text>
|
||||
<text x="280" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#333">WhatsApp</text>
|
||||
|
||||
<rect x="360" y="95" width="120" height="30" fill="white" stroke="#4A90E2" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="420" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#333">Teams</text>
|
||||
<text x="420" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#333">Teams</text>
|
||||
|
||||
<rect x="500" y="95" width="120" height="30" fill="white" stroke="#4A90E2" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="560" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#333">Email</text>
|
||||
<text x="560" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#333">Email</text>
|
||||
|
||||
<rect x="640" y="95" width="80" height="30" fill="white" stroke="#4A90E2" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="680" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#333">API</text>
|
||||
<text x="680" y="113" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" fill="#333">API</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrows from User Layer to Processing -->
|
||||
|
|
@ -48,27 +48,27 @@
|
|||
<!-- Processing Layer -->
|
||||
<g id="processing-layer">
|
||||
<rect x="50" y="170" width="700" height="200" fill="url(#gradient2)" stroke="#50C878" stroke-width="2" rx="8" opacity="0.8"/>
|
||||
<text x="400" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#333">Core Processing Engine</text>
|
||||
<text x="400" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#333">Core Processing Engine</text>
|
||||
|
||||
<!-- Session Manager -->
|
||||
<rect x="80" y="210" width="150" height="60" fill="white" stroke="#50C878" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="155" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Session Manager</text>
|
||||
<text x="155" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">User Context</text>
|
||||
<text x="155" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Session Manager</text>
|
||||
<text x="155" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">User Context</text>
|
||||
|
||||
<!-- BASIC Interpreter -->
|
||||
<rect x="250" y="210" width="150" height="60" fill="white" stroke="#50C878" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="325" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">BASIC Interpreter</text>
|
||||
<text x="325" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">Script Execution</text>
|
||||
<text x="325" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">BASIC Interpreter</text>
|
||||
<text x="325" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">Script Execution</text>
|
||||
|
||||
<!-- LLM Integration -->
|
||||
<rect x="420" y="210" width="150" height="60" fill="white" stroke="#50C878" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="495" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">LLM Integration</text>
|
||||
<text x="495" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">AI Processing</text>
|
||||
<text x="495" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">LLM Integration</text>
|
||||
<text x="495" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">AI Processing</text>
|
||||
|
||||
<!-- Knowledge Base -->
|
||||
<rect x="590" y="210" width="130" height="60" fill="white" stroke="#50C878" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="655" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Knowledge Base</text>
|
||||
<text x="655" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">Vector Search</text>
|
||||
<text x="655" y="235" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Knowledge Base</text>
|
||||
<text x="655" y="252" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">Vector Search</text>
|
||||
|
||||
<!-- Internal flow arrows -->
|
||||
<line x1="230" y1="240" x2="250" y2="240" stroke="#666" stroke-width="1" marker-end="url(#arrow)" opacity="0.5"/>
|
||||
|
|
@ -77,13 +77,13 @@
|
|||
|
||||
<!-- Tool System -->
|
||||
<rect x="80" y="290" width="300" height="60" fill="white" stroke="#50C878" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="230" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Tool System</text>
|
||||
<text x="230" y="332" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">External APIs & Functions</text>
|
||||
<text x="230" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Tool System</text>
|
||||
<text x="230" y="332" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">External APIs & Functions</text>
|
||||
|
||||
<!-- Cache Layer -->
|
||||
<rect x="420" y="290" width="300" height="60" fill="white" stroke="#50C878" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="570" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Cache Layer</text>
|
||||
<text x="570" y="332" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">Response Optimization</text>
|
||||
<text x="570" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Cache Layer</text>
|
||||
<text x="570" y="332" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">Response Optimization</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrows from Processing to Storage -->
|
||||
|
|
@ -92,27 +92,27 @@
|
|||
<!-- Storage Layer -->
|
||||
<g id="storage-layer">
|
||||
<rect x="50" y="400" width="700" height="120" fill="url(#gradient3)" stroke="#FF6B6B" stroke-width="2" rx="8" opacity="0.8"/>
|
||||
<text x="400" y="425" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#333">Storage & Persistence Layer</text>
|
||||
<text x="400" y="425" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#333">Storage & Persistence Layer</text>
|
||||
|
||||
<!-- Database -->
|
||||
<rect x="80" y="450" width="140" height="50" fill="white" stroke="#FF6B6B" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="150" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Database</text>
|
||||
<text x="150" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">User Data</text>
|
||||
<text x="150" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Database</text>
|
||||
<text x="150" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">User Data</text>
|
||||
|
||||
<!-- Vector DB -->
|
||||
<rect x="240" y="450" width="140" height="50" fill="white" stroke="#FF6B6B" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="310" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Vector DB</text>
|
||||
<text x="310" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">Embeddings</text>
|
||||
<text x="310" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Vector DB</text>
|
||||
<text x="310" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">Embeddings</text>
|
||||
|
||||
<!-- Drive Storage -->
|
||||
<rect x="400" y="450" width="140" height="50" fill="white" stroke="#FF6B6B" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="470" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Drive Storage</text>
|
||||
<text x="470" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">Files & Assets</text>
|
||||
<text x="470" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Drive Storage</text>
|
||||
<text x="470" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">Files & Assets</text>
|
||||
|
||||
<!-- Cache -->
|
||||
<rect x="560" y="450" width="140" height="50" fill="white" stroke="#FF6B6B" stroke-width="1" rx="4" opacity="0.9"/>
|
||||
<text x="630" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Cache</text>
|
||||
<text x="630" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#666">Fast Access</text>
|
||||
<text x="630" y="470" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">Cache</text>
|
||||
<text x="630" y="487" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#666">Fast Access</text>
|
||||
</g>
|
||||
|
||||
<!-- Bidirectional arrows showing data flow -->
|
||||
|
|
@ -126,14 +126,14 @@
|
|||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(50, 540)">
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#333">Data Flow:</text>
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#333">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="Arial, sans-serif" font-size="11" fill="#666">Request/Response</text>
|
||||
<text x="125" y="0" font-family="Arial, sans-serif" font-size="16" fill="#666">Request/Response</text>
|
||||
|
||||
<line x1="250" y1="-5" x2="290" y2="-5" stroke="#666" stroke-width="1" stroke-dasharray="5,5"/>
|
||||
<text x="295" y="0" font-family="Arial, sans-serif" font-size="11" fill="#666">Data Access</text>
|
||||
<text x="295" y="0" font-family="Arial, sans-serif" font-size="16" fill="#666">Data Access</text>
|
||||
</g>
|
||||
|
||||
<!-- Performance Note -->
|
||||
<text x="400" y="580" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#999">All components run in async Rust for maximum performance</text>
|
||||
<text x="400" y="580" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#999">All components run in async Rust for maximum performance</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
158
docs/src/chapter-07-gbapp/assets/data-flow.svg.backup
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
<?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 & 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 & 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 & 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>
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="900" height="800" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="900" height="800" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#666" opacity="0.8"/>
|
||||
|
|
@ -26,56 +26,56 @@
|
|||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">Data Flow Through Modules</text>
|
||||
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="bold" fill="#1F2937">Data Flow Through Modules</text>
|
||||
|
||||
<!-- User Input -->
|
||||
<ellipse cx="450" cy="70" rx="80" ry="25" fill="url(#inputGradient)" stroke="#3B82F6" stroke-width="2" opacity="0.9"/>
|
||||
<text x="450" y="75" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">User Input</text>
|
||||
<text x="450" y="75" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">User Input</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="95" x2="450" y2="120" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- web_server/channels -->
|
||||
<rect x="300" y="120" width="300" height="70" fill="url(#processGradient)" stroke="#10B981" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="450" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">web_server/ | channels/</text>
|
||||
<text x="450" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Axum HTTP Server</text>
|
||||
<text x="450" y="180" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Route to channel</text>
|
||||
<text x="450" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">web_server/ | channels/</text>
|
||||
<text x="450" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Axum HTTP Server</text>
|
||||
<text x="450" y="180" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Route to channel</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="190" x2="450" y2="220" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- session/ -->
|
||||
<rect x="300" y="220" width="300" height="70" fill="url(#processGradient)" stroke="#10B981" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="450" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">session/</text>
|
||||
<text x="450" y="265" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Load/Create Session</text>
|
||||
<text x="450" y="280" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Validate Token</text>
|
||||
<text x="450" y="245" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">session/</text>
|
||||
<text x="450" y="265" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Load/Create Session</text>
|
||||
<text x="450" y="280" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Validate Token</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="290" x2="450" y2="320" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- auth/ -->
|
||||
<rect x="300" y="320" width="300" height="70" fill="url(#processGradient)" stroke="#10B981" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="450" y="345" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">auth/</text>
|
||||
<text x="450" y="365" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Check Permissions</text>
|
||||
<text x="450" y="380" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Apply RBAC</text>
|
||||
<text x="450" y="345" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">auth/</text>
|
||||
<text x="450" y="365" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Check Permissions</text>
|
||||
<text x="450" y="380" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Apply RBAC</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="390" x2="450" y2="420" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- bot/ -->
|
||||
<rect x="300" y="420" width="300" height="70" fill="url(#serviceGradient)" stroke="#8B5CF6" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="450" y="445" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">bot/</text>
|
||||
<text x="450" y="465" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">Route to Bot Instance</text>
|
||||
<text x="450" y="480" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">Load Configuration</text>
|
||||
<text x="450" y="445" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">bot/</text>
|
||||
<text x="450" y="465" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C3AED">Route to Bot Instance</text>
|
||||
<text x="450" y="480" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C3AED">Load Configuration</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="490" x2="450" y2="520" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- basic/ -->
|
||||
<rect x="300" y="520" width="300" height="70" fill="url(#serviceGradient)" stroke="#8B5CF6" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="450" y="545" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">basic/</text>
|
||||
<text x="450" y="565" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">Execute BASIC Script</text>
|
||||
<text x="450" y="580" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">Parse Keywords</text>
|
||||
<text x="450" y="545" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">basic/</text>
|
||||
<text x="450" y="565" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C3AED">Execute BASIC Script</text>
|
||||
<text x="450" y="580" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C3AED">Parse Keywords</text>
|
||||
|
||||
<!-- Multiple arrows branching out -->
|
||||
<line x1="350" y1="590" x2="200" y2="640" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
|
@ -86,23 +86,23 @@
|
|||
<!-- Data Layer Services -->
|
||||
<!-- context/ -->
|
||||
<rect x="120" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="190" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#1F2937">context/</text>
|
||||
<text x="190" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#7C2D12">Load KB</text>
|
||||
<text x="190" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">context/</text>
|
||||
<text x="190" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C2D12">Load KB</text>
|
||||
|
||||
<!-- drive/ -->
|
||||
<rect x="280" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="350" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#1F2937">drive/</text>
|
||||
<text x="350" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#7C2D12">Get Files</text>
|
||||
<text x="350" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">drive/</text>
|
||||
<text x="350" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C2D12">Get Files</text>
|
||||
|
||||
<!-- database/ -->
|
||||
<rect x="480" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="550" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#1F2937">database/</text>
|
||||
<text x="550" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#7C2D12">Query DB</text>
|
||||
<text x="550" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">database/</text>
|
||||
<text x="550" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C2D12">Query DB</text>
|
||||
|
||||
<!-- llm/ -->
|
||||
<rect x="640" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="710" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" font-weight="bold" fill="#1F2937">llm/</text>
|
||||
<text x="710" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#7C2D12">Call AI</text>
|
||||
<text x="710" y="665" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">llm/</text>
|
||||
<text x="710" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#7C2D12">Call AI</text>
|
||||
|
||||
<!-- Convergence arrows -->
|
||||
<line x1="190" y1="700" x2="400" y2="730" stroke="#666" stroke-width="1" opacity="0.5"/>
|
||||
|
|
@ -115,21 +115,21 @@
|
|||
|
||||
<!-- Bot Response -->
|
||||
<ellipse cx="450" cy="780" rx="80" ry="25" fill="url(#outputGradient)" stroke="#EF4444" stroke-width="2" opacity="0.9"/>
|
||||
<text x="450" y="785" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">Bot Response</text>
|
||||
<text x="450" y="785" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">Bot Response</text>
|
||||
|
||||
<!-- Side annotations -->
|
||||
<g id="annotations" opacity="0.7">
|
||||
<!-- Processing stages -->
|
||||
<text x="50" y="75" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">1. Input Reception</text>
|
||||
<text x="50" y="155" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">2. HTTP Routing</text>
|
||||
<text x="50" y="255" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">3. Session Management</text>
|
||||
<text x="50" y="355" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">4. Authorization</text>
|
||||
<text x="50" y="455" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">5. Bot Routing</text>
|
||||
<text x="50" y="555" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">6. Script Execution</text>
|
||||
<text x="50" y="670" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">7. Data Processing</text>
|
||||
<text x="50" y="785" text-anchor="start" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">8. Response Generation</text>
|
||||
<text x="50" y="75" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">1. Input Reception</text>
|
||||
<text x="50" y="155" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">2. HTTP Routing</text>
|
||||
<text x="50" y="255" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">3. Session Management</text>
|
||||
<text x="50" y="355" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">4. Authorization</text>
|
||||
<text x="50" y="455" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">5. Bot Routing</text>
|
||||
<text x="50" y="555" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">6. Script Execution</text>
|
||||
<text x="50" y="670" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">7. Data Processing</text>
|
||||
<text x="50" y="785" text-anchor="start" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">8. Response Generation</text>
|
||||
</g>
|
||||
|
||||
<!-- Performance note -->
|
||||
<text x="450" y="820" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" font-style="italic" fill="#9CA3AF">All operations are async with Tokio runtime for maximum throughput</text>
|
||||
<text x="450" y="820" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-style="italic" fill="#9CA3AF">All operations are async with Tokio runtime for maximum throughput</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.7 KiB |
146
docs/src/chapter-07-gbapp/assets/module-data-flow.svg.backup
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 880" 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="880" 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="24" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Data Flow Through Modules</text>
|
||||
|
||||
<!-- User Input -->
|
||||
<ellipse cx="450" cy="70" rx="80" ry="25" fill="url(#inputGradient)" stroke="#2563EB" stroke-width="2" opacity="0.9">
|
||||
<text x="450" y="75" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">User Input</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="95" x2="450" y2="120" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- web_server/channels -->
|
||||
<rect x="300" y="120" width="300" height="70" fill="url(#processGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="450" y="145" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">web_server/ | channels/</text>
|
||||
<text x="450" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Axum HTTP Server</text>
|
||||
<text x="450" y="180" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Route to channel</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="190" x2="450" y2="220" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- session/ -->
|
||||
<rect x="300" y="220" width="300" height="70" fill="url(#processGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="450" y="245" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">session/</text>
|
||||
<text x="450" y="265" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Load/Create Session</text>
|
||||
<text x="450" y="280" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Validate Token</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="290" x2="450" y2="320" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- auth/ -->
|
||||
<rect x="300" y="320" width="300" height="70" fill="url(#processGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="450" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">auth/</text>
|
||||
<text x="450" y="365" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Check Permissions</text>
|
||||
<text x="450" y="380" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Apply RBAC</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="390" x2="450" y2="420" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- bot/ -->
|
||||
<rect x="300" y="420" width="300" height="70" fill="url(#serviceGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="450" y="445" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">bot/</text>
|
||||
<text x="450" y="465" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Route to Bot Instance</text>
|
||||
<text x="450" y="480" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Load Configuration</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="490" x2="450" y2="520" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- basic/ -->
|
||||
<rect x="300" y="520" width="300" height="70" fill="url(#serviceGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="450" y="545" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">basic/</text>
|
||||
<text x="450" y="565" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Execute BASIC Script</text>
|
||||
<text x="450" y="580" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Parse Keywords</text>
|
||||
|
||||
<!-- Multiple arrows branching out -->
|
||||
<line x1="350" y1="590" x2="200" y2="640" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="400" y1="590" x2="350" y2="640" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="500" y1="590" x2="550" y2="640" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="550" y1="590" x2="700" y2="640" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- Data Layer Services -->
|
||||
<!-- context/ -->
|
||||
<rect x="120" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="190" y="665" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">context/</text>
|
||||
<text x="190" y="685" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Load KB</text>
|
||||
|
||||
<!-- drive/ -->
|
||||
<rect x="280" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="350" y="665" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">drive/</text>
|
||||
<text x="350" y="685" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Get Files</text>
|
||||
|
||||
<!-- database/ -->
|
||||
<rect x="480" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="550" y="665" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">database/</text>
|
||||
<text x="550" y="685" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Query DB</text>
|
||||
|
||||
<!-- llm/ -->
|
||||
<rect x="640" y="640" width="140" height="60" fill="url(#dataGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="710" y="665" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">llm/</text>
|
||||
<text x="710" y="685" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Call AI</text>
|
||||
|
||||
<!-- Convergence arrows -->
|
||||
<line x1="190" y1="700" x2="400" y2="730" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
<line x1="350" y1="700" x2="420" y2="730" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
<line x1="550" y1="700" x2="480" y2="730" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
<line x1="710" y1="700" x2="500" y2="730" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="450" y1="730" x2="450" y2="750" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- Bot Response -->
|
||||
<ellipse cx="450" cy="780" rx="80" ry="25" fill="url(#outputGradient)" stroke="#2563EB" stroke-width="2" opacity="0.9">
|
||||
<text x="450" y="785" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Bot Response</text>
|
||||
|
||||
<!-- Side annotations -->
|
||||
<g id="annotations" opacity="0.7">
|
||||
<!-- Processing stages -->
|
||||
<text x="50" y="75" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">1. Input Reception</text>
|
||||
<text x="50" y="155" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">2. HTTP Routing</text>
|
||||
<text x="50" y="255" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">3. Session Management</text>
|
||||
<text x="50" y="355" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">4. Authorization</text>
|
||||
<text x="50" y="455" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">5. Bot Routing</text>
|
||||
<text x="50" y="555" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">6. Script Execution</text>
|
||||
<text x="50" y="670" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)" font-weight="600">7. Data Processing</text>
|
||||
<text x="50" y="785" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">8. Response Generation</text>
|
||||
</g>
|
||||
|
||||
<!-- Performance note -->
|
||||
<text x="450" y="820" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-style="italic" fill="#4B5563" filter="url(#textShadow)">All operations are async with Tokio runtime for maximum throughput</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<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="#666" opacity="0.8"/>
|
||||
|
|
@ -22,18 +22,18 @@
|
|||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">Module Dependency Graph</text>
|
||||
<text x="400" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="bold" fill="#1F2937">Module Dependency Graph</text>
|
||||
|
||||
<!-- main.rs (Entry Point) -->
|
||||
<rect x="350" y="50" width="100" height="40" fill="url(#mainGradient)" stroke="#3B82F6" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="400" y="75" text-anchor="middle" font-family="monospace" font-size="14" font-weight="bold" fill="#1F2937">main.rs</text>
|
||||
<text x="400" y="75" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#1F2937">main.rs</text>
|
||||
|
||||
<!-- Arrow to bootstrap -->
|
||||
<line x1="400" y1="90" x2="400" y2="120" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- bootstrap/ -->
|
||||
<rect x="330" y="120" width="140" height="40" fill="url(#coreGradient)" stroke="#10B981" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="400" y="145" text-anchor="middle" font-family="monospace" font-size="13" font-weight="bold" fill="#1F2937">bootstrap/</text>
|
||||
<text x="400" y="145" text-anchor="middle" font-family="monospace" font-size="20" font-weight="bold" fill="#1F2937">bootstrap/</text>
|
||||
|
||||
<!-- Arrows from bootstrap to core modules -->
|
||||
<line x1="350" y1="160" x2="200" y2="210" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
|
@ -43,15 +43,15 @@
|
|||
<!-- Core Layer -->
|
||||
<!-- package_manager/ -->
|
||||
<rect x="120" y="210" width="160" height="40" fill="url(#coreGradient)" stroke="#10B981" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="200" y="235" text-anchor="middle" font-family="monospace" font-size="12" fill="#1F2937">package_manager/</text>
|
||||
<text x="200" y="235" text-anchor="middle" font-family="monospace" font-size="18" fill="#1F2937">package_manager/</text>
|
||||
|
||||
<!-- config/ -->
|
||||
<rect x="320" y="210" width="160" height="40" fill="url(#coreGradient)" stroke="#10B981" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="400" y="235" text-anchor="middle" font-family="monospace" font-size="12" fill="#1F2937">config/</text>
|
||||
<text x="400" y="235" text-anchor="middle" font-family="monospace" font-size="18" fill="#1F2937">config/</text>
|
||||
|
||||
<!-- database/ -->
|
||||
<rect x="520" y="210" width="160" height="40" fill="url(#coreGradient)" stroke="#10B981" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="600" y="235" text-anchor="middle" font-family="monospace" font-size="12" fill="#1F2937">database/</text>
|
||||
<text x="600" y="235" text-anchor="middle" font-family="monospace" font-size="18" fill="#1F2937">database/</text>
|
||||
|
||||
<!-- Convergence arrows to session -->
|
||||
<line x1="400" y1="250" x2="400" y2="290" stroke="#666" stroke-width="1" opacity="0.5"/>
|
||||
|
|
@ -59,11 +59,11 @@
|
|||
|
||||
<!-- session/ -->
|
||||
<rect x="350" y="290" width="100" height="40" fill="url(#serviceGradient)" stroke="#8B5CF6" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="400" y="315" text-anchor="middle" font-family="monospace" font-size="12" fill="#1F2937">session/</text>
|
||||
<text x="400" y="315" text-anchor="middle" font-family="monospace" font-size="18" fill="#1F2937">session/</text>
|
||||
|
||||
<!-- web_server/ and bidirectional arrow with session -->
|
||||
<rect x="180" y="290" width="120" height="40" fill="url(#serviceGradient)" stroke="#8B5CF6" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="240" y="315" text-anchor="middle" font-family="monospace" font-size="12" fill="#1F2937">web_server/</text>
|
||||
<text x="240" y="315" text-anchor="middle" font-family="monospace" font-size="18" fill="#1F2937">web_server/</text>
|
||||
|
||||
<line x1="300" y1="310" x2="350" y2="310" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
<line x1="350" y1="320" x2="300" y2="320" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
|
@ -80,19 +80,19 @@
|
|||
<!-- Feature Modules -->
|
||||
<!-- channels/ -->
|
||||
<rect x="80" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="130" y="405" text-anchor="middle" font-family="monospace" font-size="11" fill="#1F2937">channels/</text>
|
||||
<text x="130" y="405" text-anchor="middle" font-family="monospace" font-size="16" fill="#1F2937">channels/</text>
|
||||
|
||||
<!-- bot/ -->
|
||||
<rect x="210" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="260" y="405" text-anchor="middle" font-family="monospace" font-size="11" fill="#1F2937">bot/</text>
|
||||
<text x="260" y="405" text-anchor="middle" font-family="monospace" font-size="16" fill="#1F2937">bot/</text>
|
||||
|
||||
<!-- basic/ -->
|
||||
<rect x="340" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="390" y="405" text-anchor="middle" font-family="monospace" font-size="11" fill="#1F2937">basic/</text>
|
||||
<text x="390" y="405" text-anchor="middle" font-family="monospace" font-size="16" fill="#1F2937">basic/</text>
|
||||
|
||||
<!-- auth/ -->
|
||||
<rect x="470" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="520" y="405" text-anchor="middle" font-family="monospace" font-size="11" fill="#1F2937">auth/</text>
|
||||
<text x="520" y="405" text-anchor="middle" font-family="monospace" font-size="16" fill="#1F2937">auth/</text>
|
||||
|
||||
<!-- Convergence to LLM -->
|
||||
<line x1="130" y1="420" x2="340" y2="470" stroke="#666" stroke-width="1" opacity="0.5"/>
|
||||
|
|
@ -102,32 +102,32 @@
|
|||
|
||||
<!-- llm/ -->
|
||||
<rect x="340" y="470" width="100" height="40" fill="url(#serviceGradient)" stroke="#8B5CF6" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="390" y="495" text-anchor="middle" font-family="monospace" font-size="12" fill="#1F2937">llm/</text>
|
||||
<text x="390" y="495" text-anchor="middle" font-family="monospace" font-size="18" fill="#1F2937">llm/</text>
|
||||
|
||||
<!-- Arrow to context -->
|
||||
<line x1="390" y1="510" x2="390" y2="540" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6"/>
|
||||
|
||||
<!-- context/ -->
|
||||
<rect x="340" y="540" width="100" height="40" fill="url(#leafGradient)" stroke="#F59E0B" stroke-width="2" rx="8" opacity="0.9"/>
|
||||
<text x="390" y="565" text-anchor="middle" font-family="monospace" font-size="12" fill="#1F2937">context/</text>
|
||||
<text x="390" y="565" text-anchor="middle" font-family="monospace" font-size="18" fill="#1F2937">context/</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(580, 480)">
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#1F2937">Layers:</text>
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#1F2937">Layers:</text>
|
||||
|
||||
<rect x="0" y="10" width="15" height="15" fill="url(#mainGradient)" stroke="#3B82F6" stroke-width="1" rx="2" opacity="0.8"/>
|
||||
<text x="20" y="22" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Entry Point</text>
|
||||
<text x="20" y="22" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Entry Point</text>
|
||||
|
||||
<rect x="0" y="30" width="15" height="15" fill="url(#coreGradient)" stroke="#10B981" stroke-width="1" rx="2" opacity="0.8"/>
|
||||
<text x="20" y="42" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Core System</text>
|
||||
<text x="20" y="42" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Core System</text>
|
||||
|
||||
<rect x="0" y="50" width="15" height="15" fill="url(#serviceGradient)" stroke="#8B5CF6" stroke-width="1" rx="2" opacity="0.8"/>
|
||||
<text x="20" y="62" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Services</text>
|
||||
<text x="20" y="62" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Services</text>
|
||||
|
||||
<rect x="0" y="70" width="15" height="15" fill="url(#leafGradient)" stroke="#F59E0B" stroke-width="1" rx="2" opacity="0.8"/>
|
||||
<text x="20" y="82" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Features</text>
|
||||
<text x="20" y="82" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Features</text>
|
||||
</g>
|
||||
|
||||
<!-- Dependency Flow Note -->
|
||||
<text x="50" y="580" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">Arrows indicate compile-time dependencies</text>
|
||||
<text x="50" y="580" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Arrows indicate compile-time dependencies</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
148
docs/src/chapter-07-gbapp/assets/module-dependency.svg.backup
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
<?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="#4B5563" filter="url(#textShadow)">Module Dependency Graph</text>
|
||||
|
||||
<!-- main.rs (Entry Point) -->
|
||||
<rect x="350" y="50" width="100" height="40" fill="url(#mainGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="400" y="75" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">main.rs</text>
|
||||
|
||||
<!-- Arrow to bootstrap -->
|
||||
<line x1="400" y1="90" x2="400" y2="120" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- bootstrap/ -->
|
||||
<rect x="330" y="120" width="140" height="40" fill="url(#coreGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="400" y="145" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">bootstrap/</text>
|
||||
|
||||
<!-- Arrows from bootstrap to core modules -->
|
||||
<line x1="350" y1="160" x2="200" y2="210" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="400" y1="160" x2="400" y2="210" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="450" y1="160" x2="600" y2="210" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- Core Layer -->
|
||||
<!-- package_manager/ -->
|
||||
<rect x="120" y="210" width="160" height="40" fill="url(#coreGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="200" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">package_manager/</text>
|
||||
|
||||
<!-- config/ -->
|
||||
<rect x="320" y="210" width="160" height="40" fill="url(#coreGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="400" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">config/</text>
|
||||
|
||||
<!-- database/ -->
|
||||
<rect x="520" y="210" width="160" height="40" fill="url(#coreGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="600" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">database/</text>
|
||||
|
||||
<!-- Convergence arrows to session -->
|
||||
<line x1="400" y1="250" x2="400" y2="290" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
<line x1="600" y1="250" x2="450" y2="290" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
|
||||
<!-- session/ -->
|
||||
<rect x="350" y="290" width="100" height="40" fill="url(#serviceGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="400" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">session/</text>
|
||||
|
||||
<!-- web_server/ and bidirectional arrow with session -->
|
||||
<rect x="180" y="290" width="120" height="40" fill="url(#serviceGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="240" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">web_server/</text>
|
||||
|
||||
<line x1="300" y1="310" x2="350" y2="310" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="350" y1="320" x2="300" y2="320" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- Arrow from package_manager to web_server -->
|
||||
<line x1="200" y1="250" x2="240" y2="290" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- Service Layer branches -->
|
||||
<line x1="240" y1="330" x2="140" y2="380" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="240" y1="330" x2="260" y2="380" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="240" y1="330" x2="380" y2="380" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="400" y1="330" x2="500" y2="380" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- Feature Modules -->
|
||||
<!-- channels/ -->
|
||||
<rect x="80" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="130" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">channels/</text>
|
||||
|
||||
<!-- bot/ -->
|
||||
<rect x="210" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="260" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">bot/</text>
|
||||
|
||||
<!-- basic/ -->
|
||||
<rect x="340" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="390" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">basic/</text>
|
||||
|
||||
<!-- auth/ -->
|
||||
<rect x="470" y="380" width="100" height="40" fill="url(#leafGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="520" y="405" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">auth/</text>
|
||||
|
||||
<!-- Convergence to LLM -->
|
||||
<line x1="130" y1="420" x2="340" y2="470" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
<line x1="260" y1="420" x2="340" y2="470" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
<line x1="390" y1="420" x2="390" y2="470" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
<line x1="520" y1="420" x2="430" y2="470" stroke="#666" stroke-width="2" opacity="0.5">
|
||||
|
||||
<!-- llm/ -->
|
||||
<rect x="340" y="470" width="100" height="40" fill="url(#serviceGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="390" y="495" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">llm/</text>
|
||||
|
||||
<!-- Arrow to context -->
|
||||
<line x1="390" y1="510" x2="390" y2="540" stroke="#666" stroke-width="2" marker-end="url(#arrow)" opacity="0.6">
|
||||
|
||||
<!-- context/ -->
|
||||
<rect x="340" y="540" width="100" height="40" fill="url(#leafGradient)" stroke="#2563EB" stroke-width="2" rx="8" opacity="0.9" filter="url(#shadow)">
|
||||
<text x="390" y="565" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">context/</text>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(580, 480)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Layers:</text>
|
||||
|
||||
<rect x="0" y="10" width="15" height="15" fill="url(#mainGradient)" stroke="#2563EB" stroke-width="2" rx="2" opacity="0.8" filter="url(#shadow)">
|
||||
<text x="20" y="22" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Entry Point</text>
|
||||
|
||||
<rect x="0" y="30" width="15" height="15" fill="url(#coreGradient)" stroke="#2563EB" stroke-width="2" rx="2" opacity="0.8" filter="url(#shadow)">
|
||||
<text x="20" y="42" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)" font-weight="600">Core System</text>
|
||||
|
||||
<rect x="0" y="50" width="15" height="15" fill="url(#serviceGradient)" stroke="#2563EB" stroke-width="2" rx="2" opacity="0.8" filter="url(#shadow)">
|
||||
<text x="20" y="62" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Services</text>
|
||||
|
||||
<rect x="0" y="70" width="15" height="15" fill="url(#leafGradient)" stroke="#2563EB" stroke-width="2" rx="2" opacity="0.8" filter="url(#shadow)">
|
||||
<text x="20" y="82" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Features</text>
|
||||
</g>
|
||||
|
||||
<!-- Dependency Flow Note -->
|
||||
<text x="50" y="580" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Arrows indicate compile-time dependencies</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.6 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="900" height="700" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 700">
|
||||
<svg width="900" height="700" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 700" style="max-width: 100%; height: auto;">
|
||||
<defs>
|
||||
<marker id="arrowhead" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
|
||||
<path d="M0,0 L0,6 L9,3 z" fill="#666"/>
|
||||
|
|
@ -6,49 +6,49 @@
|
|||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="bold" fill="#1F2937">BotServer Architecture - Virtual Crates System</text>
|
||||
<text x="450" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="26" font-weight="bold" fill="#1F2937">BotServer Architecture - Virtual Crates System</text>
|
||||
|
||||
<!-- Main Container -->
|
||||
<rect x="40" y="50" width="820" height="620" fill="none" stroke="#E5E7EB" stroke-width="2" rx="12" stroke-opacity="0.5"/>
|
||||
|
||||
<!-- Binary Output -->
|
||||
<rect x="350" y="70" width="200" height="40" fill="#EBF8FF" stroke="#2563EB" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">BotServer Binary</text>
|
||||
<text x="450" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">BotServer Binary</text>
|
||||
|
||||
<!-- Compilation Arrow -->
|
||||
<line x1="450" y1="110" x2="450" y2="140" stroke="#666" stroke-width="2" marker-end="url(#arrowhead)" stroke-dasharray="5,3" opacity="0.6"/>
|
||||
<text x="470" y="130" font-family="Arial, sans-serif" font-size="10" fill="#6B7280">compiles to</text>
|
||||
<text x="470" y="130" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">compiles to</text>
|
||||
|
||||
<!-- Core Layer -->
|
||||
<g id="core-layer">
|
||||
<rect x="60" y="140" width="780" height="120" fill="#EBF8FF" fill-opacity="0.3" stroke="#2563EB" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">Core Engine (src/core/)</text>
|
||||
<text x="450" y="165" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">Core Engine (src/core/)</text>
|
||||
|
||||
<!-- Core Components -->
|
||||
<rect x="80" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="1" rx="4"/>
|
||||
<text x="150" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">Bootstrap</text>
|
||||
<text x="150" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">System Init</text>
|
||||
<text x="150" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">Service Start</text>
|
||||
<text x="150" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">Bootstrap</text>
|
||||
<text x="150" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">System Init</text>
|
||||
<text x="150" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Service Start</text>
|
||||
|
||||
<rect x="240" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="1" rx="4"/>
|
||||
<text x="310" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">Package Manager</text>
|
||||
<text x="310" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">Component Registry</text>
|
||||
<text x="310" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">Module Loader</text>
|
||||
<text x="310" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">Package Manager</text>
|
||||
<text x="310" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Component Registry</text>
|
||||
<text x="310" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Module Loader</text>
|
||||
|
||||
<rect x="400" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="1" rx="4"/>
|
||||
<text x="470" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">Session Manager</text>
|
||||
<text x="470" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">Context Handling</text>
|
||||
<text x="470" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">State Management</text>
|
||||
<text x="470" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">Session Manager</text>
|
||||
<text x="470" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Context Handling</text>
|
||||
<text x="470" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">State Management</text>
|
||||
|
||||
<rect x="560" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="1" rx="4"/>
|
||||
<text x="630" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">Shared State</text>
|
||||
<text x="630" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">AppState</text>
|
||||
<text x="630" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">Configuration</text>
|
||||
<text x="630" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">Shared State</text>
|
||||
<text x="630" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">AppState</text>
|
||||
<text x="630" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Configuration</text>
|
||||
|
||||
<rect x="720" y="185" width="100" height="55" fill="white" stroke="#2563EB" stroke-width="1" rx="4"/>
|
||||
<text x="770" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">Utils</text>
|
||||
<text x="770" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">Helpers</text>
|
||||
<text x="770" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">Common</text>
|
||||
<text x="770" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">Utils</text>
|
||||
<text x="770" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Helpers</text>
|
||||
<text x="770" y="232" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">Common</text>
|
||||
</g>
|
||||
|
||||
<!-- Bidirectional Arrow -->
|
||||
|
|
@ -58,47 +58,47 @@
|
|||
<!-- Virtual Crates Layer (gbapps) -->
|
||||
<g id="gbapp-layer">
|
||||
<rect x="60" y="290" width="780" height="180" fill="#D1FAE5" fill-opacity="0.3" stroke="#10B981" stroke-width="2" rx="8"/>
|
||||
<text x="450" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">Virtual Crates (gbapp modules in src/)</text>
|
||||
<text x="450" y="315" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">Virtual Crates (gbapp modules in src/)</text>
|
||||
|
||||
<!-- BASIC gbapp -->
|
||||
<rect x="80" y="335" width="170" height="115" fill="white" stroke="#10B981" stroke-width="1" rx="4"/>
|
||||
<text x="165" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">basic.gbapp</text>
|
||||
<text x="165" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">src/basic/</text>
|
||||
<text x="165" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">basic.gbapp</text>
|
||||
<text x="165" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">src/basic/</text>
|
||||
<line x1="90" y1="378" x2="240" y2="378" stroke="#E5E7EB" stroke-width="1"/>
|
||||
<text x="165" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• BASIC Interpreter</text>
|
||||
<text x="165" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Keywords Registry</text>
|
||||
<text x="165" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Script Execution</text>
|
||||
<text x="165" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Rhai Engine</text>
|
||||
<text x="165" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• BASIC Interpreter</text>
|
||||
<text x="165" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Keywords Registry</text>
|
||||
<text x="165" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Script Execution</text>
|
||||
<text x="165" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Rhai Engine</text>
|
||||
|
||||
<!-- Channels gbapp -->
|
||||
<rect x="270" y="335" width="170" height="115" fill="white" stroke="#10B981" stroke-width="1" rx="4"/>
|
||||
<text x="355" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">channels.gbapp</text>
|
||||
<text x="355" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">src/channels/</text>
|
||||
<text x="355" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">channels.gbapp</text>
|
||||
<text x="355" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">src/channels/</text>
|
||||
<line x1="280" y1="378" x2="430" y2="378" stroke="#E5E7EB" stroke-width="1"/>
|
||||
<text x="355" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• WhatsApp</text>
|
||||
<text x="355" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Teams</text>
|
||||
<text x="355" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Email</text>
|
||||
<text x="355" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Web UI</text>
|
||||
<text x="355" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• WhatsApp</text>
|
||||
<text x="355" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Teams</text>
|
||||
<text x="355" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Email</text>
|
||||
<text x="355" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Web UI</text>
|
||||
|
||||
<!-- Storage gbapp -->
|
||||
<rect x="460" y="335" width="170" height="115" fill="white" stroke="#10B981" stroke-width="1" rx="4"/>
|
||||
<text x="545" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">storage.gbapp</text>
|
||||
<text x="545" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">src/storage/</text>
|
||||
<text x="545" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">storage.gbapp</text>
|
||||
<text x="545" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">src/storage/</text>
|
||||
<line x1="470" y1="378" x2="620" y2="378" stroke="#E5E7EB" stroke-width="1"/>
|
||||
<text x="545" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Knowledge Base</text>
|
||||
<text x="545" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Drive Integration</text>
|
||||
<text x="545" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Vector DB</text>
|
||||
<text x="545" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">• Cache</text>
|
||||
<text x="545" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Knowledge Base</text>
|
||||
<text x="545" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Drive Integration</text>
|
||||
<text x="545" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Vector DB</text>
|
||||
<text x="545" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">• Cache</text>
|
||||
|
||||
<!-- Custom gbapp (Your Contribution) -->
|
||||
<rect x="650" y="335" width="170" height="115" fill="#FEF3C7" stroke="#F59E0B" stroke-width="2" rx="4" stroke-dasharray="5,3"/>
|
||||
<text x="735" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#1F2937">your_feature.gbapp</text>
|
||||
<text x="735" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#6B7280">src/your_feature/</text>
|
||||
<text x="735" y="355" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#1F2937">your_feature.gbapp</text>
|
||||
<text x="735" y="370" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#6B7280">src/your_feature/</text>
|
||||
<line x1="660" y1="378" x2="810" y2="378" stroke="#E5E7EB" stroke-width="1"/>
|
||||
<text x="735" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" font-style="italic" fill="#6B7280">• Your Keywords</text>
|
||||
<text x="735" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" font-style="italic" fill="#6B7280">• Your Services</text>
|
||||
<text x="735" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" font-style="italic" fill="#6B7280">• Your Models</text>
|
||||
<text x="735" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" font-weight="bold" fill="#F59E0B">+ Add yours!</text>
|
||||
<text x="735" y="393" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-style="italic" fill="#6B7280">• Your Keywords</text>
|
||||
<text x="735" y="408" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-style="italic" fill="#6B7280">• Your Services</text>
|
||||
<text x="735" y="423" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-style="italic" fill="#6B7280">• Your Models</text>
|
||||
<text x="735" y="438" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold" fill="#F59E0B">+ Add yours!</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow from gbapp to AI -->
|
||||
|
|
@ -107,49 +107,49 @@
|
|||
<!-- AI/LLM Layer -->
|
||||
<g id="ai-layer">
|
||||
<rect x="60" y="500" width="380" height="80" fill="#EDE9FE" fill-opacity="0.3" stroke="#8B5CF6" stroke-width="2" rx="8"/>
|
||||
<text x="250" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">AI & LLM Integration</text>
|
||||
<text x="250" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">AI & LLM Integration</text>
|
||||
|
||||
<rect x="80" y="535" width="100" height="35" fill="white" stroke="#8B5CF6" stroke-width="1" rx="4"/>
|
||||
<text x="130" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#1F2937">LLM Service</text>
|
||||
<text x="130" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">LLM Service</text>
|
||||
|
||||
<rect x="195" y="535" width="100" height="35" fill="white" stroke="#8B5CF6" stroke-width="1" rx="4"/>
|
||||
<text x="245" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#1F2937">Embeddings</text>
|
||||
<text x="245" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">Embeddings</text>
|
||||
|
||||
<rect x="310" y="535" width="110" height="35" fill="white" stroke="#8B5CF6" stroke-width="1" rx="4"/>
|
||||
<text x="365" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#1F2937">Semantic Search</text>
|
||||
<text x="365" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">Semantic Search</text>
|
||||
</g>
|
||||
|
||||
<!-- Storage Layer -->
|
||||
<g id="storage-layer">
|
||||
<rect x="460" y="500" width="380" height="80" fill="#FEE2E2" fill-opacity="0.3" stroke="#EF4444" stroke-width="2" rx="8"/>
|
||||
<text x="650" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1F2937">Persistence Layer</text>
|
||||
<text x="650" y="525" text-anchor="middle" font-family="Arial, sans-serif" font-size="20" font-weight="bold" fill="#1F2937">Persistence Layer</text>
|
||||
|
||||
<rect x="480" y="535" width="85" height="35" fill="white" stroke="#EF4444" stroke-width="1" rx="4"/>
|
||||
<text x="522" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#1F2937">Database</text>
|
||||
<text x="522" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">Database</text>
|
||||
|
||||
<rect x="580" y="535" width="85" height="35" fill="white" stroke="#EF4444" stroke-width="1" rx="4"/>
|
||||
<text x="622" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#1F2937">Vector DB</text>
|
||||
<text x="622" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">Vector DB</text>
|
||||
|
||||
<rect x="680" y="535" width="70" height="35" fill="white" stroke="#EF4444" stroke-width="1" rx="4"/>
|
||||
<text x="715" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#1F2937">Drive</text>
|
||||
<text x="715" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">Drive</text>
|
||||
|
||||
<rect x="765" y="535" width="60" height="35" fill="white" stroke="#EF4444" stroke-width="1" rx="4"/>
|
||||
<text x="795" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="10" fill="#1F2937">Cache</text>
|
||||
<text x="795" y="555" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" fill="#1F2937">Cache</text>
|
||||
</g>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(60, 600)">
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#1F2937">Key Concepts:</text>
|
||||
<text x="0" y="0" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#1F2937">Key Concepts:</text>
|
||||
|
||||
<rect x="120" y="-12" width="15" height="15" fill="#D1FAE5" stroke="#10B981" stroke-width="1" rx="2"/>
|
||||
<text x="140" y="0" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Virtual Crates = Modules in src/</text>
|
||||
<text x="140" y="0" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Virtual Crates = Modules in src/</text>
|
||||
|
||||
<rect x="320" y="-12" width="15" height="15" fill="#FEF3C7" stroke="#F59E0B" stroke-width="1" rx="2" stroke-dasharray="3,2"/>
|
||||
<text x="340" y="0" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">Your Contribution Space</text>
|
||||
<text x="340" y="0" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">Your Contribution Space</text>
|
||||
|
||||
<text x="500" y="0" font-family="Arial, sans-serif" font-size="11" fill="#4B5563">All compile to single optimized binary</text>
|
||||
<text x="500" y="0" font-family="Arial, sans-serif" font-size="16" fill="#4B5563">All compile to single optimized binary</text>
|
||||
</g>
|
||||
|
||||
<!-- Philosophy Note -->
|
||||
<text x="450" y="650" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-style="italic" fill="#6B7280">gbapp virtual crates: The bridge between old Node.js packages and new Rust modules</text>
|
||||
<text x="450" y="650" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-style="italic" fill="#6B7280">gbapp virtual crates: The bridge between old Node.js packages and new Rust modules</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
186
docs/src/chapter-07-gbapp/assets/system-architecture.svg.backup
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 980 780" 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="780" 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="24" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">BotServer Architecture - Virtual Crates System</text>
|
||||
|
||||
<!-- Main Container -->
|
||||
<rect x="40" y="50" width="820" height="620" fill="none" stroke="#2563EB" stroke-width="2" rx="12" stroke-opacity="0.5" filter="url(#shadow)"/>
|
||||
|
||||
<!-- Binary Output -->
|
||||
<rect x="350" y="70" width="200" height="40" fill="#4B5563" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="450" y="95" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">BotServer Binary</text>
|
||||
|
||||
<!-- Compilation Arrow -->
|
||||
<line x1="450" y1="110" x2="450" y2="140" stroke="#666" stroke-width="2" marker-end="url(#arrowhead)" stroke-dasharray="5,3" opacity="0.6">
|
||||
<text x="470" y="130" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">compiles to</text>
|
||||
|
||||
<!-- Core Layer -->
|
||||
<g id="core-layer">
|
||||
<rect x="60" y="140" width="780" height="120" fill="#4B5563" fill-opacity="0.3" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="450" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Core Engine (src/core/)</text>
|
||||
|
||||
<!-- Core Components -->
|
||||
<rect x="80" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="150" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Bootstrap</text>
|
||||
<text x="150" y="220" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)" font-weight="600">System Init</text>
|
||||
<text x="150" y="232" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Service Start</text>
|
||||
|
||||
<rect x="240" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="310" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Package Manager</text>
|
||||
<text x="310" y="220" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Component Registry</text>
|
||||
<text x="310" y="232" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Module Loader</text>
|
||||
|
||||
<rect x="400" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="470" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Session Manager</text>
|
||||
<text x="470" y="220" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Context Handling</text>
|
||||
<text x="470" y="232" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">State Management</text>
|
||||
|
||||
<rect x="560" y="185" width="140" height="55" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="630" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Shared State</text>
|
||||
<text x="630" y="220" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">AppState</text>
|
||||
<text x="630" y="232" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Configuration</text>
|
||||
|
||||
<rect x="720" y="185" width="100" height="55" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="770" y="205" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Utils</text>
|
||||
<text x="770" y="220" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Helpers</text>
|
||||
<text x="770" y="232" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Common</text>
|
||||
</g>
|
||||
|
||||
<!-- Bidirectional Arrow -->
|
||||
<line x1="450" y1="260" x2="450" y2="290" stroke="#666" stroke-width="2" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
<line x1="460" y1="290" x2="460" y2="260" stroke="#666" stroke-width="2" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
|
||||
<!-- Virtual Crates Layer (gbapps) -->
|
||||
<g id="gbapp-layer">
|
||||
<rect x="60" y="290" width="780" height="180" fill="#4B5563" fill-opacity="0.3" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="450" y="315" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Virtual Crates (gbapp modules in src/)</text>
|
||||
|
||||
<!-- BASIC gbapp -->
|
||||
<rect x="80" y="335" width="170" height="115" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="165" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">basic.gbapp</text>
|
||||
<text x="165" y="370" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">src/basic/</text>
|
||||
<line x1="90" y1="378" x2="240" y2="378" stroke="#2563EB" stroke-width="2">
|
||||
<text x="165" y="393" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• BASIC Interpreter</text>
|
||||
<text x="165" y="408" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Keywords Registry</text>
|
||||
<text x="165" y="423" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Script Execution</text>
|
||||
<text x="165" y="438" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Rhai Engine</text>
|
||||
|
||||
<!-- Channels gbapp -->
|
||||
<rect x="270" y="335" width="170" height="115" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="355" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">channels.gbapp</text>
|
||||
<text x="355" y="370" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">src/channels/</text>
|
||||
<line x1="280" y1="378" x2="430" y2="378" stroke="#2563EB" stroke-width="2">
|
||||
<text x="355" y="393" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• WhatsApp</text>
|
||||
<text x="355" y="408" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Teams</text>
|
||||
<text x="355" y="423" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Email</text>
|
||||
<text x="355" y="438" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Web UI</text>
|
||||
|
||||
<!-- Storage gbapp -->
|
||||
<rect x="460" y="335" width="170" height="115" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="545" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">storage.gbapp</text>
|
||||
<text x="545" y="370" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">src/storage/</text>
|
||||
<line x1="470" y1="378" x2="620" y2="378" stroke="#2563EB" stroke-width="2">
|
||||
<text x="545" y="393" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Knowledge Base</text>
|
||||
<text x="545" y="408" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Drive Integration</text>
|
||||
<text x="545" y="423" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Vector DB</text>
|
||||
<text x="545" y="438" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">• Cache</text>
|
||||
|
||||
<!-- Custom gbapp (Your Contribution) -->
|
||||
<rect x="650" y="335" width="170" height="115" fill="#1F2937" stroke="#2563EB" stroke-width="2" rx="4" stroke-dasharray="5,3" filter="url(#shadow)">
|
||||
<text x="735" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">your_feature.gbapp</text>
|
||||
<text x="735" y="370" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">src/your_feature/</text>
|
||||
<line x1="660" y1="378" x2="810" y2="378" stroke="#2563EB" stroke-width="2">
|
||||
<text x="735" y="393" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-style="italic" fill="#4B5563" filter="url(#textShadow)">• Your Keywords</text>
|
||||
<text x="735" y="408" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-style="italic" fill="#4B5563" filter="url(#textShadow)">• Your Services</text>
|
||||
<text x="735" y="423" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-style="italic" fill="#4B5563" filter="url(#textShadow)">• Your Models</text>
|
||||
<text x="735" y="438" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">+ Add yours!</text>
|
||||
</g>
|
||||
|
||||
<!-- Arrow from gbapp to AI -->
|
||||
<line x1="450" y1="470" x2="450" y2="500" stroke="#666" stroke-width="2" marker-end="url(#arrowhead)" opacity="0.6">
|
||||
|
||||
<!-- AI/LLM Layer -->
|
||||
<g id="ai-layer">
|
||||
<rect x="60" y="500" width="380" height="80" fill="#4B5563" fill-opacity="0.3" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="250" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">AI & LLM Integration</text>
|
||||
|
||||
<rect x="80" y="535" width="100" height="35" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="130" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">LLM Service</text>
|
||||
|
||||
<rect x="195" y="535" width="100" height="35" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="245" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Embeddings</text>
|
||||
|
||||
<rect x="310" y="535" width="110" height="35" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="365" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Semantic Search</text>
|
||||
</g>
|
||||
|
||||
<!-- Storage Layer -->
|
||||
<g id="storage-layer">
|
||||
<rect x="460" y="500" width="380" height="80" fill="#1F2937" fill-opacity="0.3" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="650" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Persistence Layer</text>
|
||||
|
||||
<rect x="480" y="535" width="85" height="35" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="522" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Database</text>
|
||||
|
||||
<rect x="580" y="535" width="85" height="35" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="622" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Vector DB</text>
|
||||
|
||||
<rect x="680" y="535" width="70" height="35" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="715" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Drive</text>
|
||||
|
||||
<rect x="765" y="535" width="60" height="35" fill="white" stroke="#2563EB" stroke-width="2" rx="4" filter="url(#shadow)"/>
|
||||
<text x="795" y="555" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Cache</text>
|
||||
</g>
|
||||
|
||||
<!-- Legend -->
|
||||
<g id="legend" transform="translate(60, 600)">
|
||||
<text x="0" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="bold" fill="#4B5563" filter="url(#textShadow)">Key Concepts:</text>
|
||||
|
||||
<rect x="120" y="-12" width="15" height="15" fill="#4B5563" stroke="#2563EB" stroke-width="2" rx="2" filter="url(#shadow)">
|
||||
<text x="140" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Virtual Crates = Modules in src/</text>
|
||||
|
||||
<rect x="320" y="-12" width="15" height="15" fill="#1F2937" stroke="#2563EB" stroke-width="2" rx="2" stroke-dasharray="3,2" filter="url(#shadow)">
|
||||
<text x="340" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Your Contribution Space</text>
|
||||
|
||||
<text x="500" y="0" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">All compile to single optimized binary</text>
|
||||
</g>
|
||||
|
||||
<!-- Philosophy Note -->
|
||||
<text x="450" y="650" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-style="italic" fill="#4B5563" filter="url(#textShadow)">gbapp virtual crates: The bridge between old Node.js packages and new Rust modules</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Gradients for different layers -->
|
||||
|
|
@ -61,13 +61,13 @@
|
|||
|
||||
<!-- Title -->
|
||||
<rect x="250" y="10" width="300" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8"/>
|
||||
<text x="400" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="24" font-weight="600" fill="#1e293b">
|
||||
BotServer API Architecture
|
||||
</text>
|
||||
|
||||
<!-- Client Applications Layer -->
|
||||
<rect x="250" y="60" width="300" height="50" fill="url(#clientGrad)" stroke="#667eea" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="90" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="90" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Client Applications
|
||||
</text>
|
||||
|
||||
|
|
@ -76,10 +76,10 @@
|
|||
|
||||
<!-- HTTP/HTTPS Layer -->
|
||||
<rect x="300" y="130" width="200" height="45" fill="rgba(99, 102, 241, 0.08)" stroke="#8b5cf6" stroke-width="1.5" rx="6" filter="url(#shadow)"/>
|
||||
<text x="400" y="150" text-anchor="middle" font-family="system-ui, sans-serif" font-size="12" font-weight="500" fill="#1e293b">
|
||||
<text x="400" y="150" text-anchor="middle" font-family="system-ui, sans-serif" font-size="18" font-weight="500" fill="#1e293b">
|
||||
HTTP/HTTPS
|
||||
</text>
|
||||
<text x="400" y="165" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#475569">
|
||||
<text x="400" y="165" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Port 8080
|
||||
</text>
|
||||
|
||||
|
|
@ -88,10 +88,10 @@
|
|||
|
||||
<!-- API Gateway -->
|
||||
<rect x="250" y="195" width="300" height="50" fill="url(#gatewayGrad)" stroke="#00d2ff" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="220" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="220" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
API Gateway
|
||||
</text>
|
||||
<text x="400" y="235" text-anchor="middle" font-family="system-ui, monospace" font-size="11" fill="#475569">
|
||||
<text x="400" y="235" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/api/*
|
||||
</text>
|
||||
|
||||
|
|
@ -102,46 +102,46 @@
|
|||
|
||||
<!-- Auth Endpoints -->
|
||||
<rect x="80" y="280" width="200" height="80" fill="url(#authGrad)" stroke="#f5576c" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="180" y="305" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="180" y="305" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Auth Endpoints
|
||||
</text>
|
||||
<text x="180" y="325" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="180" y="325" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/auth/login
|
||||
</text>
|
||||
<text x="180" y="340" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="180" y="340" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/auth/logout
|
||||
</text>
|
||||
<text x="180" y="355" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="180" y="355" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/auth/token
|
||||
</text>
|
||||
|
||||
<!-- Business Endpoints -->
|
||||
<rect x="300" y="280" width="200" height="80" fill="url(#businessGrad)" stroke="#00f2fe" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="305" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="305" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Business Endpoints
|
||||
</text>
|
||||
<text x="400" y="325" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="400" y="325" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/files/* • /users/*
|
||||
</text>
|
||||
<text x="400" y="340" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="400" y="340" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/groups/* • /tasks/*
|
||||
</text>
|
||||
<text x="400" y="355" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="400" y="355" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/sessions/*
|
||||
</text>
|
||||
|
||||
<!-- Admin Endpoints -->
|
||||
<rect x="520" y="280" width="200" height="80" fill="url(#adminGrad)" stroke="#fa709a" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="620" y="305" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="620" y="305" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Admin Endpoints
|
||||
</text>
|
||||
<text x="620" y="325" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="620" y="325" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/admin/*
|
||||
</text>
|
||||
<text x="620" y="340" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="620" y="340" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/monitoring
|
||||
</text>
|
||||
<text x="620" y="355" text-anchor="middle" font-family="system-ui, monospace" font-size="10" fill="#475569">
|
||||
<text x="620" y="355" text-anchor="middle" font-family="system-ui, monospace" font-size="16" fill="#475569">
|
||||
/analytics
|
||||
</text>
|
||||
|
||||
|
|
@ -152,13 +152,13 @@
|
|||
|
||||
<!-- Service Layer -->
|
||||
<rect x="250" y="400" width="300" height="70" fill="url(#serviceGrad)" stroke="#330867" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="425" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="425" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Service Layer
|
||||
</text>
|
||||
<text x="400" y="445" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="400" y="445" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Session Manager
|
||||
</text>
|
||||
<text x="400" y="460" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="400" y="460" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
• Auth Service • Bot Service
|
||||
</text>
|
||||
|
||||
|
|
@ -169,37 +169,37 @@
|
|||
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="80" y="500" width="200" height="70" fill="url(#dbGrad)" stroke="#38f9d7" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="180" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="180" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
PostgreSQL
|
||||
</text>
|
||||
<text x="180" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="180" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Database
|
||||
</text>
|
||||
<text x="180" y="560" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">
|
||||
<text x="180" y="560" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Sessions • Users • Config
|
||||
</text>
|
||||
|
||||
<!-- Valkey Cache -->
|
||||
<rect x="300" y="500" width="200" height="70" fill="url(#dbGrad)" stroke="#38f9d7" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="400" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="400" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Valkey
|
||||
</text>
|
||||
<text x="400" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="400" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Cache
|
||||
</text>
|
||||
<text x="400" y="560" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">
|
||||
<text x="400" y="560" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Semantic • Session • Temp
|
||||
</text>
|
||||
|
||||
<!-- Qdrant -->
|
||||
<rect x="520" y="500" width="200" height="70" fill="url(#dbGrad)" stroke="#38f9d7" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="620" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="13" font-weight="600" fill="#1e293b">
|
||||
<text x="620" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Qdrant
|
||||
</text>
|
||||
<text x="620" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="620" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Vectors
|
||||
</text>
|
||||
<text x="620" y="560" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#64748b">
|
||||
<text x="620" y="560" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b">
|
||||
Embeddings • Search
|
||||
</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
186
docs/src/chapter-10-api/assets/api-architecture.svg.backup
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
<?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)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="800" height="600" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title -->
|
||||
<rect x="250" y="10" width="300" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="24" font-weight="600" fill="#4B5563">
|
||||
BotServer API Architecture
|
||||
</text>
|
||||
|
||||
<!-- Client Applications Layer -->
|
||||
<rect x="250" y="60" width="300" height="50" fill="url(#clientGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="90" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Client Applications
|
||||
</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 400 110 L 400 130" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
|
||||
<!-- HTTP/HTTPS Layer -->
|
||||
<rect x="300" y="130" width="200" height="45" fill="rgba(99, 102, 241, 0.08)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="400" y="150" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
HTTP/HTTPS
|
||||
</text>
|
||||
<text x="400" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Port 8080
|
||||
</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 400 175 L 400 195" stroke="#2563EB" stroke-width="2.5" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
|
||||
<!-- API Gateway -->
|
||||
<rect x="250" y="195" width="300" height="50" fill="url(#gatewayGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="220" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
API Gateway
|
||||
</text>
|
||||
<text x="400" y="235" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/api/*
|
||||
</text>
|
||||
|
||||
<!-- Arrows to endpoint groups -->
|
||||
<path d="M 400 245 L 400 260 L 180 260 L 180 280" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
<path d="M 400 245 L 400 280" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
<path d="M 400 245 L 400 260 L 620 260 L 620 280" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
|
||||
<!-- Auth Endpoints -->
|
||||
<rect x="80" y="280" width="200" height="80" fill="url(#authGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="180" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Auth Endpoints
|
||||
</text>
|
||||
<text x="180" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/auth/login
|
||||
</text>
|
||||
<text x="180" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/auth/logout
|
||||
</text>
|
||||
<text x="180" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/auth/token
|
||||
</text>
|
||||
|
||||
<!-- Business Endpoints -->
|
||||
<rect x="300" y="280" width="200" height="80" fill="url(#businessGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Business Endpoints
|
||||
</text>
|
||||
<text x="400" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/files/* • /users/*
|
||||
</text>
|
||||
<text x="400" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/groups/* • /tasks/*
|
||||
</text>
|
||||
<text x="400" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/sessions/*
|
||||
</text>
|
||||
|
||||
<!-- Admin Endpoints -->
|
||||
<rect x="520" y="280" width="200" height="80" fill="url(#adminGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="620" y="305" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Admin Endpoints
|
||||
</text>
|
||||
<text x="620" y="325" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/admin/*
|
||||
</text>
|
||||
<text x="620" y="340" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/monitoring
|
||||
</text>
|
||||
<text x="620" y="355" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
/analytics
|
||||
</text>
|
||||
|
||||
<!-- Arrows converging to service layer -->
|
||||
<path d="M 180 360 L 180 380 L 400 380 L 400 400" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
<path d="M 400 360 L 400 400" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
<path d="M 620 360 L 620 380 L 400 380 L 400 400" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
|
||||
<!-- Service Layer -->
|
||||
<rect x="250" y="400" width="300" height="70" fill="url(#serviceGrad)" stroke="#2563EB" stroke-width="2" rx="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="600" fill="#4B5563">
|
||||
Service Layer
|
||||
</text>
|
||||
<text x="400" y="445" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Session Manager
|
||||
</text>
|
||||
<text x="400" y="460" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
• Auth Service • Bot Service
|
||||
</text>
|
||||
|
||||
<!-- Arrows to databases -->
|
||||
<path d="M 400 470 L 400 485 L 180 485 L 180 500" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
<path d="M 400 470 L 400 500" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
<path d="M 400 470 L 400 485 L 620 485 L 620 500" stroke="#2563EB" stroke-width="2" fill="none" marker-end="url(#arrow)" opacity="0.7">
|
||||
|
||||
<!-- PostgreSQL -->
|
||||
<rect x="80" y="500" width="200" height="70" fill="url(#dbGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="180" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
PostgreSQL
|
||||
</text>
|
||||
<text x="180" y="545" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Database
|
||||
</text>
|
||||
<text x="180" y="560" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Sessions • Users • Config
|
||||
</text>
|
||||
|
||||
<!-- Valkey Cache -->
|
||||
<rect x="300" y="500" width="200" height="70" fill="url(#dbGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="400" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Valkey
|
||||
</text>
|
||||
<text x="400" y="545" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Cache
|
||||
</text>
|
||||
<text x="400" y="560" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Semantic • Session • Temp
|
||||
</text>
|
||||
|
||||
<!-- Qdrant -->
|
||||
<rect x="520" y="500" width="200" height="70" fill="url(#dbGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="620" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="600" fill="#4B5563">
|
||||
Qdrant
|
||||
</text>
|
||||
<text x="620" y="545" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Vectors
|
||||
</text>
|
||||
<text x="620" y="560" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Embeddings • Search
|
||||
</text>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.3 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
<svg width="600" height="700" viewBox="0 0 600 700" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="600" height="700" viewBox="0 0 600 700" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
|
||||
<!-- Define gradients and effects -->
|
||||
<defs>
|
||||
<!-- Gradients for different stages -->
|
||||
|
|
@ -86,16 +86,16 @@
|
|||
|
||||
<!-- Title -->
|
||||
<rect x="150" y="10" width="300" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8"/>
|
||||
<text x="300" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="600" fill="#1e293b">
|
||||
API Request Flow
|
||||
</text>
|
||||
|
||||
<!-- HTTP Request -->
|
||||
<rect x="200" y="60" width="200" height="50" fill="url(#requestGrad)" stroke="#667eea" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="85" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
HTTP Request
|
||||
</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="100" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Client → Server
|
||||
</text>
|
||||
|
||||
|
|
@ -104,42 +104,42 @@
|
|||
|
||||
<!-- Rate Limit -->
|
||||
<rect x="200" y="140" width="200" height="60" fill="url(#rateLimitGrad)" stroke="#f59e0b" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="165" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="165" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Rate Limit
|
||||
</text>
|
||||
<text x="300" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="185" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Check request limits
|
||||
</text>
|
||||
|
||||
<!-- Pass/Fail paths -->
|
||||
<path d="M 300 200 L 300 230" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7"/>
|
||||
<text x="320" y="215" text-anchor="start" font-family="system-ui, sans-serif" font-size="10" font-weight="500" fill="#059669">Pass</text>
|
||||
<text x="320" y="215" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#059669">Pass</text>
|
||||
|
||||
<path d="M 400 170 L 480 170 L 480 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5"/>
|
||||
<text x="420" y="165" text-anchor="start" font-family="system-ui, sans-serif" font-size="9" fill="#dc2626">429 Too Many</text>
|
||||
<text x="420" y="165" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" fill="#dc2626">429 Too Many</text>
|
||||
|
||||
<!-- Auth -->
|
||||
<rect x="200" y="230" width="200" height="60" fill="url(#authGrad)" stroke="#ef4444" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="255" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="255" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Auth
|
||||
</text>
|
||||
<text x="300" y="275" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="275" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Validate token/session
|
||||
</text>
|
||||
|
||||
<!-- Pass/Fail paths -->
|
||||
<path d="M 300 290 L 300 320" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7"/>
|
||||
<text x="320" y="305" text-anchor="start" font-family="system-ui, sans-serif" font-size="10" font-weight="500" fill="#059669">Valid</text>
|
||||
<text x="320" y="305" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#059669">Valid</text>
|
||||
|
||||
<path d="M 400 260 L 460 260 L 460 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5"/>
|
||||
<text x="420" y="255" text-anchor="start" font-family="system-ui, sans-serif" font-size="9" fill="#dc2626">401 Unauthorized</text>
|
||||
<text x="420" y="255" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" fill="#dc2626">401 Unauthorized</text>
|
||||
|
||||
<!-- Route -->
|
||||
<rect x="200" y="320" width="200" height="60" fill="url(#routeGrad)" stroke="#8b5cf6" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="345" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="345" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Route
|
||||
</text>
|
||||
<text x="300" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="365" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Match endpoint pattern
|
||||
</text>
|
||||
|
||||
|
|
@ -147,30 +147,30 @@
|
|||
<path d="M 300 380 L 300 410" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7"/>
|
||||
|
||||
<path d="M 400 350 L 440 350 L 440 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5"/>
|
||||
<text x="420" y="345" text-anchor="start" font-family="system-ui, sans-serif" font-size="9" fill="#dc2626">404 Not Found</text>
|
||||
<text x="420" y="345" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" fill="#dc2626">404 Not Found</text>
|
||||
|
||||
<!-- Validate -->
|
||||
<rect x="200" y="410" width="200" height="60" fill="url(#validateGrad)" stroke="#06b6d4" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="435" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="435" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Validate
|
||||
</text>
|
||||
<text x="300" y="455" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="455" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Check request body
|
||||
</text>
|
||||
|
||||
<!-- Pass/Fail paths -->
|
||||
<path d="M 300 470 L 300 500" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7"/>
|
||||
<text x="320" y="485" text-anchor="start" font-family="system-ui, sans-serif" font-size="10" font-weight="500" fill="#059669">Valid</text>
|
||||
<text x="320" y="485" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#059669">Valid</text>
|
||||
|
||||
<path d="M 400 440 L 420 440 L 420 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5"/>
|
||||
<text x="425" y="435" text-anchor="start" font-family="system-ui, sans-serif" font-size="9" fill="#dc2626">400 Bad Request</text>
|
||||
<text x="425" y="435" text-anchor="start" font-family="system-ui, sans-serif" font-size="16" fill="#dc2626">400 Bad Request</text>
|
||||
|
||||
<!-- Process -->
|
||||
<rect x="200" y="500" width="200" height="60" fill="url(#processGrad)" stroke="#10b981" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="525" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Process
|
||||
</text>
|
||||
<text x="300" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="545" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Execute business logic
|
||||
</text>
|
||||
|
||||
|
|
@ -179,10 +179,10 @@
|
|||
|
||||
<!-- Format -->
|
||||
<rect x="200" y="590" width="200" height="60" fill="url(#formatGrad)" stroke="#00f2fe" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="615" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="615" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
Format
|
||||
</text>
|
||||
<text x="300" y="635" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="635" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
JSON response
|
||||
</text>
|
||||
|
||||
|
|
@ -191,22 +191,22 @@
|
|||
|
||||
<!-- HTTP Response -->
|
||||
<rect x="200" y="680" width="200" height="50" fill="url(#responseGrad)" stroke="#38f9d7" stroke-width="2" rx="8" filter="url(#shadow)"/>
|
||||
<text x="300" y="705" text-anchor="middle" font-family="system-ui, sans-serif" font-size="14" font-weight="600" fill="#1e293b">
|
||||
<text x="300" y="705" text-anchor="middle" font-family="system-ui, sans-serif" font-size="20" font-weight="600" fill="#1e293b">
|
||||
HTTP Response
|
||||
</text>
|
||||
<text x="300" y="720" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#475569">
|
||||
<text x="300" y="720" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#475569">
|
||||
Server → Client
|
||||
</text>
|
||||
|
||||
<!-- Error Response box -->
|
||||
<rect x="410" y="650" width="100" height="30" fill="rgba(239, 68, 68, 0.1)" stroke="#ef4444" stroke-width="1.5" rx="6"/>
|
||||
<text x="460" y="670" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" font-weight="500" fill="#dc2626">
|
||||
<text x="460" y="670" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" font-weight="500" fill="#dc2626">
|
||||
Error Response
|
||||
</text>
|
||||
|
||||
<!-- Side labels -->
|
||||
<g transform="translate(50, 380)">
|
||||
<text x="0" y="0" text-anchor="middle" font-family="system-ui, sans-serif" font-size="11" fill="#64748b" transform="rotate(-90)">
|
||||
<text x="0" y="0" text-anchor="middle" font-family="system-ui, sans-serif" font-size="16" fill="#64748b" transform="rotate(-90)">
|
||||
Request Pipeline
|
||||
</text>
|
||||
</g>
|
||||
|
|
@ -214,11 +214,11 @@
|
|||
<!-- Status indicators -->
|
||||
<g transform="translate(80, 150)">
|
||||
<circle cx="0" cy="0" r="4" fill="#10b981"/>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="9" fill="#475569">Success path</text>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Success path</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(80, 170)">
|
||||
<circle cx="0" cy="0" r="4" fill="#ef4444"/>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="9" fill="#475569">Error path</text>
|
||||
<text x="10" y="4" font-family="system-ui, sans-serif" font-size="16" fill="#475569">Error path</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
180
docs/src/chapter-10-api/assets/api-request-flow.svg.backup
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 680 780" 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="680" height="780" fill="#F9FAFB" stroke="#9CA3AF" stroke-width="2" rx="8">
|
||||
|
||||
<!-- Content container with proper margins -->
|
||||
<g transform="translate(40, 40)">
|
||||
<!-- Define gradients and effects -->
|
||||
|
||||
|
||||
<!-- Background -->
|
||||
<rect x="0" y="0" width="600" height="700" fill="#4B5563" rx="8" filter="url(#shadow)">
|
||||
|
||||
<!-- Title -->
|
||||
<rect x="150" y="10" width="300" height="35" fill="rgba(99, 102, 241, 0.05)" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" font-weight="600" fill="#4B5563">
|
||||
API Request Flow
|
||||
</text>
|
||||
|
||||
<!-- HTTP Request -->
|
||||
<rect x="200" y="60" width="200" height="50" fill="url(#requestGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="85" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
HTTP Request
|
||||
</text>
|
||||
<text x="300" y="100" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Client → Server
|
||||
</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 300 110 L 300 140" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7">
|
||||
|
||||
<!-- Rate Limit -->
|
||||
<rect x="200" y="140" width="200" height="60" fill="url(#rateLimitGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="165" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Rate Limit
|
||||
</text>
|
||||
<text x="300" y="185" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Check request limits
|
||||
</text>
|
||||
|
||||
<!-- Pass/Fail paths -->
|
||||
<path d="M 300 200 L 300 230" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7">
|
||||
<text x="320" y="215" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Pass</text>
|
||||
|
||||
<path d="M 400 170 L 480 170 L 480 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5">
|
||||
<text x="420" y="165" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">429 Too Many</text>
|
||||
|
||||
<!-- Auth -->
|
||||
<rect x="200" y="230" width="200" height="60" fill="url(#authGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="255" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Auth
|
||||
</text>
|
||||
<text x="300" y="275" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Validate token/session
|
||||
</text>
|
||||
|
||||
<!-- Pass/Fail paths -->
|
||||
<path d="M 300 290 L 300 320" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7">
|
||||
<text x="320" y="305" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Valid</text>
|
||||
|
||||
<path d="M 400 260 L 460 260 L 460 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5">
|
||||
<text x="420" y="255" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">401 Unauthorized</text>
|
||||
|
||||
<!-- Route -->
|
||||
<rect x="200" y="320" width="200" height="60" fill="url(#routeGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="345" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Route
|
||||
</text>
|
||||
<text x="300" y="365" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Match endpoint pattern
|
||||
</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 300 380 L 300 410" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7">
|
||||
|
||||
<path d="M 400 350 L 440 350 L 440 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5">
|
||||
<text x="420" y="345" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">404 Not Found</text>
|
||||
|
||||
<!-- Validate -->
|
||||
<rect x="200" y="410" width="200" height="60" fill="url(#validateGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="435" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Validate
|
||||
</text>
|
||||
<text x="300" y="455" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Check request body
|
||||
</text>
|
||||
|
||||
<!-- Pass/Fail paths -->
|
||||
<path d="M 300 470 L 300 500" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7">
|
||||
<text x="320" y="485" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563" filter="url(#textShadow)">Valid</text>
|
||||
|
||||
<path d="M 400 440 L 420 440 L 420 650" stroke="url(#failPath)" stroke-width="2" stroke-dasharray="5,3" fill="none" marker-end="url(#arrowFail)" opacity="0.5">
|
||||
<text x="425" y="435" text-anchor="start" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">400 Bad Request</text>
|
||||
|
||||
<!-- Process -->
|
||||
<rect x="200" y="500" width="200" height="60" fill="url(#processGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="525" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Process
|
||||
</text>
|
||||
<text x="300" y="545" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Execute business logic
|
||||
</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 300 560 L 300 590" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7">
|
||||
|
||||
<!-- Format -->
|
||||
<rect x="200" y="590" width="200" height="60" fill="url(#formatGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="615" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
Format
|
||||
</text>
|
||||
<text x="300" y="635" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
JSON response
|
||||
</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<path d="M 300 650 L 300 680" stroke="url(#successPath)" stroke-width="3" fill="none" marker-end="url(#arrowSuccess)" opacity="0.7">
|
||||
|
||||
<!-- HTTP Response -->
|
||||
<rect x="200" y="680" width="200" height="50" fill="url(#responseGrad)" stroke="#2563EB" stroke-width="2" rx="8" filter="url(#shadow)">
|
||||
<text x="300" y="705" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="16" font-weight="600" fill="#4B5563">
|
||||
HTTP Response
|
||||
</text>
|
||||
<text x="300" y="720" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563">
|
||||
Server → Client
|
||||
</text>
|
||||
|
||||
<!-- Error Response box -->
|
||||
<rect x="410" y="650" width="100" height="30" fill="rgba(239, 68, 68, 0.1)" stroke="#2563EB" stroke-width="2" rx="6" filter="url(#shadow)">
|
||||
<text x="460" y="670" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" font-weight="500" fill="#4B5563">
|
||||
Error Response
|
||||
</text>
|
||||
|
||||
<!-- Side labels -->
|
||||
<g transform="translate(50, 380)">
|
||||
<text x="0" y="0" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" transform="rotate(-90)">
|
||||
Request Pipeline
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Status indicators -->
|
||||
<g transform="translate(80, 150)">
|
||||
<circle cx="0" cy="0" r="4" fill="#4B5563">
|
||||
<text x="10" y="4" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Success path</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(80, 170)">
|
||||
<circle cx="0" cy="0" r="4" fill="#1F2937">
|
||||
<text x="10" y="4" font-family="system-ui, -apple-system, sans-serif" font-size="14" fill="#4B5563" filter="url(#textShadow)">Error path</text>
|
||||
</g>
|
||||
|
||||
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.4 KiB |
|
|
@ -44,7 +44,7 @@ The AI handles everything else - understanding intent, collecting information, e
|
|||
That's it. No Kubernetes, no cloud accounts. The [bootstrap process](./chapter-01/installation.md) installs everything locally in 2-5 minutes. [PostgreSQL](./chapter-07/postgresql.md), [vector database](./chapter-03/vector-collections.md), [object storage](./chapter-07/minio.md), [cache](./chapter-03/caching.md) - all configured automatically with secure credentials.
|
||||
|
||||
### Real BASIC, Real Simple
|
||||
Remember BASIC from the 80s? We brought it back for conversational AI. See our [complete keyword reference](./chapter-05/README.md):
|
||||
We brought BASIC back for conversational AI. See our [complete keyword reference](./chapter-05/README.md):
|
||||
```basic
|
||||
' save-note.bas - A simple tool
|
||||
PARAM topic, content
|
||||
|
|
|
|||
226
fix_all_svgs.py
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Fix and beautify all SVG files with proper syntax and mobile-friendly design
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def fix_svg_file(filepath):
|
||||
"""Fix a single SVG file with proper formatting and mobile-friendly design"""
|
||||
|
||||
try:
|
||||
# Read the original file
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Skip font files and favicons
|
||||
if "fontawesome" in str(filepath).lower() or "favicon" in str(filepath).lower():
|
||||
return False
|
||||
|
||||
print(f"Fixing: {filepath}")
|
||||
|
||||
# First, clean up any broken attributes
|
||||
# Remove any malformed style attributes
|
||||
content = re.sub(r'style="[^"]*"[^>]*style="[^"]*"', "", content)
|
||||
|
||||
# Fix basic SVG structure
|
||||
if not content.strip().startswith("<?xml"):
|
||||
content = '<?xml version="1.0" encoding="UTF-8"?>\n' + content
|
||||
|
||||
# Extract dimensions
|
||||
width_match = re.search(r'width="(\d+)"', content)
|
||||
height_match = re.search(r'height="(\d+)"', content)
|
||||
viewbox_match = re.search(r'viewBox="([^"]+)"', content)
|
||||
|
||||
if viewbox_match:
|
||||
viewbox = viewbox_match.group(1)
|
||||
elif width_match and height_match:
|
||||
width = width_match.group(1)
|
||||
height = height_match.group(1)
|
||||
viewbox = f"0 0 {width} {height}"
|
||||
else:
|
||||
viewbox = "0 0 800 600"
|
||||
|
||||
# Create clean SVG header
|
||||
svg_header = f'''<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="{viewbox}" 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>
|
||||
'''
|
||||
|
||||
# Extract the main content (remove old svg tags and defs)
|
||||
main_content = re.sub(r"<\?xml[^>]*\?>", "", content)
|
||||
main_content = re.sub(r"<svg[^>]*>", "", main_content)
|
||||
main_content = re.sub(r"</svg>", "", main_content)
|
||||
main_content = re.sub(r"<defs>.*?</defs>", "", main_content, flags=re.DOTALL)
|
||||
|
||||
# Fix font sizes for mobile (minimum 14px for body text)
|
||||
def fix_font_size(match):
|
||||
size = int(match.group(1))
|
||||
if size < 12:
|
||||
return f'font-size="{14}"'
|
||||
elif size < 14:
|
||||
return f'font-size="{14}"'
|
||||
elif size > 24:
|
||||
return f'font-size="{24}"'
|
||||
else:
|
||||
return match.group(0)
|
||||
|
||||
main_content = re.sub(r'font-size="(\d+)"', fix_font_size, main_content)
|
||||
|
||||
# Fix colors for better contrast
|
||||
color_map = {
|
||||
# Blues
|
||||
"#63B3ED": "#2563EB",
|
||||
"#90CDF4": "#3B82F6",
|
||||
"#4A90E2": "#2563EB",
|
||||
"#CBD5E0": "#1F2937", # Light gray text to dark
|
||||
"#A0AEC0": "#4B5563", # Medium gray text to darker
|
||||
# Greens
|
||||
"#68D391": "#059669",
|
||||
"#48BB78": "#10B981",
|
||||
"#38A169": "#059669",
|
||||
"#9AE6B4": "#10B981",
|
||||
# Purples
|
||||
"#B794F4": "#7C3AED",
|
||||
"#D6BCFA": "#8B5CF6",
|
||||
"#9F7AEA": "#7C3AED",
|
||||
"#E9D8FD": "#8B5CF6",
|
||||
# Oranges
|
||||
"#F6AD55": "#EA580C",
|
||||
"#FBD38D": "#F97316",
|
||||
"#ED8936": "#EA580C",
|
||||
# Reds
|
||||
"#FC8181": "#DC2626",
|
||||
"#FEB2B2": "#EF4444",
|
||||
"#E53E3E": "#DC2626",
|
||||
# Teals
|
||||
"#4FD1C5": "#0891B2",
|
||||
"#81E6D9": "#06B6D4",
|
||||
"#38D4B2": "#0891B2",
|
||||
"#B2F5EA": "#06B6D4",
|
||||
# Grays
|
||||
"#4A5568": "#6B7280",
|
||||
"#718096": "#6B7280",
|
||||
"#888": "#6B7280",
|
||||
}
|
||||
|
||||
for old_color, new_color in color_map.items():
|
||||
main_content = main_content.replace(
|
||||
f'fill="{old_color}"', f'fill="{new_color}"'
|
||||
)
|
||||
main_content = main_content.replace(
|
||||
f'stroke="{old_color}"', f'stroke="{new_color}"'
|
||||
)
|
||||
main_content = main_content.replace(
|
||||
f'fill="{old_color.lower()}"', f'fill="{new_color}"'
|
||||
)
|
||||
main_content = main_content.replace(
|
||||
f'stroke="{old_color.lower()}"', f'stroke="{new_color}"'
|
||||
)
|
||||
|
||||
# Fix font families
|
||||
main_content = re.sub(
|
||||
r'font-family="[^"]*"',
|
||||
'font-family="system-ui, -apple-system, sans-serif"',
|
||||
main_content,
|
||||
)
|
||||
|
||||
# Ensure stroke widths are visible
|
||||
main_content = re.sub(r'stroke-width="1"', 'stroke-width="2"', main_content)
|
||||
|
||||
# Add rounded corners to rectangles
|
||||
def add_rounded_corners(match):
|
||||
rect = match.group(0)
|
||||
if "rx=" not in rect:
|
||||
rect = rect[:-1] + ' rx="6"/>'
|
||||
return rect
|
||||
|
||||
main_content = re.sub(r"<rect[^>]*/>", add_rounded_corners, main_content)
|
||||
|
||||
# Combine everything
|
||||
final_svg = svg_header + main_content + "\n</svg>"
|
||||
|
||||
# Write the fixed file
|
||||
with open(filepath, "w", encoding="utf-8") as f:
|
||||
f.write(final_svg)
|
||||
|
||||
print(f" ✓ Fixed successfully")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f" ✗ Error: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
"""Fix all SVG files in the docs directory"""
|
||||
|
||||
print("=" * 60)
|
||||
print("SVG FIXER - Repairing and beautifying all diagrams")
|
||||
print("=" * 60)
|
||||
print()
|
||||
|
||||
docs_dir = Path("docs")
|
||||
svg_files = list(docs_dir.glob("**/*.svg"))
|
||||
|
||||
print(f"Found {len(svg_files)} SVG files")
|
||||
print()
|
||||
|
||||
fixed_count = 0
|
||||
skipped_count = 0
|
||||
error_count = 0
|
||||
|
||||
for svg_file in svg_files:
|
||||
if "fontawesome" in str(svg_file).lower() or "favicon" in str(svg_file).lower():
|
||||
print(f"Skipping: {svg_file} (font/favicon)")
|
||||
skipped_count += 1
|
||||
continue
|
||||
|
||||
result = fix_svg_file(svg_file)
|
||||
if result:
|
||||
fixed_count += 1
|
||||
else:
|
||||
error_count += 1
|
||||
|
||||
print()
|
||||
print("=" * 60)
|
||||
print("SUMMARY")
|
||||
print("=" * 60)
|
||||
print(f"✓ Fixed: {fixed_count} files")
|
||||
print(f"⊘ Skipped: {skipped_count} files")
|
||||
if error_count > 0:
|
||||
print(f"✗ Errors: {error_count} files")
|
||||
print()
|
||||
print("All SVG files now have:")
|
||||
print("• Mobile-friendly text sizes (min 14px)")
|
||||
print("• High contrast colors")
|
||||
print("• Consistent fonts")
|
||||
print("• Rounded corners")
|
||||
print("• Proper stroke widths")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
188
fix_svg_attributes.py
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Fix malformed SVG attributes in all SVG files
|
||||
Specifically fixes the 'rx="5"/' issue and other attribute errors
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def fix_malformed_attributes(content):
|
||||
"""Fix various types of malformed attributes in SVG content"""
|
||||
|
||||
# Fix malformed rx attributes (rx="5"/ should be rx="5")
|
||||
content = re.sub(r'rx="([^"]+)"\s*/', r'rx="\1"', content)
|
||||
|
||||
# Fix malformed ry attributes
|
||||
content = re.sub(r'ry="([^"]+)"\s*/', r'ry="\1"', content)
|
||||
|
||||
# Fix cases where filter appears after malformed rx
|
||||
content = re.sub(
|
||||
r'rx="([^"]+)"/\s*filter="([^"]+)"', r'rx="\1" filter="\2"', content
|
||||
)
|
||||
|
||||
# Fix double closing brackets
|
||||
content = re.sub(r"/>>", r"/>", content)
|
||||
|
||||
# Fix attributes that got split incorrectly
|
||||
content = re.sub(r'"\s+([a-z-]+)="', r'" \1="', content)
|
||||
|
||||
# Fix rect tags with malformed endings
|
||||
content = re.sub(
|
||||
r'<rect([^>]+)"\s*/\s+([a-z-]+)="([^"]+)">', r'<rect\1" \2="\3">', content
|
||||
)
|
||||
|
||||
# Fix specific pattern: stroke-width="2" rx="5"/ filter="url(#shadow)">
|
||||
content = re.sub(
|
||||
r'stroke-width="(\d+)"\s+rx="(\d+)"/\s*filter="([^"]+)">',
|
||||
r'stroke-width="\1" rx="\2" filter="\3">',
|
||||
content,
|
||||
)
|
||||
|
||||
# Fix any remaining "/ patterns at the end of attributes
|
||||
content = re.sub(r'="([^"]*)"\s*/', r'="\1"', content)
|
||||
|
||||
# Fix rectangles that should be self-closing
|
||||
lines = content.split("\n")
|
||||
fixed_lines = []
|
||||
|
||||
for line in lines:
|
||||
# If it's a rect element that ends with > but has no content, make it self-closing
|
||||
if (
|
||||
"<rect" in line
|
||||
and line.strip().endswith(">")
|
||||
and not line.strip().endswith("/>")
|
||||
):
|
||||
# Check if this rect has content after it or should be self-closing
|
||||
if (
|
||||
'fill="none"' in line
|
||||
or 'fill="transparent"' in line
|
||||
or 'fill="white"' in line
|
||||
):
|
||||
line = line.rstrip(">") + "/>"
|
||||
fixed_lines.append(line)
|
||||
|
||||
content = "\n".join(fixed_lines)
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def validate_svg_structure(content):
|
||||
"""Basic validation to ensure SVG structure is correct"""
|
||||
|
||||
# Check for basic SVG structure
|
||||
if "<svg" not in content:
|
||||
return False, "Missing SVG tag"
|
||||
|
||||
if "</svg>" not in content:
|
||||
return False, "Missing closing SVG tag"
|
||||
|
||||
# Count opening and closing tags for basic elements
|
||||
rect_open = content.count("<rect")
|
||||
rect_close = content.count("</rect>")
|
||||
rect_self = content.count("/>")
|
||||
|
||||
# Basic tag balance check (not perfect but catches major issues)
|
||||
text_open = content.count("<text")
|
||||
text_close = content.count("</text>")
|
||||
|
||||
if text_open != text_close:
|
||||
return False, f"Text tag mismatch: {text_open} opening vs {text_close} closing"
|
||||
|
||||
# Check for common malformed patterns
|
||||
if "/ " in content and "filter=" in content:
|
||||
malformed = re.findall(r'rx="[^"]+"/\s*filter=', content)
|
||||
if malformed:
|
||||
return False, f"Found malformed attribute pattern"
|
||||
|
||||
return True, "OK"
|
||||
|
||||
|
||||
def fix_svg_file(filepath):
|
||||
"""Fix a single SVG file"""
|
||||
|
||||
try:
|
||||
# Read the file
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Skip font files and favicons
|
||||
if "fontawesome" in str(filepath).lower() or "favicon" in str(filepath).lower():
|
||||
return "skipped", None
|
||||
|
||||
# Apply fixes
|
||||
fixed_content = fix_malformed_attributes(content)
|
||||
|
||||
# Validate the result
|
||||
is_valid, message = validate_svg_structure(fixed_content)
|
||||
|
||||
if not is_valid:
|
||||
print(f" ⚠ Validation warning: {message}")
|
||||
|
||||
# Write back only if content changed
|
||||
if fixed_content != content:
|
||||
with open(filepath, "w", encoding="utf-8") as f:
|
||||
f.write(fixed_content)
|
||||
return "fixed", None
|
||||
else:
|
||||
return "unchanged", None
|
||||
|
||||
except Exception as e:
|
||||
return "error", str(e)
|
||||
|
||||
|
||||
def main():
|
||||
"""Fix all SVG files in the docs directory"""
|
||||
|
||||
print("=" * 60)
|
||||
print("SVG ATTRIBUTE FIXER")
|
||||
print("Fixing malformed attributes in all SVG files")
|
||||
print("=" * 60)
|
||||
print()
|
||||
|
||||
docs_dir = Path("docs")
|
||||
svg_files = list(docs_dir.glob("**/*.svg"))
|
||||
|
||||
print(f"Found {len(svg_files)} SVG files")
|
||||
print()
|
||||
|
||||
stats = {"fixed": 0, "unchanged": 0, "skipped": 0, "error": 0}
|
||||
|
||||
for svg_file in svg_files:
|
||||
print(f"Processing: {svg_file}")
|
||||
|
||||
status, error = fix_svg_file(svg_file)
|
||||
stats[status] += 1
|
||||
|
||||
if status == "fixed":
|
||||
print(f" ✓ Fixed malformed attributes")
|
||||
elif status == "unchanged":
|
||||
print(f" - No changes needed")
|
||||
elif status == "skipped":
|
||||
print(f" ⊘ Skipped (font/favicon)")
|
||||
elif status == "error":
|
||||
print(f" ✗ Error: {error}")
|
||||
|
||||
print()
|
||||
print("=" * 60)
|
||||
print("SUMMARY")
|
||||
print("=" * 60)
|
||||
print(f"✓ Fixed: {stats['fixed']} files")
|
||||
print(f"- Unchanged: {stats['unchanged']} files")
|
||||
print(f"⊘ Skipped: {stats['skipped']} files")
|
||||
if stats["error"] > 0:
|
||||
print(f"✗ Errors: {stats['error']} files")
|
||||
|
||||
print()
|
||||
print("Common fixes applied:")
|
||||
print('• Fixed malformed rx="5"/ attributes')
|
||||
print("• Corrected filter attribute placement")
|
||||
print("• Fixed self-closing tags")
|
||||
print("• Cleaned up attribute spacing")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
219
fix_svgs_properly.py
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Fix all SVG files to be properly readable on all devices
|
||||
Focus on text size, contrast, and responsive design
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def fix_svg_content(content, filename):
|
||||
"""
|
||||
Apply comprehensive fixes to SVG content
|
||||
"""
|
||||
|
||||
# 1. Fix SVG header for responsiveness
|
||||
# Remove any width/height attributes and ensure proper viewBox
|
||||
if "<svg" in content:
|
||||
# Extract viewBox if exists, or create from width/height
|
||||
viewbox_match = re.search(r'viewBox="([^"]+)"', content)
|
||||
width_match = re.search(r'width="(\d+)"', content)
|
||||
height_match = re.search(r'height="(\d+)"', content)
|
||||
|
||||
if viewbox_match:
|
||||
viewbox = viewbox_match.group(1)
|
||||
elif width_match and height_match:
|
||||
viewbox = f"0 0 {width_match.group(1)} {height_match.group(1)}"
|
||||
else:
|
||||
viewbox = "0 0 800 600"
|
||||
|
||||
# Replace the SVG opening tag
|
||||
svg_pattern = r"<svg[^>]*>"
|
||||
svg_replacement = f'<svg viewBox="{viewbox}" xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: auto; max-width: 100%; display: block;">'
|
||||
content = re.sub(svg_pattern, svg_replacement, content, count=1)
|
||||
|
||||
# 2. Fix all font sizes - MINIMUM 16px for readability
|
||||
def increase_font_size(match):
|
||||
size = int(match.group(1))
|
||||
if size < 14:
|
||||
return f'font-size="16"'
|
||||
elif size < 16:
|
||||
return f'font-size="18"'
|
||||
elif size < 18:
|
||||
return f'font-size="20"'
|
||||
else:
|
||||
return f'font-size="{size + 4}"' # Increase all fonts slightly
|
||||
|
||||
content = re.sub(r'font-size="(\d+)"', increase_font_size, content)
|
||||
|
||||
# 3. Fix ALL text colors for maximum contrast
|
||||
# Replace all light colors with dark, readable ones
|
||||
color_replacements = {
|
||||
# Light grays to dark gray/black
|
||||
"#CBD5E0": "#1F2937",
|
||||
"#A0AEC0": "#374151",
|
||||
"#E2E8F0": "#1F2937",
|
||||
"#EDF2F7": "#111827",
|
||||
"#F7FAFC": "#111827",
|
||||
"#9CA3AF": "#374151",
|
||||
"#D1D5DB": "#4B5563",
|
||||
"#718096": "#374151",
|
||||
"#4A5568": "#1F2937",
|
||||
# Light blues to dark blues
|
||||
"#90CDF4": "#1E40AF",
|
||||
"#63B3ED": "#2563EB",
|
||||
"#4A90E2": "#1D4ED8",
|
||||
"#81E6D9": "#0E7490",
|
||||
"#4FD1C5": "#0891B2",
|
||||
"#38D4B2": "#0D9488",
|
||||
# Light purples to dark purples
|
||||
"#E9D8FD": "#6B21A8",
|
||||
"#D6BCFA": "#7C3AED",
|
||||
"#B794F4": "#9333EA",
|
||||
"#9F7AEA": "#7C3AED",
|
||||
# Light oranges to dark oranges
|
||||
"#FBD38D": "#C2410C",
|
||||
"#F6AD55": "#EA580C",
|
||||
"#ED8936": "#C2410C",
|
||||
# Light reds to dark reds
|
||||
"#FEB2B2": "#B91C1C",
|
||||
"#FC8181": "#DC2626",
|
||||
"#E53E3E": "#DC2626",
|
||||
# Light greens to dark greens
|
||||
"#9AE6B4": "#047857",
|
||||
"#68D391": "#059669",
|
||||
"#48BB78": "#047857",
|
||||
"#38A169": "#059669",
|
||||
"#B2F5EA": "#047857",
|
||||
# Generic light to dark
|
||||
"#888": "#374151",
|
||||
"#888888": "#374151",
|
||||
"#FAFAFA": "transparent",
|
||||
"#fff": "#111827",
|
||||
"#ffffff": "#111827",
|
||||
"#FFF": "#111827",
|
||||
"#FFFFFF": "#111827",
|
||||
}
|
||||
|
||||
for old_color, new_color in color_replacements.items():
|
||||
# Replace in fill attributes
|
||||
content = re.sub(
|
||||
f'fill="{old_color}"', f'fill="{new_color}"', content, flags=re.IGNORECASE
|
||||
)
|
||||
# Replace in stroke attributes
|
||||
content = re.sub(
|
||||
f'stroke="{old_color}"',
|
||||
f'stroke="{new_color}"',
|
||||
content,
|
||||
flags=re.IGNORECASE,
|
||||
)
|
||||
# Replace in style attributes
|
||||
content = re.sub(
|
||||
f"fill:{old_color}", f"fill:{new_color}", content, flags=re.IGNORECASE
|
||||
)
|
||||
content = re.sub(
|
||||
f"stroke:{old_color}", f"stroke:{new_color}", content, flags=re.IGNORECASE
|
||||
)
|
||||
|
||||
# 4. Remove white/light backgrounds
|
||||
content = re.sub(r'<rect[^>]*fill="#FAFAFA"[^>]*>', "", content)
|
||||
content = re.sub(r'<rect[^>]*fill="white"[^>]*>', "", content)
|
||||
content = re.sub(r'<rect[^>]*fill="#FFFFFF"[^>]*>', "", content)
|
||||
content = re.sub(r'<rect[^>]*fill="#ffffff"[^>]*>', "", content)
|
||||
|
||||
# 5. Fix stroke widths for visibility
|
||||
content = re.sub(r'stroke-width="1"', 'stroke-width="2"', content)
|
||||
content = re.sub(r'stroke-width="0\.5"', 'stroke-width="2"', content)
|
||||
|
||||
# 6. Fix font weights
|
||||
content = re.sub(r'font-weight="bold"', 'font-weight="700"', content)
|
||||
|
||||
# 7. Fix font families for better rendering
|
||||
content = re.sub(
|
||||
r'font-family="[^"]*"',
|
||||
'font-family="system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif"',
|
||||
content,
|
||||
)
|
||||
|
||||
# 8. Ensure arrows and markers are visible
|
||||
content = re.sub(
|
||||
r'<path d="M0,0 L0,6 L9,3 z" fill="#888"/>',
|
||||
'<path d="M0,0 L0,6 L9,3 z" fill="#374151"/>',
|
||||
content,
|
||||
)
|
||||
|
||||
# 9. Add slight padding to the viewBox if needed
|
||||
viewbox_match = re.search(r'viewBox="(\d+)\s+(\d+)\s+(\d+)\s+(\d+)"', content)
|
||||
if viewbox_match:
|
||||
x, y, width, height = map(int, viewbox_match.groups())
|
||||
# Add 20px padding
|
||||
new_viewbox = f'viewBox="{x - 20} {y - 20} {width + 40} {height + 40}"'
|
||||
content = re.sub(r'viewBox="[^"]*"', new_viewbox, content, count=1)
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def process_all_svgs():
|
||||
"""Process all SVG files in the docs directory"""
|
||||
|
||||
docs_dir = Path("docs")
|
||||
svg_files = list(docs_dir.glob("**/*.svg"))
|
||||
|
||||
# Filter out font files
|
||||
svg_files = [
|
||||
f
|
||||
for f in svg_files
|
||||
if "fontawesome" not in str(f).lower() and "favicon" not in str(f).lower()
|
||||
]
|
||||
|
||||
print(f"Found {len(svg_files)} SVG files to fix")
|
||||
print("=" * 60)
|
||||
|
||||
fixed = 0
|
||||
errors = 0
|
||||
|
||||
for svg_file in svg_files:
|
||||
try:
|
||||
print(f"Processing: {svg_file.relative_to(docs_dir)}")
|
||||
|
||||
# Read the file
|
||||
with open(svg_file, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Apply fixes
|
||||
fixed_content = fix_svg_content(content, svg_file.name)
|
||||
|
||||
# Write back
|
||||
with open(svg_file, "w", encoding="utf-8") as f:
|
||||
f.write(fixed_content)
|
||||
|
||||
print(f" ✓ Fixed successfully")
|
||||
fixed += 1
|
||||
|
||||
except Exception as e:
|
||||
print(f" ✗ Error: {e}")
|
||||
errors += 1
|
||||
|
||||
print()
|
||||
print("=" * 60)
|
||||
print(f"COMPLETED: {fixed} files fixed, {errors} errors")
|
||||
print()
|
||||
print("Improvements applied:")
|
||||
print("• All text now ≥16px (readable on mobile)")
|
||||
print("• High contrast colors (dark text, no light grays)")
|
||||
print("• 100% responsive width")
|
||||
print("• Removed white backgrounds")
|
||||
print("• Enhanced stroke widths")
|
||||
print("• Added padding to prevent cutoff")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("=" * 60)
|
||||
print("SVG READABILITY FIXER")
|
||||
print("Making all diagrams actually readable!")
|
||||
print("=" * 60)
|
||||
print()
|
||||
process_all_svgs()
|
||||
114
minimal_svg_fix.py
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Minimal SVG fix - ONLY fixes text size and contrast
|
||||
No structural changes, no breaking modifications
|
||||
"""
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def minimal_fix_svg(filepath):
|
||||
"""Apply minimal fixes to make SVG text readable"""
|
||||
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Skip font files
|
||||
if "fontawesome" in str(filepath).lower() or "favicon" in str(filepath).lower():
|
||||
return False
|
||||
|
||||
# 1. Increase font sizes (minimum 16px for readability)
|
||||
def fix_font_size(match):
|
||||
size = int(match.group(1))
|
||||
if size <= 11:
|
||||
return f'font-size="16"'
|
||||
elif size == 12:
|
||||
return f'font-size="18"'
|
||||
elif size <= 14:
|
||||
return f'font-size="20"'
|
||||
else:
|
||||
return f'font-size="{size + 4}"'
|
||||
|
||||
content = re.sub(r'font-size="(\d+)"', fix_font_size, content)
|
||||
|
||||
# 2. Fix text colors for contrast
|
||||
# Light grays to dark
|
||||
content = content.replace('fill="#CBD5E0"', 'fill="#1F2937"')
|
||||
content = content.replace('fill="#A0AEC0"', 'fill="#374151"')
|
||||
content = content.replace('fill="#718096"', 'fill="#374151"')
|
||||
content = content.replace('fill="#E2E8F0"', 'fill="#1F2937"')
|
||||
|
||||
# Light blues to darker blues
|
||||
content = content.replace('fill="#90CDF4"', 'fill="#1E40AF"')
|
||||
content = content.replace('fill="#63B3ED"', 'fill="#2563EB"')
|
||||
|
||||
# Light purples to darker
|
||||
content = content.replace('fill="#E9D8FD"', 'fill="#7C3AED"')
|
||||
content = content.replace('fill="#D6BCFA"', 'fill="#9333EA"')
|
||||
content = content.replace('fill="#B794F4"', 'fill="#9333EA"')
|
||||
|
||||
# Light oranges to darker
|
||||
content = content.replace('fill="#FBD38D"', 'fill="#EA580C"')
|
||||
content = content.replace('fill="#F6AD55"', 'fill="#D97706"')
|
||||
|
||||
# Light reds to darker
|
||||
content = content.replace('fill="#FEB2B2"', 'fill="#DC2626"')
|
||||
content = content.replace('fill="#FC8181"', 'fill="#EF4444"')
|
||||
|
||||
# Light greens stay green (they're usually OK)
|
||||
# But make them slightly darker
|
||||
content = content.replace('fill="#9AE6B4"', 'fill="#10B981"')
|
||||
content = content.replace('fill="#68D391"', 'fill="#059669"')
|
||||
content = content.replace('fill="#48BB78"', 'fill="#047857"')
|
||||
|
||||
# Light teals
|
||||
content = content.replace('fill="#81E6D9"', 'fill="#0891B2"')
|
||||
content = content.replace('fill="#4FD1C5"', 'fill="#0891B2"')
|
||||
content = content.replace('fill="#B2F5EA"', 'fill="#0E7490"')
|
||||
|
||||
# Gray arrows
|
||||
content = content.replace('fill="#888"', 'fill="#4B5563"')
|
||||
|
||||
# 3. Make SVG responsive (add style attribute if missing)
|
||||
if "<svg" in content and "style=" not in content.split(">")[0]:
|
||||
content = re.sub(
|
||||
r"(<svg[^>]*)(>)",
|
||||
r'\1 style="max-width: 100%; height: auto;"\2',
|
||||
content,
|
||||
count=1,
|
||||
)
|
||||
|
||||
# Write the fixed content
|
||||
with open(filepath, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
"""Fix all SVG files in docs/src"""
|
||||
|
||||
docs_src = Path("docs/src")
|
||||
svg_files = list(docs_src.rglob("*.svg"))
|
||||
|
||||
print(f"Fixing {len(svg_files)} SVG files...")
|
||||
|
||||
fixed = 0
|
||||
for svg_file in svg_files:
|
||||
try:
|
||||
if minimal_fix_svg(svg_file):
|
||||
print(f"✓ {svg_file.name}")
|
||||
fixed += 1
|
||||
except Exception as e:
|
||||
print(f"✗ {svg_file.name}: {e}")
|
||||
|
||||
print(f"\nFixed {fixed} files")
|
||||
print("Changes made:")
|
||||
print("• Font sizes increased (16px minimum)")
|
||||
print("• Text colors darkened for contrast")
|
||||
print("• SVGs made responsive")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
341
prompts/dev/svg-diagram-style-guide.md
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
# SVG Diagram Style Guide & Prompt Template
|
||||
|
||||
## Quick Prompt Template
|
||||
|
||||
When creating technical diagrams or flow charts, use this prompt:
|
||||
|
||||
```
|
||||
Create a clean SVG diagram with these specifications:
|
||||
- Transparent background (no fill)
|
||||
- Large dimensions: width="1040-1400" height="[appropriate height]" (1.3x standard size)
|
||||
- For vertical flows: width="1040" height="[600-1200]"
|
||||
- For horizontal flows: width="1400" height="900" (recommended)
|
||||
- Simple colored borders for components (no fill, stroke-width="2.6")
|
||||
- Standard Arial font (font-family="Arial, sans-serif")
|
||||
- Dual-theme support with CSS classes
|
||||
- Base color palette:
|
||||
- Blue: #4A90E2
|
||||
- Orange: #F5A623
|
||||
- Purple: #BD10E0
|
||||
- Green: #7ED321
|
||||
- Cyan: #50E3C2
|
||||
- Gray for arrows/text: #666
|
||||
- Rounded rectangles (rx="6.5") for boxes
|
||||
- Large arrow markers (13x13) with triangular heads
|
||||
- Dashed lines for optional/feedback flows (stroke-dasharray="3.9,3.9")
|
||||
- Subtle neon glow effects for dark themes
|
||||
- Text should be centered in boxes (text-anchor="middle")
|
||||
- Font sizes: 29-32px for titles, 22-24px for component labels, 18-21px for descriptions
|
||||
- DUAL DIAGRAM COMPOSITION when possible (main flow + progress/legend)
|
||||
- Title positioned well above content (y="45" minimum)
|
||||
- Text wrapping for long labels (review box width constraints)
|
||||
```
|
||||
|
||||
## Beautiful Composition Rules - THE STANDARD!
|
||||
|
||||
### Dual-Diagram Approach (RECOMMENDED)
|
||||
When creating process flows or pipelines, compose TWO complementary visualizations:
|
||||
|
||||
1. **Main Flow Diagram** (Top Section)
|
||||
- Primary process visualization with components and connections
|
||||
- Positioned in upper 60-70% of canvas
|
||||
- Clear phase groupings with section labels
|
||||
- Components sized appropriately for their text content
|
||||
|
||||
2. **Progress Indicator/Legend** (Bottom Section)
|
||||
- Visual timeline or progress bar showing stages
|
||||
- Positioned in lower 30-40% of canvas
|
||||
- Stage markers with labels below
|
||||
- Connected with subtle lines or gradient background
|
||||
- Creates visual rhythm and helps navigation
|
||||
|
||||
### Text Handling Rules
|
||||
- **Long Text**: MUST be reviewed against box width
|
||||
- If text exceeds box width, either:
|
||||
- Increase box width to accommodate
|
||||
- Use text wrapping with multiple <tspan> elements
|
||||
- Abbreviate with full text in tooltip/description
|
||||
- **Component Labels**: Keep concise, max 2-3 words when possible
|
||||
- **Descriptions**: Use separate text elements below main diagram
|
||||
|
||||
### Spacing & Visual Hierarchy
|
||||
- **Title Separation**: Position title FAR from content (y="45" minimum)
|
||||
- **Phase Grouping**: Clear visual separation between logical phases
|
||||
- **Vertical Rhythm**: Consistent spacing creates professional look
|
||||
- **Legend Positioning**: Always at bottom with ample spacing from main diagram
|
||||
|
||||
## Enhanced SVG Structure Template with Dual Composition
|
||||
|
||||
```svg
|
||||
<svg width="1400" height="900" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
/* Light theme defaults */
|
||||
.neon-blue { stroke: #4A90E2; stroke-width: 2.6; }
|
||||
.neon-orange { stroke: #F5A623; stroke-width: 2.6; }
|
||||
.neon-purple { stroke: #BD10E0; stroke-width: 2.6; }
|
||||
.neon-green { stroke: #7ED321; stroke-width: 2.6; }
|
||||
.neon-cyan { stroke: #50E3C2; stroke-width: 2.6; }
|
||||
.main-text { fill: #1a1a1a; }
|
||||
.secondary-text { fill: #666; }
|
||||
.arrow-color { stroke: #666; fill: #666; }
|
||||
|
||||
/* Dark theme with subtle neon effects */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.neon-blue {
|
||||
stroke: #00D4FF;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00D4FF) drop-shadow(0 0 8px #00A0FF);
|
||||
}
|
||||
.neon-orange {
|
||||
stroke: #FF9500;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #FF9500) drop-shadow(0 0 8px #FF7700);
|
||||
}
|
||||
.neon-purple {
|
||||
stroke: #E040FB;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #E040FB) drop-shadow(0 0 8px #D500F9);
|
||||
}
|
||||
.neon-green {
|
||||
stroke: #00FF88;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00FF88) drop-shadow(0 0 8px #00E676);
|
||||
}
|
||||
.neon-cyan {
|
||||
stroke: #00E5EA;
|
||||
stroke-width: 2.8;
|
||||
filter: drop-shadow(0 0 4px #00E5EA) drop-shadow(0 0 8px #00BCD4);
|
||||
}
|
||||
.main-text { fill: #FFFFFF; }
|
||||
.secondary-text { fill: #B0B0B0; }
|
||||
.arrow-color { stroke: #B0B0B0; fill: #B0B0B0; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
<marker id="arrow" markerWidth="13" markerHeight="13" refX="11.7" refY="3.9" orient="auto" markerUnits="strokeWidth">
|
||||
<path d="M0,0 L0,7.8 L11.7,3.9 z" class="arrow-color"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title (positioned well above content) -->
|
||||
<text x="700" y="45" text-anchor="middle" font-family="Arial, sans-serif" font-size="32" font-weight="600" class="main-text">[Title]</text>
|
||||
|
||||
<!-- MAIN FLOW DIAGRAM (Upper Section) -->
|
||||
<g id="main-flow">
|
||||
<!-- Phase labels above components -->
|
||||
<text x="[x]" y="95" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" font-weight="500" class="secondary-text">[Phase Label]</text>
|
||||
|
||||
<!-- Components with proper sizing for text -->
|
||||
<rect x="[x]" y="[y]" width="[sized-for-text]" height="70" fill="none" class="neon-[color]" rx="6.5"/>
|
||||
<text x="[center]" y="[y+45]" text-anchor="middle" font-family="Arial, sans-serif" font-size="24" font-weight="500" class="main-text">
|
||||
[Label - check width!]
|
||||
</text>
|
||||
|
||||
<!-- For long text, use tspan for wrapping -->
|
||||
<text x="[center]" y="[y+35]" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" class="main-text">
|
||||
<tspan x="[center]" dy="0">[First line]</tspan>
|
||||
<tspan x="[center]" dy="25">[Second line]</tspan>
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- PROGRESS INDICATOR / LEGEND (Lower Section) -->
|
||||
<g id="progress-legend">
|
||||
<!-- Background gradient bar (optional) -->
|
||||
<defs>
|
||||
<linearGradient id="flowGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||
<stop offset="0%" style="stop-color:#4A90E2;stop-opacity:0.3" />
|
||||
<stop offset="50%" style="stop-color:#BD10E0;stop-opacity:0.3" />
|
||||
<stop offset="100%" style="stop-color:#7ED321;stop-opacity:0.3" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<rect x="50" y="500" width="1300" height="80" fill="url(#flowGradient)" rx="10" opacity="0.2"/>
|
||||
|
||||
<!-- Stage markers -->
|
||||
<circle cx="[x1]" cy="540" r="8" class="neon-blue" fill="none"/>
|
||||
<circle cx="[x2]" cy="540" r="8" class="neon-orange" fill="none"/>
|
||||
<circle cx="[x3]" cy="540" r="8" class="neon-purple" fill="none"/>
|
||||
<circle cx="[x4]" cy="540" r="8" class="neon-green" fill="none"/>
|
||||
|
||||
<!-- Connecting lines -->
|
||||
<line x1="[x1+8]" y1="540" x2="[x2-8]" y2="540" class="arrow-color" stroke-width="2" opacity="0.4"/>
|
||||
|
||||
<!-- Stage labels (below markers) -->
|
||||
<text x="[x]" y="610" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" class="secondary-text">[Stage]</text>
|
||||
</g>
|
||||
|
||||
<!-- Description text (bottom, well-spaced) -->
|
||||
<text x="700" y="720" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" class="secondary-text">
|
||||
[Main description line]
|
||||
</text>
|
||||
<text x="700" y="755" text-anchor="middle" font-family="Arial, sans-serif" font-size="21" class="secondary-text">
|
||||
[Secondary description line]
|
||||
</text>
|
||||
</svg>
|
||||
```
|
||||
|
||||
## Updated Component Styling Rules
|
||||
|
||||
### Boxes/Rectangles (1.3x Scale)
|
||||
- **Standard Dimensions**:
|
||||
- Vertical flow: width="156-260" height="59-70"
|
||||
- Horizontal flow: width="200-300" height="60-70"
|
||||
- Compact components: width="100" height="50"
|
||||
- **IMPORTANT**: Width MUST accommodate text content
|
||||
- **Text Overflow Handling**:
|
||||
- Review all text against box width before finalizing
|
||||
- Use dynamic width sizing based on text length
|
||||
- Consider multi-line text with <tspan> elements
|
||||
- **Border**: stroke-width="2.6" (light) / "2.8" (dark), no fill, rounded corners rx="5-6.5"
|
||||
- **Colors**: Use CSS classes (neon-blue, neon-orange, etc.) for theme support
|
||||
- **Spacing**:
|
||||
- Vertical: minimum 35px spacing
|
||||
- Horizontal: minimum 70px spacing between major phases
|
||||
|
||||
### Text (1.3x Scale)
|
||||
- **Title**:
|
||||
- font-size="32", font-weight="600", class="main-text"
|
||||
- Position FAR above content (y="45" minimum)
|
||||
- **Labels**:
|
||||
- font-size="22-24", font-weight="500", class="main-text"
|
||||
- Centered in boxes (text-anchor="middle")
|
||||
- Check width constraints!
|
||||
- **Compact labels**: font-size="18", for small components in grids
|
||||
- **Section headers**: font-size="21", font-weight="500", class="secondary-text"
|
||||
- **Descriptions**: font-size="21", class="secondary-text"
|
||||
- **Font**: Always "Arial, sans-serif"
|
||||
- **Text Wrapping**: Use <tspan> for multi-line text in boxes
|
||||
|
||||
### Arrows (1.3x Scale)
|
||||
- **Main flow**: Solid lines, stroke-width="2.6", opacity="0.7"
|
||||
- **Optional/parallel**: Dashed lines, stroke-dasharray="3.9,3.9", opacity="0.5"
|
||||
- **Feedback loops**: Dashed curves, stroke-dasharray="3.9,3.9", opacity="0.5"
|
||||
- **Arrow heads**: Enlarged triangular marker (13x13), uses arrow-color class
|
||||
- **Connection lines**: stroke-width="1.5", opacity="0.5" for component merging
|
||||
- **Progress connections**: stroke-width="2", opacity="0.4"
|
||||
|
||||
### Layout (1.3x Scale)
|
||||
- **Canvas**:
|
||||
- Vertical flows: 1040px width minimum
|
||||
- Horizontal flows: 1400px width recommended
|
||||
- Aspect ratio: 16:9 for horizontal, 3:4 for vertical
|
||||
- **Content Zones**:
|
||||
- Title zone: 0-80px
|
||||
- Main diagram: 80-450px (horizontal) or 80-600px (vertical)
|
||||
- Progress/Legend: 500-650px
|
||||
- Descriptions: 700-800px
|
||||
- **Margins**: 50px from edges minimum
|
||||
- **Spacing**:
|
||||
- Title to content: 50px minimum
|
||||
- Main diagram to progress: 100px minimum
|
||||
- Vertical flows: 52-78px between components
|
||||
- Horizontal flows: 70-100px between major phases
|
||||
- **Component grid**:
|
||||
- Can use 2x2 grids for related components
|
||||
- Merge lines with opacity="0.5" for grouped items
|
||||
- **Alignment**:
|
||||
- Center-align titles at x="700" (1400px width)
|
||||
- Use consistent alignment within phases
|
||||
|
||||
## Theme-Aware Color System
|
||||
|
||||
### Light Theme (Default)
|
||||
- **Blue**: #4A90E2 (Input/User/Start elements)
|
||||
- **Orange**: #F5A623 (Processing/Scripts/Detection)
|
||||
- **Purple**: #BD10E0 (AI/ML/Decision/Configuration)
|
||||
- **Green**: #7ED321 (Execution/Action/Completion)
|
||||
- **Cyan**: #50E3C2 (Output/Response/Storage)
|
||||
- **Text**: #1a1a1a (main), #666 (secondary)
|
||||
|
||||
### Dark Theme (Neon Effects)
|
||||
- **Blue**: #00D4FF with subtle glow
|
||||
- **Orange**: #FF9500 with subtle glow
|
||||
- **Purple**: #E040FB with subtle glow
|
||||
- **Green**: #00FF88 with subtle glow
|
||||
- **Cyan**: #00E5EA with subtle glow
|
||||
- **Text**: #FFFFFF (main), #B0B0B0 (secondary)
|
||||
|
||||
## Example Usage
|
||||
|
||||
### For a beautiful dual-diagram composition:
|
||||
```
|
||||
"Create a horizontal flow SVG (1400x900) with DUAL DIAGRAM composition:
|
||||
|
||||
MAIN FLOW (top section):
|
||||
- Start: ./botserver (neon-blue)
|
||||
- OS Detection (neon-orange)
|
||||
- Component Installation (2x2 grid: PostgreSQL, Valkey, SeaweedFS, Qdrant)
|
||||
- Configuration & Setup (neon-purple)
|
||||
- Bot Deployment (vertical sub-flow with 3 steps)
|
||||
|
||||
PROGRESS INDICATOR (bottom section):
|
||||
- Gradient background bar
|
||||
- 4 stage markers: Start, Detect, Install & Configure, Deploy
|
||||
- Connected with subtle lines
|
||||
|
||||
Position title well above content.
|
||||
Check all text fits within boxes - adjust widths as needed.
|
||||
Add descriptions at bottom with proper spacing.
|
||||
Use CSS classes for theme support, subtle neon glow in dark mode."
|
||||
```
|
||||
|
||||
### For a complex system with legend:
|
||||
```
|
||||
"Create an SVG with beautiful composition (1400x900):
|
||||
|
||||
MAIN ARCHITECTURE (upper 70%):
|
||||
- Client requests flow horizontally through system
|
||||
- API Gateway distributes to microservices
|
||||
- Services connect to shared resources
|
||||
- Use appropriate box widths for service names
|
||||
|
||||
LEGEND/KEY (lower 30%):
|
||||
- Color-coded component types
|
||||
- Connection type explanations
|
||||
- Status indicators
|
||||
|
||||
Ensure title is well-separated from content.
|
||||
Review all text against box constraints.
|
||||
Include phase labels above component groups."
|
||||
```
|
||||
|
||||
## Best Practices for Beautiful Compositions
|
||||
|
||||
### Do's
|
||||
- ✅ **ALWAYS** create dual diagrams when showing processes/flows
|
||||
- ✅ Position title with generous spacing from content
|
||||
- ✅ Review every text label against its container width
|
||||
- ✅ Use progress indicators for multi-stage processes
|
||||
- ✅ Group related components with visual phases
|
||||
- ✅ Maintain consistent vertical rhythm
|
||||
- ✅ Add legend/progress bar as secondary visualization
|
||||
- ✅ Use gradient backgrounds for progress bars
|
||||
- ✅ Keep descriptions separate and well-spaced at bottom
|
||||
|
||||
### Don'ts
|
||||
- ❌ Don't let text overflow boxes - adjust widths!
|
||||
- ❌ Don't crowd title against diagram content
|
||||
- ❌ Don't skip the progress indicator for process flows
|
||||
- ❌ Don't use single diagram when dual would be clearer
|
||||
- ❌ Don't forget to test text readability at different sizes
|
||||
- ❌ Don't make boxes too small for their text content
|
||||
- ❌ Don't position legend too close to main diagram
|
||||
|
||||
## Testing Your Beautiful Composition
|
||||
|
||||
Your SVG should:
|
||||
1. Have TWO complementary visualizations (main + progress/legend)
|
||||
2. Display title with ample separation from content
|
||||
3. Fit all text comfortably within component boxes
|
||||
4. Show clear visual hierarchy with phases/groupings
|
||||
5. Include progress indicator for process flows
|
||||
6. Position legend/progress bar with proper spacing
|
||||
7. Maintain professional spacing throughout
|
||||
8. Create visual rhythm with consistent element spacing
|
||||
9. Work beautifully in both light and dark themes
|
||||
10. Feel balanced and uncluttered
|
||||
|
||||
## The Golden Rule
|
||||
|
||||
**"Beautiful composition is the standard!"** - Every diagram should tell its story twice: once in the main flow, and again in the progress indicator or legend. This dual approach creates professional, scannable, and memorable visualizations.
|
||||
335
rebuild_svgs.py
Normal file
|
|
@ -0,0 +1,335 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
SVG Rebuilder - Converts all SVG files to match the style guide standards
|
||||
Following the guidelines from botserver/prompts/dev/svg-diagram-style-guide.md
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Tuple
|
||||
|
||||
# Style guide constants
|
||||
COLORS = {
|
||||
"blue": "#4A90E2", # Input/User elements, External/API
|
||||
"orange": "#F5A623", # Processing/Scripts, Storage/Data
|
||||
"purple": "#BD10E0", # AI/ML/Decision
|
||||
"green": "#7ED321", # Execution/Action
|
||||
"cyan": "#50E3C2", # Output/Response
|
||||
"gray": "#666", # Arrows/text
|
||||
"dark": "#333", # Labels
|
||||
}
|
||||
|
||||
SVG_TEMPLATE = """<svg width="800" height="{height}" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<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="#666"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="400" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="600" fill="#333">{title}</text>
|
||||
|
||||
{content}
|
||||
|
||||
<!-- Description -->
|
||||
<text x="400" y="{desc_y}" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#666">
|
||||
{description}
|
||||
</text>
|
||||
</svg>"""
|
||||
|
||||
|
||||
def create_box(x: int, y: int, width: int, height: int, color: str, label: str) -> str:
|
||||
"""Create a standard box component"""
|
||||
center_x = x + width // 2
|
||||
center_y = y + height // 2 + 5
|
||||
return f'''<rect x="{x}" y="{y}" width="{width}" height="{height}" fill="none" stroke="{color}" stroke-width="2" rx="5"/>
|
||||
<text x="{center_x}" y="{center_y}" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">{label}</text>'''
|
||||
|
||||
|
||||
def create_arrow(
|
||||
x1: int, y1: int, x2: int, y2: int, dashed: bool = False, opacity: float = 1.0
|
||||
) -> str:
|
||||
"""Create an arrow between two points"""
|
||||
dash_attr = ' stroke-dasharray="3,3"' if dashed else ""
|
||||
opacity_attr = f' opacity="{opacity}"' if opacity < 1.0 else ""
|
||||
return f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" marker-end="url(#arrow)"{dash_attr}{opacity_attr}/>'
|
||||
|
||||
|
||||
def create_curved_arrow(
|
||||
points: List[Tuple[int, int]], dashed: bool = False, opacity: float = 1.0
|
||||
) -> str:
|
||||
"""Create a curved arrow path"""
|
||||
dash_attr = ' stroke-dasharray="3,3"' if dashed else ""
|
||||
opacity_attr = f' opacity="{opacity}"' if opacity < 1.0 else ""
|
||||
|
||||
if len(points) < 3:
|
||||
return ""
|
||||
|
||||
path = f"M{points[0][0]},{points[0][1]}"
|
||||
if len(points) == 3:
|
||||
path += f" Q{points[1][0]},{points[1][1]} {points[2][0]},{points[2][1]}"
|
||||
else:
|
||||
for i in range(1, len(points)):
|
||||
path += f" L{points[i][0]},{points[i][1]}"
|
||||
|
||||
return f'<path d="{path}" marker-end="url(#arrow)"{dash_attr}{opacity_attr}/>'
|
||||
|
||||
|
||||
def rebuild_conversation_flow() -> str:
|
||||
"""Rebuild conversation flow diagram"""
|
||||
boxes = []
|
||||
arrows = []
|
||||
|
||||
# Main flow boxes
|
||||
boxes.append(create_box(20, 60, 100, 40, COLORS["blue"], "User Input"))
|
||||
boxes.append(create_box(160, 60, 100, 40, COLORS["orange"], "ASIC Script"))
|
||||
boxes.append(create_box(300, 60, 100, 40, COLORS["purple"], "LM Decision"))
|
||||
boxes.append(create_box(440, 60, 100, 40, COLORS["green"], "Bot Executor"))
|
||||
boxes.append(create_box(580, 60, 100, 40, COLORS["cyan"], "Bot Response"))
|
||||
|
||||
# Parallel processes
|
||||
boxes.append(create_box(360, 160, 120, 40, COLORS["blue"], "Search Knowledge"))
|
||||
boxes.append(create_box(500, 160, 100, 40, COLORS["orange"], "Call API"))
|
||||
|
||||
# Main flow arrows
|
||||
arrows.append(create_arrow(120, 80, 160, 80))
|
||||
arrows.append(create_arrow(260, 80, 300, 80))
|
||||
arrows.append(create_arrow(400, 80, 440, 80))
|
||||
arrows.append(create_arrow(540, 80, 580, 80))
|
||||
|
||||
# Branch arrows
|
||||
arrows.append(create_arrow(490, 100, 420, 160, dashed=True, opacity=0.6))
|
||||
arrows.append(create_arrow(490, 100, 550, 160, dashed=True, opacity=0.6))
|
||||
|
||||
# Feedback loops
|
||||
arrows.append(
|
||||
create_curved_arrow(
|
||||
[(420, 200), (420, 240), (630, 240), (630, 100)], dashed=True, opacity=0.4
|
||||
)
|
||||
)
|
||||
arrows.append(
|
||||
create_curved_arrow(
|
||||
[(550, 200), (550, 230), (620, 230), (620, 100)], dashed=True, opacity=0.4
|
||||
)
|
||||
)
|
||||
|
||||
content = (
|
||||
"\n ".join(boxes)
|
||||
+ '\n\n <g stroke="#666" stroke-width="2" fill="none">\n '
|
||||
+ "\n ".join(arrows)
|
||||
+ "\n </g>"
|
||||
)
|
||||
|
||||
return SVG_TEMPLATE.format(
|
||||
height=320,
|
||||
title="The Flow",
|
||||
content=content,
|
||||
desc_y=300,
|
||||
description="The AI handles everything else - understanding intent, collecting information, executing tools, answering from documents. Zero configuration.",
|
||||
)
|
||||
|
||||
|
||||
def rebuild_architecture() -> str:
|
||||
"""Rebuild architecture diagram"""
|
||||
boxes = []
|
||||
arrows = []
|
||||
|
||||
# Top layer
|
||||
boxes.append(create_box(20, 60, 100, 40, COLORS["blue"], "Web Server"))
|
||||
boxes.append(create_box(160, 60, 120, 40, COLORS["orange"], "BASIC Interpreter"))
|
||||
boxes.append(create_box(320, 60, 100, 40, COLORS["purple"], "LLM Integration"))
|
||||
boxes.append(create_box(460, 60, 120, 40, COLORS["green"], "Package Manager"))
|
||||
boxes.append(create_box(620, 60, 100, 40, COLORS["cyan"], "Console UI"))
|
||||
|
||||
# Middle layer
|
||||
boxes.append(
|
||||
create_box(
|
||||
250, 160, 300, 40, COLORS["blue"], "Session Manager (Tokio Async Runtime)"
|
||||
)
|
||||
)
|
||||
|
||||
# Data layer
|
||||
boxes.append(create_box(20, 260, 100, 40, COLORS["orange"], "PostgreSQL"))
|
||||
boxes.append(create_box(160, 260, 100, 40, COLORS["purple"], "Valkey Cache"))
|
||||
boxes.append(create_box(300, 260, 100, 40, COLORS["green"], "Qdrant Vectors"))
|
||||
boxes.append(create_box(440, 260, 100, 40, COLORS["cyan"], "Object Storage"))
|
||||
boxes.append(create_box(580, 260, 100, 40, COLORS["blue"], "Channels"))
|
||||
boxes.append(create_box(700, 260, 80, 40, COLORS["orange"], "External API"))
|
||||
|
||||
# Connection arrows (simplified)
|
||||
for x in [70, 220, 370, 520, 670]:
|
||||
arrows.append(
|
||||
create_curved_arrow(
|
||||
[(x, 100), (x, 130), (400, 130), (400, 160)], opacity=0.6
|
||||
)
|
||||
)
|
||||
|
||||
for x in [70, 210, 350, 490, 630]:
|
||||
arrows.append(create_arrow(400, 200, x, 260, opacity=0.6))
|
||||
|
||||
# External API connection
|
||||
arrows.append(
|
||||
create_curved_arrow(
|
||||
[(740, 260), (740, 220), (550, 180)], dashed=True, opacity=0.4
|
||||
)
|
||||
)
|
||||
|
||||
content = (
|
||||
"\n ".join(boxes)
|
||||
+ '\n\n <g stroke="#666" stroke-width="2" fill="none">\n '
|
||||
+ "\n ".join(arrows)
|
||||
+ "\n </g>"
|
||||
)
|
||||
|
||||
# Add storage detail box
|
||||
detail_box = """
|
||||
<g transform="translate(20, 330)">
|
||||
<rect width="760" height="50" fill="none" stroke="#666" stroke-width="1" rx="5" opacity="0.3"/>
|
||||
<text x="10" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">Storage Contents:</text>
|
||||
<text x="130" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">.gbkb (Documents)</text>
|
||||
<text x="280" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">.gbdialog (Scripts)</text>
|
||||
<text x="430" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">.gbot (Configs)</text>
|
||||
<text x="560" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">Templates</text>
|
||||
<text x="660" y="25" font-family="Arial, sans-serif" font-size="12" fill="#666">User Assets</text>
|
||||
</g>"""
|
||||
|
||||
content += detail_box
|
||||
|
||||
return SVG_TEMPLATE.format(
|
||||
height=400,
|
||||
title="General Bots Architecture",
|
||||
content=content,
|
||||
desc_y=45,
|
||||
description="Single binary with everything included - no external dependencies",
|
||||
)
|
||||
|
||||
|
||||
def rebuild_package_system_flow() -> str:
|
||||
"""Rebuild package system flow diagram"""
|
||||
boxes = []
|
||||
arrows = []
|
||||
|
||||
# Main flow
|
||||
boxes.append(create_box(20, 60, 100, 40, COLORS["blue"], "User Request"))
|
||||
boxes.append(create_box(160, 60, 100, 40, COLORS["orange"], "start.bas"))
|
||||
boxes.append(create_box(300, 60, 100, 40, COLORS["purple"], "LLM Engine"))
|
||||
boxes.append(create_box(440, 60, 100, 40, COLORS["cyan"], "Bot Response"))
|
||||
|
||||
# Supporting components
|
||||
boxes.append(create_box(240, 160, 120, 40, COLORS["blue"], "Vector Search"))
|
||||
boxes.append(create_box(240, 240, 120, 40, COLORS["orange"], ".gbkb docs"))
|
||||
|
||||
# Main flow arrows
|
||||
arrows.append(create_arrow(120, 80, 160, 80))
|
||||
arrows.append(create_arrow(260, 80, 300, 80))
|
||||
arrows.append(create_arrow(400, 80, 440, 80))
|
||||
|
||||
# Bidirectional between start.bas and LLM
|
||||
arrows.append(
|
||||
create_curved_arrow(
|
||||
[(210, 100), (210, 120), (300, 120), (350, 120), (350, 100)],
|
||||
dashed=True,
|
||||
opacity=0.6,
|
||||
)
|
||||
)
|
||||
arrows.append(
|
||||
create_curved_arrow(
|
||||
[(350, 60), (350, 40), (260, 40), (210, 40), (210, 60)],
|
||||
dashed=True,
|
||||
opacity=0.6,
|
||||
)
|
||||
)
|
||||
|
||||
# LLM to Vector Search
|
||||
arrows.append(create_arrow(350, 100, 300, 160, opacity=0.6))
|
||||
|
||||
# Vector Search to .gbkb docs
|
||||
arrows.append(create_arrow(300, 200, 300, 240, opacity=0.6))
|
||||
|
||||
# Feedback from Vector Search to LLM
|
||||
arrows.append(
|
||||
create_curved_arrow(
|
||||
[(240, 180), (200, 140), (300, 100)], dashed=True, opacity=0.4
|
||||
)
|
||||
)
|
||||
|
||||
content = (
|
||||
"\n ".join(boxes)
|
||||
+ '\n\n <g stroke="#666" stroke-width="2" fill="none">\n '
|
||||
+ "\n ".join(arrows)
|
||||
+ "\n </g>"
|
||||
)
|
||||
|
||||
# Add BASIC commands and package structure boxes
|
||||
detail_boxes = """
|
||||
<g transform="translate(580, 60)">
|
||||
<rect width="200" height="120" fill="none" stroke="#7ED321" stroke-width="2" rx="5"/>
|
||||
<text x="100" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">BASIC Commands</text>
|
||||
<text x="10" y="50" font-family="monospace" font-size="12" fill="#666">USE KB "docs"</text>
|
||||
<text x="10" y="70" font-family="monospace" font-size="12" fill="#666">answer = HEAR</text>
|
||||
<text x="10" y="90" font-family="monospace" font-size="12" fill="#666">result = LLM()</text>
|
||||
<text x="10" y="110" font-family="monospace" font-size="12" fill="#666">TALK result</text>
|
||||
</g>
|
||||
|
||||
<g transform="translate(580, 210)">
|
||||
<rect width="200" height="140" fill="none" stroke="#4A90E2" stroke-width="2" rx="5"/>
|
||||
<text x="100" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#333">Package Structure</text>
|
||||
<text x="10" y="50" font-family="monospace" font-size="12" fill="#666">my-bot.gbai/</text>
|
||||
<text x="20" y="70" font-family="monospace" font-size="12" fill="#666">├─ .gbdialog/</text>
|
||||
<text x="20" y="90" font-family="monospace" font-size="12" fill="#666">├─ .gbkb/</text>
|
||||
<text x="20" y="110" font-family="monospace" font-size="12" fill="#666">└─ .gbot/</text>
|
||||
</g>"""
|
||||
|
||||
content += detail_boxes
|
||||
|
||||
# Add connection lines to detail boxes
|
||||
content += """
|
||||
<g stroke="#666" stroke-width="2" fill="none">
|
||||
<path d="M210,60 Q395,20 580,80" stroke-dasharray="2,2" opacity="0.3"/>
|
||||
<path d="M300,280 Q440,330 580,310" stroke-dasharray="2,2" opacity="0.3"/>
|
||||
</g>"""
|
||||
|
||||
# Add labels
|
||||
labels = """
|
||||
<text x="180" y="35" font-family="Arial, sans-serif" font-size="11" fill="#666">Commands</text>
|
||||
<text x="180" y="125" font-family="Arial, sans-serif" font-size="11" fill="#666">Results</text>
|
||||
<text x="325" y="135" font-family="Arial, sans-serif" font-size="11" fill="#666">Query</text>
|
||||
<text x="250" y="135" font-family="Arial, sans-serif" font-size="11" fill="#666">Context</text>"""
|
||||
|
||||
content += labels
|
||||
|
||||
return SVG_TEMPLATE.format(
|
||||
height=400,
|
||||
title="Package System Flow",
|
||||
content=content,
|
||||
desc_y=380,
|
||||
description="BASIC scripts orchestrate LLM decisions, vector search, and responses with zero configuration",
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
"""Main function to rebuild all SVGs"""
|
||||
svgs_to_rebuild = {
|
||||
"docs/src/assets/conversation-flow.svg": rebuild_conversation_flow(),
|
||||
"docs/src/assets/architecture.svg": rebuild_architecture(),
|
||||
"docs/src/assets/package-system-flow.svg": rebuild_package_system_flow(),
|
||||
}
|
||||
|
||||
for filepath, content in svgs_to_rebuild.items():
|
||||
full_path = Path(filepath)
|
||||
if full_path.parent.exists():
|
||||
with open(full_path, "w") as f:
|
||||
f.write(content)
|
||||
print(f"Rebuilt: {filepath}")
|
||||
else:
|
||||
print(f"Skipping (directory not found): {filepath}")
|
||||
|
||||
print(f"\nRebuilt {len(svgs_to_rebuild)} SVG files according to style guide")
|
||||
print(
|
||||
"Note: This is a demonstration script. Extend it to rebuild all 28 SVG files."
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
181
safe_svg_improve.py
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Safe SVG Improvement Script
|
||||
Enhances SVG readability for mobile devices without breaking structure
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def safe_improve_svg(filepath):
|
||||
"""
|
||||
Safely improve SVG file for better mobile readability
|
||||
Only makes minimal, safe changes to preserve structure
|
||||
"""
|
||||
|
||||
try:
|
||||
# Read the original file
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Skip font files and favicons
|
||||
if "fontawesome" in str(filepath).lower() or "favicon" in str(filepath).lower():
|
||||
return False, "Skipped (font/favicon)"
|
||||
|
||||
original_content = content
|
||||
|
||||
# 1. Make SVG responsive by adding style attribute to svg tag if not present
|
||||
if "style=" not in content.split(">")[0]: # Check only in the opening SVG tag
|
||||
content = re.sub(
|
||||
r"(<svg[^>]*)(>)",
|
||||
r'\1 style="max-width: 100%; height: auto;"\2',
|
||||
content,
|
||||
count=1,
|
||||
)
|
||||
|
||||
# 2. Increase small font sizes for mobile readability (minimum 14px)
|
||||
def increase_font_size(match):
|
||||
size = int(match.group(1))
|
||||
if size < 12:
|
||||
return f'font-size="{14}"'
|
||||
elif size == 12 or size == 13:
|
||||
return f'font-size="{14}"'
|
||||
else:
|
||||
return match.group(0)
|
||||
|
||||
content = re.sub(r'font-size="(\d+)"', increase_font_size, content)
|
||||
|
||||
# 3. Improve text color contrast for better readability
|
||||
# Only change very light grays to darker ones for text
|
||||
text_color_improvements = {
|
||||
"#CBD5E0": "#374151", # Light gray to dark gray
|
||||
"#A0AEC0": "#4B5563", # Medium light gray to medium dark
|
||||
"#718096": "#374151", # Another light gray to dark
|
||||
"#E9D8FD": "#6B21A8", # Very light purple to dark purple
|
||||
"#FBD38D": "#92400E", # Light orange to dark orange
|
||||
"#90CDF4": "#1E40AF", # Light blue to dark blue
|
||||
"#B2F5EA": "#047857", # Light teal to dark teal
|
||||
"#9AE6B4": "#047857", # Light green to dark green
|
||||
}
|
||||
|
||||
for old_color, new_color in text_color_improvements.items():
|
||||
# Only replace in text elements
|
||||
content = re.sub(
|
||||
f'(<text[^>]*fill="){old_color}(")',
|
||||
f"\\1{new_color}\\2",
|
||||
content,
|
||||
flags=re.IGNORECASE,
|
||||
)
|
||||
|
||||
# 4. Ensure stroke widths are visible (minimum 2)
|
||||
content = re.sub(r'stroke-width="1"', 'stroke-width="2"', content)
|
||||
content = re.sub(r'stroke-width="0\.5"', 'stroke-width="2"', content)
|
||||
|
||||
# 5. Add rounded corners to rectangles if missing (but small radius)
|
||||
def add_rounded_corners(match):
|
||||
rect = match.group(0)
|
||||
if "rx=" not in rect and 'fill="none"' in rect:
|
||||
# Add small rounded corners for better aesthetics
|
||||
rect = rect[:-2] + ' rx="4"/>'
|
||||
return rect
|
||||
|
||||
content = re.sub(r"<rect[^>]*/>", add_rounded_corners, content)
|
||||
|
||||
# 6. Make arrow markers more visible
|
||||
content = re.sub(r'fill="#888"', 'fill="#374151"', content)
|
||||
|
||||
# 7. Improve font families for better cross-platform rendering
|
||||
content = re.sub(
|
||||
r'font-family="Arial, sans-serif"',
|
||||
"font-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif\"",
|
||||
content,
|
||||
)
|
||||
|
||||
# 8. Fix font weight declarations
|
||||
content = re.sub(r'font-weight="bold"', 'font-weight="600"', content)
|
||||
|
||||
# Only write if changes were made
|
||||
if content != original_content:
|
||||
# Backup original
|
||||
backup_path = str(filepath) + ".backup"
|
||||
if not os.path.exists(backup_path):
|
||||
with open(backup_path, "w", encoding="utf-8") as f:
|
||||
f.write(original_content)
|
||||
|
||||
# Write improved version
|
||||
with open(filepath, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
return True, "Improved successfully"
|
||||
else:
|
||||
return False, "No changes needed"
|
||||
|
||||
except Exception as e:
|
||||
return False, f"Error: {str(e)}"
|
||||
|
||||
|
||||
def main():
|
||||
"""Process all SVG files in docs directory"""
|
||||
|
||||
print("=" * 60)
|
||||
print("SAFE SVG IMPROVEMENT SCRIPT")
|
||||
print("Enhancing readability without breaking structure")
|
||||
print("=" * 60)
|
||||
print()
|
||||
|
||||
docs_dir = Path("docs")
|
||||
svg_files = list(docs_dir.glob("**/*.svg"))
|
||||
|
||||
print(f"Found {len(svg_files)} SVG files")
|
||||
print()
|
||||
|
||||
improved = 0
|
||||
skipped = 0
|
||||
unchanged = 0
|
||||
errors = 0
|
||||
|
||||
for svg_file in svg_files:
|
||||
print(f"Processing: {svg_file}")
|
||||
|
||||
success, message = safe_improve_svg(svg_file)
|
||||
|
||||
if success:
|
||||
print(f" ✓ {message}")
|
||||
improved += 1
|
||||
elif "Skipped" in message:
|
||||
print(f" ⊘ {message}")
|
||||
skipped += 1
|
||||
elif "No changes" in message:
|
||||
print(f" - {message}")
|
||||
unchanged += 1
|
||||
else:
|
||||
print(f" ✗ {message}")
|
||||
errors += 1
|
||||
|
||||
print()
|
||||
print("=" * 60)
|
||||
print("SUMMARY")
|
||||
print("=" * 60)
|
||||
print(f"✓ Improved: {improved} files")
|
||||
print(f"- Unchanged: {unchanged} files")
|
||||
print(f"⊘ Skipped: {skipped} files")
|
||||
if errors > 0:
|
||||
print(f"✗ Errors: {errors} files")
|
||||
|
||||
print()
|
||||
print("Safe improvements applied:")
|
||||
print("• Increased minimum font size to 14px")
|
||||
print("• Improved text color contrast")
|
||||
print("• Made SVGs responsive (100% width)")
|
||||
print("• Enhanced stroke visibility")
|
||||
print("• Added subtle rounded corners")
|
||||
print("• Improved font families for all devices")
|
||||
print()
|
||||
print("Original files backed up with .backup extension")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
227
validate_svgs.py
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
SVG Validation and Documentation Mapping Script
|
||||
Checks all SVG files for readability issues and shows where they're used in the documentation
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def analyze_svg(filepath):
|
||||
"""Analyze an SVG file for potential readability issues"""
|
||||
issues = []
|
||||
info = {}
|
||||
|
||||
try:
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Check file size
|
||||
file_size = os.path.getsize(filepath)
|
||||
info["size"] = f"{file_size:,} bytes"
|
||||
|
||||
# Extract viewBox/dimensions
|
||||
viewbox_match = re.search(r'viewBox="([^"]+)"', content)
|
||||
width_match = re.search(r'width="(\d+)"', content)
|
||||
height_match = re.search(r'height="(\d+)"', content)
|
||||
|
||||
if viewbox_match:
|
||||
info["viewBox"] = viewbox_match.group(1)
|
||||
elif width_match and height_match:
|
||||
info["dimensions"] = f"{width_match.group(1)}x{height_match.group(1)}"
|
||||
|
||||
# Check if responsive
|
||||
if 'style="max-width: 100%' in content:
|
||||
info["responsive"] = "✓"
|
||||
else:
|
||||
info["responsive"] = "✗"
|
||||
issues.append("Not responsive (missing max-width: 100%)")
|
||||
|
||||
# Find all font sizes
|
||||
font_sizes = re.findall(r'font-size="(\d+)"', content)
|
||||
if font_sizes:
|
||||
sizes = [int(s) for s in font_sizes]
|
||||
info["font_sizes"] = f"min:{min(sizes)}px, max:{max(sizes)}px"
|
||||
|
||||
# Check for too small fonts
|
||||
small_fonts = [s for s in sizes if s < 12]
|
||||
if small_fonts:
|
||||
issues.append(
|
||||
f"Small fonts found: {small_fonts}px (mobile needs ≥14px)"
|
||||
)
|
||||
|
||||
# Check text colors for contrast
|
||||
text_colors = re.findall(r'<text[^>]*fill="([^"]+)"', content)
|
||||
light_colors = []
|
||||
for color in text_colors:
|
||||
if any(
|
||||
light in color.upper()
|
||||
for light in [
|
||||
"#CBD5E0",
|
||||
"#A0AEC0",
|
||||
"#E2E8F0",
|
||||
"#EDF2F7",
|
||||
"#F7FAFC",
|
||||
"#9CA3AF",
|
||||
"#D1D5DB",
|
||||
]
|
||||
):
|
||||
light_colors.append(color)
|
||||
|
||||
if light_colors:
|
||||
unique_colors = list(set(light_colors))
|
||||
issues.append(f"Low contrast text colors: {', '.join(unique_colors[:3])}")
|
||||
|
||||
# Check for background
|
||||
if (
|
||||
'fill="#FAFAFA"' in content
|
||||
or 'fill="white"' in content
|
||||
or 'fill="#FFFFFF"' in content
|
||||
):
|
||||
if re.search(
|
||||
r'<rect[^>]*width="[^"]*"[^>]*height="[^"]*"[^>]*fill="(white|#FAFAFA|#FFFFFF)"',
|
||||
content,
|
||||
):
|
||||
issues.append("Has white/light background")
|
||||
|
||||
# Count elements
|
||||
info["texts"] = content.count("<text")
|
||||
info["rects"] = content.count("<rect")
|
||||
info["paths"] = content.count("<path")
|
||||
|
||||
return info, issues
|
||||
|
||||
except Exception as e:
|
||||
return {"error": str(e)}, [f"Error reading file: {e}"]
|
||||
|
||||
|
||||
def find_svg_references(docs_dir):
|
||||
"""Find where SVG files are referenced in documentation"""
|
||||
references = defaultdict(list)
|
||||
|
||||
# Search in markdown and HTML files
|
||||
for ext in ["*.md", "*.html"]:
|
||||
for filepath in Path(docs_dir).rglob(ext):
|
||||
if "book" in str(filepath):
|
||||
continue # Skip generated book files
|
||||
|
||||
try:
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Find SVG references
|
||||
svg_refs = re.findall(
|
||||
r'(?:src="|href="|!\[.*?\]\(|url\()([^")\s]+\.svg)', content
|
||||
)
|
||||
for svg_ref in svg_refs:
|
||||
svg_name = os.path.basename(svg_ref)
|
||||
references[svg_name].append(str(filepath.relative_to(docs_dir)))
|
||||
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return references
|
||||
|
||||
|
||||
def main():
|
||||
print("=" * 80)
|
||||
print("SVG VALIDATION AND DOCUMENTATION MAPPING")
|
||||
print("=" * 80)
|
||||
print()
|
||||
|
||||
docs_dir = Path("docs")
|
||||
src_dir = docs_dir / "src"
|
||||
|
||||
# Find all SVG files
|
||||
svg_files = list(src_dir.rglob("*.svg"))
|
||||
|
||||
# Find references
|
||||
print("Scanning documentation for SVG references...")
|
||||
references = find_svg_references(docs_dir)
|
||||
print()
|
||||
|
||||
# Group SVGs by chapter
|
||||
chapters = defaultdict(list)
|
||||
for svg_file in svg_files:
|
||||
parts = svg_file.parts
|
||||
if "chapter-" in str(svg_file):
|
||||
chapter = next((p for p in parts if "chapter-" in p), "other")
|
||||
elif "appendix" in str(svg_file):
|
||||
chapter = "appendix-i"
|
||||
else:
|
||||
chapter = "root-assets"
|
||||
chapters[chapter].append(svg_file)
|
||||
|
||||
# Process each chapter
|
||||
total_issues = 0
|
||||
for chapter in sorted(chapters.keys()):
|
||||
print(f"\n{'=' * 60}")
|
||||
print(f"CHAPTER: {chapter.upper()}")
|
||||
print(f"{'=' * 60}")
|
||||
|
||||
for svg_file in sorted(chapters[chapter]):
|
||||
relative_path = svg_file.relative_to(docs_dir)
|
||||
svg_name = svg_file.name
|
||||
|
||||
print(f"\n📊 {relative_path}")
|
||||
print("-" * 40)
|
||||
|
||||
info, issues = analyze_svg(svg_file)
|
||||
|
||||
# Display info
|
||||
if "error" not in info:
|
||||
print(f" Size: {info.get('size', 'Unknown')}")
|
||||
if "viewBox" in info:
|
||||
print(f" ViewBox: {info['viewBox']}")
|
||||
elif "dimensions" in info:
|
||||
print(f" Dimensions: {info['dimensions']}")
|
||||
|
||||
print(f" Responsive: {info.get('responsive', '?')}")
|
||||
|
||||
if "font_sizes" in info:
|
||||
print(f" Font sizes: {info['font_sizes']}")
|
||||
|
||||
print(
|
||||
f" Elements: {info.get('texts', 0)} texts, {info.get('rects', 0)} rects, {info.get('paths', 0)} paths"
|
||||
)
|
||||
|
||||
# Display issues
|
||||
if issues:
|
||||
total_issues += len(issues)
|
||||
print(f"\n ⚠️ ISSUES ({len(issues)}):")
|
||||
for issue in issues:
|
||||
print(f" • {issue}")
|
||||
else:
|
||||
print("\n ✅ No issues found")
|
||||
|
||||
# Display references
|
||||
if svg_name in references:
|
||||
print(f"\n 📄 Used in:")
|
||||
for ref in references[svg_name][:5]: # Show first 5 references
|
||||
print(f" • {ref}")
|
||||
if len(references[svg_name]) > 5:
|
||||
print(f" ... and {len(references[svg_name]) - 5} more")
|
||||
else:
|
||||
print(f"\n ❓ No references found in documentation")
|
||||
|
||||
# Summary
|
||||
print("\n" + "=" * 80)
|
||||
print("SUMMARY")
|
||||
print("=" * 80)
|
||||
print(f"Total SVG files analyzed: {len(svg_files)}")
|
||||
print(f"Total issues found: {total_issues}")
|
||||
|
||||
if total_issues > 0:
|
||||
print("\n🔧 RECOMMENDED FIXES:")
|
||||
print("1. Increase all font sizes to minimum 14px for mobile readability")
|
||||
print("2. Replace light gray text colors with darker ones for better contrast")
|
||||
print("3. Remove white backgrounds or make them transparent")
|
||||
print("4. Add responsive styling (max-width: 100%; height: auto)")
|
||||
print("5. Consider using system fonts for better cross-platform support")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||