AnatoliiG commited on
Commit
5a5a38b
·
1 Parent(s): d411c57

Update styles.py

Browse files
Files changed (1) hide show
  1. src/ui/styles.py +27 -70
src/ui/styles.py CHANGED
@@ -1,52 +1,26 @@
1
  CSS = """
2
- /* 1. Глобальные правила растягивания на весь экран */
3
  html, body, .gradio-container {
4
- height: 100vh !important;
5
- min-height: 100vh !important;
6
  margin: 0 !important;
7
  padding: 0 !important;
8
- overflow: hidden !important;
9
- background-color: #212121 !important; /* Общий темный фон */
10
- }
11
-
12
- /* Растягиваем все внутренние обертки Gradio, чтобы чат занимал всю высоту */
13
- .gradio-container .main,
14
- .gradio-container .wrap,
15
- .gradio-container .contain,
16
- .gradio-container .sidebar-parent {
17
- height: 100% !important;
18
- min-height: 100% !important;
19
- display: flex !important;
20
- flex-direction: row !important;
21
- flex: 1 1 auto !important;
22
- background-color: #212121 !important;
23
  }
24
 
25
  /* 2. Главный ряд (сайдбар + чат) */
26
  #main-row {
27
- display: flex !important;
28
- flex-direction: row !important;
29
- width: 100% !important;
30
- height: 100% !important;
31
  margin: 0 !important;
32
  gap: 0 !important;
33
- overflow: hidden !important;
34
- flex: 1 1 auto !important;
35
  background-color: #212121 !important;
36
  }
37
 
38
- /* 3. Стилизация сайдбара */
39
  #sidebar-container {
40
- background-color: #171717 !important; /* Контрастный темный фон */
41
  border-right: 1px solid #2f2f2f !important;
42
  padding: 1.5rem 1.25rem !important;
43
- height: 100% !important;
44
- display: flex !important;
45
- flex-direction: column !important;
46
- overflow-y: auto !important;
47
  }
48
 
49
- /* Кнопка сворачивания/разворачивания сайдбара (круглая, темная, всегда поверх) */
50
  .sidebar-parent button.toggle-button,
51
  .sidebar-parent > button {
52
  background-color: #171717 !important;
@@ -59,9 +33,8 @@ html, body, .gradio-container {
59
  align-items: center !important;
60
  justify-content: center !important;
61
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
62
- z-index: 999 !important; /* Кнопка всегда видна на переднем плане */
63
  cursor: pointer !important;
64
- transition: background-color 0.2s !important;
65
  }
66
 
67
  .sidebar-parent button.toggle-button:hover,
@@ -69,31 +42,21 @@ html, body, .gradio-container {
69
  background-color: #2f2f2f !important;
70
  }
71
 
72
- /* 4. Стилизация чат-зоны */
73
  #col-chat-main {
74
- display: flex !important;
75
- flex-direction: column !important;
76
- flex: 1 1 auto !important;
77
- height: 100% !important;
78
- min-height: 0 !important;
79
  background-color: #212121 !important;
80
- overflow: hidden !important;
81
- position: relative !important;
82
  }
83
 
84
- /* Окно чата занимает все доступное место */
85
  #chatbot {
86
- flex: 1 1 auto !important;
87
- height: calc(100vh - 140px) !important;
88
- max-height: calc(100vh - 140px) !important;
89
- width: 100% !important;
90
- max-width: 800px !important;
91
- margin: 0 auto !important;
92
- background: transparent !important;
93
  border: none !important;
94
  box-shadow: none !important;
95
- overflow-y: auto !important;
96
- padding: 20px 10px !important;
 
97
  }
98
 
99
  #chatbot > .wrapper {
@@ -101,57 +64,55 @@ html, body, .gradio-container {
101
  border: none !important;
102
  }
103
 
104
- /* 5. Четкие контрастные цвета для текста сообщений */
105
  #chatbot .message,
106
  #chatbot [data-testid="user"],
107
  #chatbot [data-testid="bot"],
108
  #chatbot .message p,
109
  #chatbot .message span,
110
- #chatbot .message li {
 
 
111
  font-size: 0.98rem !important;
112
  line-height: 1.6 !important;
113
  }
114
 
115
- /* Сообщения пользователя: темно-серый пузырь справа, белый текст */
116
  #chatbot .user, #chatbot [data-testid="user"] {
117
  background-color: #2f2f2f !important;
118
  color: #ffffff !important;
119
  border: 1px solid #3c3c3c !important;
120
  border-radius: 20px !important;
121
  border-bottom-right-radius: 4px !important;
122
- align-self: flex-end !important;
123
  margin-left: auto !important;
124
- box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
125
  }
126
 
127
  #chatbot .user *, #chatbot [data-testid="user"] * {
128
- color: #ffffff !important; /* Гарантирует белый текст для внутренних тегов */
129
  }
130
 
131
- /* Сообщения Агента: прозрачный фон, светло-серый контрастный текст */
132
  #chatbot .bot, #chatbot [data-testid="bot"] {
133
  background-color: transparent !important;
134
  color: #ececec !important;
135
- align-self: flex-start !important;
136
  margin-right: auto !important;
137
  max-width: 100% !important;
138
  padding-left: 0 !important;
139
  }
140
 
141
  #chatbot .bot *, #chatbot [data-testid="bot"] * {
142
- color: #ececec !important; /* Гарантирует светло-серый текст для внутренних тегов */
143
  }
144
 
145
- /* 6. Очистка области ввода от белых углов */
146
  #input-area {
147
- width: 100% !important;
148
  max-width: 800px !important;
149
  margin: 0 auto 1.5rem auto !important;
150
  padding: 0 1rem !important;
151
  background: transparent !important;
152
  border: none !important;
153
- box-shadow: none !important;
154
- flex-shrink: 0 !important;
155
  }
156
 
157
  #input-area > div,
@@ -162,7 +123,6 @@ html, body, .gradio-container {
162
  box-shadow: none !important;
163
  }
164
 
165
- /* Само текстовое поле в стиле ChatGPT */
166
  #input-area textarea {
167
  border-radius: 26px !important;
168
  border: 1px solid #424242 !important;
@@ -171,7 +131,6 @@ html, body, .gradio-container {
171
  padding: 14px 20px !important;
172
  font-size: 1rem !important;
173
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
174
- transition: border-color 0.2s, box-shadow 0.2s !important;
175
  }
176
 
177
  #input-area textarea:focus {
@@ -179,7 +138,7 @@ html, body, .gradio-container {
179
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
180
  }
181
 
182
- /* Минималистичная кнопка Run (светло-серая, с темным текстом) */
183
  #input-area button,
184
  #input-area .gr-button-primary {
185
  border-radius: 22px !important;
@@ -190,16 +149,14 @@ html, body, .gradio-container {
190
  padding: 0 20px !important;
191
  height: 44px !important;
192
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
193
- transition: all 0.2s ease !important;
194
  }
195
 
196
  #input-area button:hover,
197
  #input-area .gr-button-primary:hover {
198
  background-color: #ffffff !important;
199
- transform: translateY(-1px) !important;
200
  }
201
 
202
- /* Настройки скроллбара */
203
  ::-webkit-scrollbar {
204
  width: 6px;
205
  height: 6px;
 
1
  CSS = """
