Skip to content

Commit b128ca5

Browse files
committed
fix: readd missing comments
1 parent 7fa0043 commit b128ca5

File tree

5 files changed

+12
-68
lines changed

5 files changed

+12
-68
lines changed

tools/server/webui/src/assets/iframe_sandbox.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
},
2020
};
2121
// Redirect the iframe's console.log
22-
const originalConsoleLog = console.log; // Keep a reference if needed
2322
console.log = iframeConsole.log.bind(iframeConsole);
2423

2524
window.addEventListener('message', (event) => {

tools/server/webui/src/components/ChatMessage.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export default function ChatMessage({
5959
const nextSibling = siblingLeafNodeIds[siblingCurrIdx + 1];
6060
const prevSibling = siblingLeafNodeIds[siblingCurrIdx - 1];
6161

62+
// for reasoning model, we split the message into content and thought
63+
// TODO: implement this as remark/rehype plugin in the future
6264
const {
6365
content: mainDisplayableContent,
6466
thought,
@@ -79,10 +81,12 @@ export default function ChatMessage({
7981
actualContent += thinkSplit[0];
8082

8183
while (thinkSplit[1] !== undefined) {
84+
// <think> tag found
8285
thinkSplit = thinkSplit[1].split('</think>', 2);
8386
thought += thinkSplit[0];
8487
isThinking = true;
8588
if (thinkSplit[1] !== undefined) {
89+
// </think> closing tag found
8690
isThinking = false;
8791
thinkSplit = thinkSplit[1].split('<think>', 2);
8892
actualContent += thinkSplit[0];
@@ -129,6 +133,7 @@ export default function ChatMessage({
129133
'chat-bubble bg-transparent': !isUser,
130134
})}
131135
>
136+
{/* textarea for editing message */}
132137
{editingContent !== null && (
133138
<>
134139
<textarea
@@ -157,12 +162,14 @@ export default function ChatMessage({
157162
</button>
158163
</>
159164
)}
165+
{/* not editing content, render message */}
160166
{editingContent === null && (
161167
<>
162168
{mainDisplayableContent === null &&
163169
!toolCalls &&
164170
!chainedParts?.length ? (
165171
<>
172+
{/* show loading dots for pending message */}
166173
<span className="loading loading-dots loading-md"></span>
167174
</>
168175
) : (
@@ -224,6 +231,7 @@ export default function ChatMessage({
224231
))}
225232
</React.Fragment>
226233
))}
234+
{/* render timings if enabled */}
227235
{timings && config.showTokensPerSecond && (
228236
<div className="dropdown dropdown-hover dropdown-top mt-2">
229237
<div
@@ -252,6 +260,7 @@ export default function ChatMessage({
252260
</div>
253261
</div>
254262

263+
{/* actions for each message */}
255264
{(entireTurnHasSomeDisplayableContent || msg.role === 'user') && (
256265
<div
257266
className={classNames({
@@ -290,6 +299,7 @@ export default function ChatMessage({
290299
</button>
291300
</div>
292301
)}
302+
{/* user message */}
293303
{msg.role === 'user' && (
294304
<BtnWithTooltips
295305
className="btn-mini w-8 h-8"
@@ -300,6 +310,7 @@ export default function ChatMessage({
300310
<PencilSquareIcon className="h-4 w-4" />
301311
</BtnWithTooltips>
302312
)}
313+
{/* assistant message */}
303314
{msg.role === 'assistant' && (
304315
<>
305316
{!isPending && (

tools/server/webui/src/components/ChatScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export default function ChatScreen() {
218218
if (
219219
!(await sendMessage(
220220
currConvId,
221-
parentMessageId, // Use the correctly determined parent ID
221+
parentMessageId,
222222
lastInpMsg,
223223
extraContext.items,
224224
onChunk

tools/server/webui/src/utils/tool_calling/js_repl_tool.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,4 @@ export class JSReplAgentTool extends AgentTool {
157157
this.iframe!.contentWindow!.postMessage(message, '*');
158158
});
159159
}
160-
161-
// public dispose(): void {
162-
// if (this.iframe) {
163-
// document.body.removeChild(this.iframe);
164-
// this.iframe = null;
165-
// }
166-
// if (this.messageHandler) {
167-
// window.removeEventListener('message', this.messageHandler);
168-
// this.messageHandler = null;
169-
// }
170-
// this.pendingCalls.clear();
171-
// this.resolveIframeReady = null;
172-
// this.rejectIframeReady = null;
173-
// }
174160
}

tools/server/webui/test_tool_use.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)