Update app.py
Browse files
app.py
CHANGED
@@ -108,7 +108,7 @@ def format_response_with_thinking(response):
|
|
108 |
# Create HTML with collapsible thinking section
|
109 |
html = f"{before_thinking}\n"
|
110 |
html += f'<div class="thinking-container">'
|
111 |
-
html += f'<button class="thinking-toggle">
|
112 |
html += f'<div class="thinking-content hidden">{thinking_content}</div>'
|
113 |
html += f'</div>\n'
|
114 |
html += after_thinking
|
@@ -163,25 +163,58 @@ css = """
|
|
163 |
margin: 10px 0;
|
164 |
}
|
165 |
.thinking-toggle {
|
166 |
-
background-color:
|
167 |
-
border:
|
168 |
-
border-radius:
|
169 |
-
padding:
|
170 |
cursor: pointer;
|
171 |
-
font-size: 0.
|
172 |
-
margin-bottom:
|
173 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
175 |
.thinking-content {
|
176 |
-
background-color:
|
177 |
-
border-left: 3px solid #
|
178 |
-
padding:
|
179 |
margin-top: 5px;
|
180 |
font-size: 0.95em;
|
181 |
-
color: #
|
182 |
font-family: monospace;
|
183 |
white-space: pre-wrap;
|
184 |
overflow-x: auto;
|
|
|
185 |
}
|
186 |
.hidden {
|
187 |
display: none;
|
@@ -196,7 +229,8 @@ function setupThinkingToggle() {
|
|
196 |
button.addEventListener('click', function() {
|
197 |
const content = this.nextElementSibling;
|
198 |
content.classList.toggle('hidden');
|
199 |
-
|
|
|
200 |
});
|
201 |
button.hasEventListener = true;
|
202 |
}
|
@@ -293,7 +327,7 @@ with gr.Blocks(title="Athena Playground Chat", css=css, theme=theme) as demo:
|
|
293 |
gr.Markdown("""
|
294 |
### About the Thinking Tags
|
295 |
Some Athena models (particularly R3X series) include reasoning in `<think></think>` tags.
|
296 |
-
Click "
|
297 |
""")
|
298 |
|
299 |
# Add the JavaScript to handle the thinking toggle buttons
|
|
|
108 |
# Create HTML with collapsible thinking section
|
109 |
html = f"{before_thinking}\n"
|
110 |
html += f'<div class="thinking-container">'
|
111 |
+
html += f'<button class="thinking-toggle"><div class="thinking-icon"></div> Thinking completed <span class="dropdown-arrow">▼</span></button>'
|
112 |
html += f'<div class="thinking-content hidden">{thinking_content}</div>'
|
113 |
html += f'</div>\n'
|
114 |
html += after_thinking
|
|
|
163 |
margin: 10px 0;
|
164 |
}
|
165 |
.thinking-toggle {
|
166 |
+
background-color: rgba(30, 30, 40, 0.8);
|
167 |
+
border: none;
|
168 |
+
border-radius: 25px;
|
169 |
+
padding: 8px 15px;
|
170 |
cursor: pointer;
|
171 |
+
font-size: 0.95em;
|
172 |
+
margin-bottom: 8px;
|
173 |
+
color: white;
|
174 |
+
display: flex;
|
175 |
+
align-items: center;
|
176 |
+
gap: 8px;
|
177 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
178 |
+
transition: background-color 0.2s;
|
179 |
+
}
|
180 |
+
.thinking-toggle:hover {
|
181 |
+
background-color: rgba(40, 40, 50, 0.9);
|
182 |
+
}
|
183 |
+
.thinking-icon {
|
184 |
+
width: 16px;
|
185 |
+
height: 16px;
|
186 |
+
border-radius: 50%;
|
187 |
+
background-color: #6366f1;
|
188 |
+
position: relative;
|
189 |
+
overflow: hidden;
|
190 |
+
}
|
191 |
+
.thinking-icon::after {
|
192 |
+
content: "";
|
193 |
+
position: absolute;
|
194 |
+
top: 50%;
|
195 |
+
left: 50%;
|
196 |
+
width: 60%;
|
197 |
+
height: 60%;
|
198 |
+
background-color: #a5b4fc;
|
199 |
+
transform: translate(-50%, -50%);
|
200 |
+
border-radius: 50%;
|
201 |
+
}
|
202 |
+
.dropdown-arrow {
|
203 |
+
font-size: 0.7em;
|
204 |
+
margin-left: auto;
|
205 |
+
transition: transform 0.3s;
|
206 |
}
|
207 |
.thinking-content {
|
208 |
+
background-color: rgba(30, 30, 40, 0.6);
|
209 |
+
border-left: 3px solid #6366f1;
|
210 |
+
padding: 12px 15px;
|
211 |
margin-top: 5px;
|
212 |
font-size: 0.95em;
|
213 |
+
color: #e2e8f0;
|
214 |
font-family: monospace;
|
215 |
white-space: pre-wrap;
|
216 |
overflow-x: auto;
|
217 |
+
border-radius: 5px;
|
218 |
}
|
219 |
.hidden {
|
220 |
display: none;
|
|
|
229 |
button.addEventListener('click', function() {
|
230 |
const content = this.nextElementSibling;
|
231 |
content.classList.toggle('hidden');
|
232 |
+
const arrow = this.querySelector('.dropdown-arrow');
|
233 |
+
arrow.style.transform = content.classList.contains('hidden') ? '' : 'rotate(180deg)';
|
234 |
});
|
235 |
button.hasEventListener = true;
|
236 |
}
|
|
|
327 |
gr.Markdown("""
|
328 |
### About the Thinking Tags
|
329 |
Some Athena models (particularly R3X series) include reasoning in `<think></think>` tags.
|
330 |
+
Click on "Thinking completed" to view the model's thought process behind its answers.
|
331 |
""")
|
332 |
|
333 |
# Add the JavaScript to handle the thinking toggle buttons
|