File size: 1,396 Bytes
6f1c0b9
 
7c57c75
6f1c0b9
 
7c57c75
6f1c0b9
7c57c75
6f1c0b9
 
7c57c75
6f1c0b9
7c57c75
 
6f1c0b9
 
 
 
 
 
7c57c75
6f1c0b9
7c57c75
6f1c0b9
 
 
 
 
7c57c75
6f1c0b9
 
 
 
7c57c75
6f1c0b9
 
 
 
7c57c75
 
6f1c0b9
7c57c75
6f1c0b9
 
7c57c75
6f1c0b9
7c57c75
6f1c0b9
7c57c75
6f1c0b9
7c57c75
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Loading animations for Gradio chatbot interface.
Contains functions to generate animated thinking indicators with just pulsing dots.
"""

def create_thinking_indicator():
    """
    Creates an HTML thinking indicator with just animated dots.
    
    Returns:
        str: HTML string with animated dots only
    """
    return '''<div class="thinking-indicator">
        <div class="dots-container">
            <span class="dot"></span>
            <span class="dot"></span>
            <span class="dot"></span>
        </div>
    </div>'''

def create_custom_dot_indicator(dot_count=3):
    """
    Creates a thinking indicator with specified number of dots.
    
    Args:
        dot_count (int): Number of animated dots (default: 3)
    
    Returns:
        str: HTML string with custom number of dots
    """
    dots = ''.join(['<span class="dot"></span>' for _ in range(dot_count)])
    
    return f'''<div class="thinking-indicator">
        <div class="dots-container">
            {dots}
        </div>
    </div>'''

# Main function to use in the chatbot
def get_thinking_dots():
    """
    Returns the standard thinking dots indicator.
    
    Returns:
        str: HTML string with animated thinking dots
    """
    return create_thinking_indicator()

# Quick usage example:
if __name__ == "__main__":
    print("Thinking dots indicator:")
    print(get_thinking_dots())