fix: clean up debug code

This commit is contained in:
Simon
2026-01-14 15:23:02 +08:00
parent 6615f7b300
commit 3b71c535b1

View File

@@ -163,20 +163,6 @@ export class Panel {
* Convert semantic update to step data with i18n * Convert semantic update to step data with i18n
*/ */
#toStepData(data: PanelUpdate): Omit<Step, 'id' | 'stepNumber' | 'timestamp'> { #toStepData(data: PanelUpdate): Omit<Step, 'id' | 'stepNumber' | 'timestamp'> {
// #region agent log
fetch('http://127.0.0.1:7243/ingest/bc2a9e35-f282-4f4f-a970-887c381f4d18', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
location: 'Panel.ts:#toStepData',
message: 'Converting update to step',
data: { type: data.type, rawData: JSON.stringify(data).substring(0, 200) },
timestamp: Date.now(),
sessionId: 'debug-session',
hypothesisId: 'D',
}),
}).catch(() => {})
// #endregion
switch (data.type) { switch (data.type) {
case 'thinking': case 'thinking':
return { type: 'thinking', displayText: data.text ?? this.#i18n.t('ui.panel.thinking') } return { type: 'thinking', displayText: data.text ?? this.#i18n.t('ui.panel.thinking') }
@@ -604,29 +590,7 @@ export class Panel {
#updateHistory(): void { #updateHistory(): void {
const steps = this.#state.getAllSteps() const steps = this.#state.getAllSteps()
this.#historySection.innerHTML = steps.map((step) => this.#createHistoryItem(step)).join('')
const html = steps.map((step) => this.#createHistoryItem(step)).join('')
// #region agent log
fetch('http://127.0.0.1:7243/ingest/bc2a9e35-f282-4f4f-a970-887c381f4d18', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
location: 'Panel.ts:#updateHistory',
message: 'Setting innerHTML',
data: {
htmlLength: html.length,
stepsCount: steps.length,
htmlPreview: html.substring(0, 300),
},
timestamp: Date.now(),
sessionId: 'debug-session',
hypothesisId: 'C',
}),
}).catch(() => {})
// #endregion
this.#historySection.innerHTML = html
// Scroll to bottom to show latest records
this.#scrollToBottom() this.#scrollToBottom()
} }
@@ -638,24 +602,6 @@ export class Panel {
} }
#createHistoryItem(step: Step): string { #createHistoryItem(step: Step): string {
// #region agent log
fetch('http://127.0.0.1:7243/ingest/bc2a9e35-f282-4f4f-a970-887c381f4d18', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
location: 'Panel.ts:#createHistoryItem',
message: 'Creating history item',
data: {
displayText: step.displayText,
type: step.type,
hasAngleBrackets: /[<>]/.test(step.displayText),
},
timestamp: Date.now(),
sessionId: 'debug-session',
hypothesisId: 'A',
}),
}).catch(() => {})
// #endregion
const time = step.timestamp.toLocaleTimeString('zh-CN', { const time = step.timestamp.toLocaleTimeString('zh-CN', {
hour12: false, hour12: false,
hour: '2-digit', hour: '2-digit',
@@ -707,7 +653,7 @@ export class Panel {
duration: durationText || '', // Explicitly pass empty string to replace template duration: durationText || '', // Explicitly pass empty string to replace template
}) })
const htmlOutput = ` return `
<div class="${styles.historyItem} ${typeClass}"> <div class="${styles.historyItem} ${typeClass}">
<div class="${styles.historyContent}"> <div class="${styles.historyContent}">
<span class="${styles.statusIcon}">${statusIcon}</span> <span class="${styles.statusIcon}">${statusIcon}</span>
@@ -718,23 +664,5 @@ export class Panel {
</div> </div>
</div> </div>
` `
// #region agent log
fetch('http://127.0.0.1:7243/ingest/bc2a9e35-f282-4f4f-a970-887c381f4d18', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
location: 'Panel.ts:#createHistoryItem:return',
message: 'Generated HTML output',
data: {
htmlOutputLength: htmlOutput.length,
htmlOutputPreview: htmlOutput.substring(0, 200),
},
timestamp: Date.now(),
sessionId: 'debug-session',
hypothesisId: 'A',
}),
}).catch(() => {})
// #endregion
return htmlOutput
} }
} }