2
+ /* 1. Глобальный фон страницы */
3
  html, body, .gradio-container {
4
+ background-color: #212121 !important;
 
5
  margin: 0 !important;
6
  padding: 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  }
8
 
9
  /* 2. Главный ряд (сайдбар + чат) */
10
  #main-row {
 
 
 
 
11
  margin: 0 !important;
12
  gap: 0 !important;
 
 
13
  background-color: #212121 !important;
14
  }
15
 
16
+ /* 3. Боковая панель */
17
  #sidebar-container {
18
+ background-color: #171717 !important;
19
  border-right: 1px solid #2f2f2f !important;
20
  padding: 1.5rem 1.25rem !important;
 
 
 
 
21
  }
22
 
23
+ /* Кнопка сворачивания/разворачивания сайдбара */
24
  .sidebar-parent button.toggle-button,
25
  .sidebar-parent > button {
26
  background-color: #171717 !important;
 
33
  align-items: center !important;
34
  justify-content: center !important;
35
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
36
+ z-index: 999 !important;
37
  cursor: pointer !important;
 
38
  }
39
 
40
  .sidebar-parent button.toggle-button:hover,
 
42
  background-color: #2f2f2f !important;
43
  }
44
 
45
+ /* 4. Колонка чата */
46
  #col-chat-main {
 
 
 
 
 
