File size: 2,669 Bytes
8a2dcce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
"""
Gradio theme + a few shared CSS tweaks.

Blue / light-blue palette per spec. Kept intentionally simple/functional
rather than visually elaborate.
"""

import gradio as gr

dsa_theme = gr.themes.Soft(
    primary_hue=gr.themes.colors.blue,
    secondary_hue=gr.themes.colors.sky,
    neutral_hue=gr.themes.colors.slate,
).set(
    body_background_fill="*neutral_50",
    body_background_fill_dark="*neutral_950",
    block_background_fill="white",
    block_border_width="1px",
    block_shadow="*shadow_drop",
    button_primary_background_fill="*primary_500",
    button_primary_background_fill_hover="*primary_600",
    button_primary_text_color="white",
)

CUSTOM_CSS = """
.gradio-container {
    max-width: 90% !important;
    margin: 0 auto !important;
}
#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border-color-primary);
    margin-bottom: 6px;
}
#topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-500);
}
#topbar-actions {
    gap: 4px !important;
}
#auth-status {
    font-size: 0.8rem;
    color: var(--body-text-color-subdued);
}

/* Shrink ONLY the buttons we explicitly tag - do not touch Gradio's
   internal chatbot buttons (copy/like/dislike icons etc.), otherwise
   their forced height squashes the surrounding message bubble and text
   spills outside it. */
.small-btn {
    font-size: 0.78rem !important;
    padding: 4px 10px !important;
    min-height: unset !important;
    height: 30px !important;
    line-height: 1 !important;
}

#history-panel {
    border-right: 1px solid var(--border-color-primary);
    padding-right: 8px;
}
.session-item {
    cursor: pointer;
}

/* Keep chat + input compact and always reachable without page scroll */
#main-row {
    max-height: 78vh;
}
#chat-column {
    display: flex;
    flex-direction: column;
}
#chat-window {
    height: 360px !important;
    min-height: 260px !important;
    max-height: 55vh !important;
    overflow-y: auto !important;
}

/* Make sure message bubbles wrap and stay inside the chat window instead
   of overflowing horizontally/vertically. */
#chat-window .message,
#chat-window .message-wrap,
#chat-window .bot,
#chat-window .user {
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: pre-wrap !important;
    box-sizing: border-box !important;
}
#chat-window .message pre,
#chat-window .message code {
    white-space: pre-wrap !important;
    overflow-x: auto !important;
}

#input-row {
    margin-top: 4px;
}

footer {display: none !important;}
"""