Spaces:
Sleeping
Sleeping
add deepseek-reasoner model to web version
Browse files- web/src/App.css +48 -0
- web/src/App.tsx +22 -2
web/src/App.css
CHANGED
|
@@ -1124,6 +1124,54 @@ details.tool-section[open] summary::before {
|
|
| 1124 |
align-items: center;
|
| 1125 |
}
|
| 1126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1127 |
.math-symbols-btn {
|
| 1128 |
background: #2a2520;
|
| 1129 |
color: #c9b8a3;
|
|
|
|
| 1124 |
align-items: center;
|
| 1125 |
}
|
| 1126 |
|
| 1127 |
+
.model-toggle-btn {
|
| 1128 |
+
background: #2a2520;
|
| 1129 |
+
color: #c9b8a3;
|
| 1130 |
+
border: 1px solid #3a342e;
|
| 1131 |
+
padding: 0.75rem 0.9rem;
|
| 1132 |
+
cursor: pointer;
|
| 1133 |
+
font-size: 0.78rem;
|
| 1134 |
+
font-weight: 700;
|
| 1135 |
+
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Consolas', monospace;
|
| 1136 |
+
letter-spacing: 0.04em;
|
| 1137 |
+
transition: all 0.2s ease;
|
| 1138 |
+
border-radius: 8px;
|
| 1139 |
+
display: flex;
|
| 1140 |
+
align-items: center;
|
| 1141 |
+
gap: 0.3rem;
|
| 1142 |
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
| 1143 |
+
min-width: 2.4rem;
|
| 1144 |
+
justify-content: center;
|
| 1145 |
+
}
|
| 1146 |
+
|
| 1147 |
+
.model-toggle-btn:hover:not(:disabled) {
|
| 1148 |
+
background: #3a342e;
|
| 1149 |
+
border-color: #4a443c;
|
| 1150 |
+
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
|
| 1151 |
+
}
|
| 1152 |
+
|
| 1153 |
+
.model-toggle-btn:active:not(:disabled) {
|
| 1154 |
+
transform: scale(0.98);
|
| 1155 |
+
}
|
| 1156 |
+
|
| 1157 |
+
.model-toggle-btn--active {
|
| 1158 |
+
background: linear-gradient(135deg, #1a3a2a 0%, #1e4530 100%);
|
| 1159 |
+
color: #5ed99a;
|
| 1160 |
+
border-color: #2d6b48;
|
| 1161 |
+
box-shadow: 0 2px 8px rgba(46, 160, 100, 0.25);
|
| 1162 |
+
}
|
| 1163 |
+
|
| 1164 |
+
.model-toggle-btn--active:hover:not(:disabled) {
|
| 1165 |
+
background: linear-gradient(135deg, #1e4530 0%, #235238 100%);
|
| 1166 |
+
border-color: #3a7d58;
|
| 1167 |
+
box-shadow: 0 3px 10px rgba(46, 160, 100, 0.35);
|
| 1168 |
+
}
|
| 1169 |
+
|
| 1170 |
+
.model-toggle-btn:disabled {
|
| 1171 |
+
opacity: 0.4;
|
| 1172 |
+
cursor: not-allowed;
|
| 1173 |
+
}
|
| 1174 |
+
|
| 1175 |
.math-symbols-btn {
|
| 1176 |
background: #2a2520;
|
| 1177 |
color: #c9b8a3;
|
web/src/App.tsx
CHANGED
|
@@ -254,6 +254,18 @@ function App() {
|
|
| 254 |
const [statusMessage, setStatusMessage] = useState('');
|
| 255 |
const [activeSymbolCategory, setActiveSymbolCategory] = useState('greek');
|
| 256 |
const [showMathSymbols, setShowMathSymbols] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
const messagesEndRef = useRef<HTMLDivElement>(null);
|
| 258 |
const messagesContainerRef = useRef<HTMLDivElement>(null);
|
| 259 |
const abortControllerRef = useRef<AbortController | null>(null);
|
|
@@ -331,8 +343,8 @@ function App() {
|
|
| 331 |
method: 'POST',
|
| 332 |
headers,
|
| 333 |
body: JSON.stringify({
|
| 334 |
-
message: currentInput
|
| 335 |
-
|
| 336 |
}),
|
| 337 |
signal: abortControllerRef.current.signal,
|
| 338 |
});
|
|
@@ -1259,6 +1271,14 @@ function App() {
|
|
| 1259 |
disabled={isLoading}
|
| 1260 |
/>
|
| 1261 |
<div className="input-buttons">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1262 |
<button
|
| 1263 |
onClick={() => setShowMathSymbols(!showMathSymbols)}
|
| 1264 |
className="math-symbols-btn"
|
|
|
|
| 254 |
const [statusMessage, setStatusMessage] = useState('');
|
| 255 |
const [activeSymbolCategory, setActiveSymbolCategory] = useState('greek');
|
| 256 |
const [showMathSymbols, setShowMathSymbols] = useState(false);
|
| 257 |
+
const [selectedModel, setSelectedModel] = useState<string>('deepseek-chat');
|
| 258 |
+
|
| 259 |
+
const AVAILABLE_MODELS = [
|
| 260 |
+
{ id: 'deepseek-chat', label: 'V3', title: 'DeepSeek V3 (fast)' },
|
| 261 |
+
{ id: 'deepseek-reasoner', label: 'R1', title: 'DeepSeek R1 (deep reasoning)' },
|
| 262 |
+
];
|
| 263 |
+
|
| 264 |
+
const toggleModel = () => {
|
| 265 |
+
setSelectedModel((prev) =>
|
| 266 |
+
prev === 'deepseek-chat' ? 'deepseek-reasoner' : 'deepseek-chat'
|
| 267 |
+
);
|
| 268 |
+
};
|
| 269 |
const messagesEndRef = useRef<HTMLDivElement>(null);
|
| 270 |
const messagesContainerRef = useRef<HTMLDivElement>(null);
|
| 271 |
const abortControllerRef = useRef<AbortController | null>(null);
|
|
|
|
| 343 |
method: 'POST',
|
| 344 |
headers,
|
| 345 |
body: JSON.stringify({
|
| 346 |
+
message: currentInput,
|
| 347 |
+
model: selectedModel,
|
| 348 |
}),
|
| 349 |
signal: abortControllerRef.current.signal,
|
| 350 |
});
|
|
|
|
| 1271 |
disabled={isLoading}
|
| 1272 |
/>
|
| 1273 |
<div className="input-buttons">
|
| 1274 |
+
<button
|
| 1275 |
+
onClick={toggleModel}
|
| 1276 |
+
className={`model-toggle-btn${selectedModel === 'deepseek-reasoner' ? ' model-toggle-btn--active' : ''}`}
|
| 1277 |
+
title={AVAILABLE_MODELS.find(m => m.id === selectedModel)?.title}
|
| 1278 |
+
disabled={isLoading}
|
| 1279 |
+
>
|
| 1280 |
+
{AVAILABLE_MODELS.find(m => m.id === selectedModel)?.label}
|
| 1281 |
+
</button>
|
| 1282 |
<button
|
| 1283 |
onClick={() => setShowMathSymbols(!showMathSymbols)}
|
| 1284 |
className="math-symbols-btn"
|