fraudTech commited on
Commit
2c6f767
·
1 Parent(s): d971281

display reasoning content

Browse files
Files changed (2) hide show
  1. web/src/App.css +59 -0
  2. web/src/App.tsx +25 -0
web/src/App.css CHANGED
@@ -1060,6 +1060,65 @@ details.tool-section[open] summary::before {
1060
  opacity: 0.9;
1061
  }
1062
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1063
  @keyframes typing {
1064
  0%, 60%, 100% {
1065
  transform: translateY(0);
 
1060
  opacity: 0.9;
1061
  }
1062
 
1063
+ /* Reasoning trace from deepseek-reasoner model */
1064
+ details.reasoning-trace {
1065
+ background: #1a1614;
1066
+ margin-top: 1rem;
1067
+ border: 1px solid #5a4a3a;
1068
+ border-radius: 6px;
1069
+ transition: background 0.2s ease;
1070
+ }
1071
+
1072
+ details.reasoning-trace[open] {
1073
+ background: #1f1b18;
1074
+ }
1075
+
1076
+ details.reasoning-trace summary {
1077
+ cursor: pointer;
1078
+ padding: 1rem;
1079
+ user-select: none;
1080
+ list-style: none;
1081
+ transition: background 0.2s ease;
1082
+ }
1083
+
1084
+ details.reasoning-trace summary:hover {
1085
+ background: rgba(180, 150, 100, 0.1);
1086
+ }
1087
+
1088
+ details.reasoning-trace summary::-webkit-details-marker {
1089
+ display: none;
1090
+ }
1091
+
1092
+ .reasoning-header {
1093
+ display: flex;
1094
+ align-items: center;
1095
+ gap: 0.75rem;
1096
+ color: #b89968;
1097
+ font-size: 0.9rem;
1098
+ font-weight: 500;
1099
+ letter-spacing: 0.3px;
1100
+ }
1101
+
1102
+ .reasoning-icon {
1103
+ font-size: 1.1rem;
1104
+ opacity: 0.9;
1105
+ }
1106
+
1107
+ .reasoning-content {
1108
+ padding: 1rem;
1109
+ background: #16120f;
1110
+ color: #a89784;
1111
+ font-size: 0.85rem;
1112
+ line-height: 1.7;
1113
+ font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
1114
+ white-space: pre-wrap;
1115
+ word-wrap: break-word;
1116
+ max-height: 400px;
1117
+ overflow-y: auto;
1118
+ border-top: 1px solid #3a342e;
1119
+ opacity: 0.9;
1120
+ }
1121
+
1122
  @keyframes typing {
1123
  0%, 60%, 100% {
1124
  transform: translateY(0);
web/src/App.tsx CHANGED
@@ -222,6 +222,7 @@ interface Message {
222
  timestamp: Date;
223
  toolCalls?: ToolCall[];
224
  thinkingContent?: string; // Intermediate working text
 
225
  isStreaming?: boolean;
226
  }
227
 
@@ -419,6 +420,18 @@ function App() {
419
  };
420
  })
421
  );
 
 
 
 
 
 
 
 
 
 
 
 
422
  } else if (event === 'tool_start') {
423
  // Add tool call placeholder with generating state
424
  setStatusMessage(`Generating ${data.name}...`);
@@ -871,6 +884,18 @@ function App() {
871
  )}
872
  </div>
873
  )}
 
 
 
 
 
 
 
 
 
 
 
 
874
  {/* Tool calls - unchanged from original */}
875
  {message.toolCalls && message.toolCalls.length > 0 && (
876
  <div className="tool-calls">
 
222
  timestamp: Date;
223
  toolCalls?: ToolCall[];
224
  thinkingContent?: string; // Intermediate working text
225
+ reasoningContent?: string; // DeepSeek-Reasoner reasoning trace
226
  isStreaming?: boolean;
227
  }
228
 
 
420
  };
421
  })
422
  );
423
+ } else if (event === 'reasoning_chunk') {
424
+ // Stream reasoning trace from deepseek-reasoner model
425
+ setMessages((prev) =>
426
+ prev.map((msg) => {
427
+ if (msg.id !== assistantId) return msg;
428
+
429
+ return {
430
+ ...msg,
431
+ reasoningContent: (msg.reasoningContent || '') + data.chunk,
432
+ };
433
+ })
434
+ );
435
  } else if (event === 'tool_start') {
436
  // Add tool call placeholder with generating state
437
  setStatusMessage(`Generating ${data.name}...`);
 
884
  )}
885
  </div>
886
  )}
887
+ {/* Reasoning trace from deepseek-reasoner model */}
888
+ {message.reasoningContent && (
889
+ <details className="reasoning-trace">
890
+ <summary className="reasoning-header">
891
+ <span className="reasoning-icon">🧠</span>
892
+ <span>Internal Reasoning Trace</span>
893
+ </summary>
894
+ <div className="reasoning-content">
895
+ {message.reasoningContent}
896
+ </div>
897
+ </details>
898
+ )}
899
  {/* Tool calls - unchanged from original */}
900
  {message.toolCalls && message.toolCalls.length > 0 && (
901
  <div className="tool-calls">