File size: 2,482 Bytes
3aba7d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Updated CSS
# CSS Styles
css = '''
<style>
    /* Styling for the body of the Streamlit app */
    body {
        background-color: #f2f7ff; /* Soft blue background */
        margin: 0; /* Remove default margin */
        padding: 0; /* Remove default padding */
    }

    /* Styling for the chat container */
    .chat-container {
        max-width: 600px; /* Adjust the maximum width as needed */
        margin: 0 auto; /* Center the chat container */
        background-color: #ffffff; /* White background */
        padding: 1rem; /* Add padding to the chat container */
        border-radius: 1rem; /* Rounded corners for the chat container */
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Add a subtle box shadow */
    }

    /* Styling for the chat messages */
    .chat-message {
        padding: 1rem;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        display: flex;
        border: 1px solid #d3d3d3; /* Add a subtle border */
    }

    /* Styling for user messages */
    .chat-message.user {
        background-color: #ffffff; /* White background for user messages */
    }

    /* Styling for bot messages */
    .chat-message.bot {
        background-color: #9dc8e5; /* Soft blue background for bot messages */
    }

    /* Styling for the avatar */
    .chat-message .avatar {
        width: 15%; /* Adjust avatar size */
    }

    /* Styling for the avatar image */
    .chat-message .avatar img {
        max-width: 60px;
        max-height: 60px;
        border-radius: 50%;
        object-fit: cover;
    }

    /* Styling for the message content */
    .chat-message .message {
        flex: 1; /* Allow the message to take up remaining space */
        padding: 0.75rem;
        color: #495057; /* Dark text color for better readability */
    }

    /* Styling for strong (name) in the message */
    .chat-message .message strong {
        margin-right: 0.25rem; /* Adjust the margin as needed */
    }
</style>
'''

# HTML Templates for Bot and User Messages
bot_template = '''
<div class="chat-message bot">
    <div class="avatar">
        <img src="https://i.ibb.co/dp2yyWP/bot.jpg">
    </div>
    <div class="message">
        <strong>Doraemon:</strong> {{MSG}}
    </div>
</div>
'''

user_template = '''
<div class="chat-message user">
    <div class="avatar">
        <img src="https://i.ibb.co/JB2sps1/human.jpg">
    </div>    
    <div class="message">
        <strong>Nobita:</strong> {{MSG}}
    </div>
</div>
'''