47
  background-color: #212121 !important;
48
+ padding: 0 !important;
49
+ margin: 0 !important;
50
  }
51
 
52
+ /* Стилизация компонента Chatbot */
53
  #chatbot {
54
+ background-color: transparent !important;
 
 
 
 
 
 
55
  border: none !important;
56
  box-shadow: none !important;
57
+ max-width: 800px !important;
58
+ margin: 0 auto !important;
59
+ width: 100% !important;
60
  }
61
 
62
  #chatbot > .wrapper {
 
64
  border: none !important;
65
  }
66
 
67
+ /* 5. Настройки пузырей сообщений и текста */
68
  #chatbot .message,
69
  #chatbot [data-testid="user"],
70
  #chatbot [data-testid="bot"],
71
  #chatbot .message p,
72
  #chatbot .message span,
73
+ #chatbot .message li,
74
+ #chatbot .message ul,
75
+ #chatbot .message ol {
76
  font-size: 0.98rem !important;
77
  line-height: 1.6 !important;
78
  }
79
 
80
+ /* Сообщения пользователя */
81
  #chatbot .user, #chatbot [data-testid="user"] {
82
  background-color: #2f2f2f !important;
83
  color: #ffffff !important;
84
  border: 1px solid #3c3c3c !important;
85
  border-radius: 20px !important;
86
  border-bottom-right-radius: 4px !important;
87
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
88
  margin-left: auto !important;
89
+ max-width: 80% !important;
90
  }
91
 
92
  #chatbot .user *, #chatbot [data-testid="user"] * {
93
+ color: #ffffff !important;
94
  }
95
 
96
+ /* Сообщения бота */
97
  #chatbot .bot, #chatbot [data-testid="bot"] {
98
  background-color: transparent !important;
99
  color: #ececec !important;
 
100
  margin-right: auto !important;
101
  max-width: 100% !important;
102
  padding-left: 0 !important;
103
  }
104
 
105
  #chatbot .bot *, #chatbot [data-testid="bot"] * {
106
+ color: #ececec !important;
107
  }
108
 
109
+ /* 6. Поле ввода (ChatGPT стиль) */
110
  #input-area {
 
111
  max-width: 800px !important;
112
  margin: 0 auto 1.5rem auto !important;
113
  padding: 0 1rem !important;
114
  background: transparent !important;
115
  border: none !important;
 
 
116
  }
117
 
118
  #input-area > div,
 
123
  box-shadow: none !important;
124
  }
125
 
 
126
  #input-area textarea {
127
  border-radius: 26px !important;
128
  border: 1px solid #424242 !important;
 
131
  padding: 14px 20px !important;
132
  font-size: 1rem !important;
133
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
 
134
  }
135
 
136
  #input-area textarea:focus {
 
138
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
139
  }
140
 
141
+ /* Кнопка отправки */
142
  #input-area button,
143
  #input-area .gr-button-primary {
144
  border-radius: 22px !important;
 
149
  padding: 0 20px !important;
150
  height: 44px !important;
151
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
 
152
  }
153
 
154
  #input-area button:hover,
155
  #input-area .gr-button-primary:hover {
156
  background-color: #ffffff !important;
 
157
  }
158
 
159
+ /* Тонкий скроллбар */
160
  ::-webkit-scrollbar {
161
  width: 6px;
162
  height: 6px;