fix: extract text from plannerResponse.modifiedResponse field
This commit is contained in:
@@ -1811,26 +1811,25 @@ function setupMonitor() {
|
|||||||
// Extract from plannerResponse field
|
// Extract from plannerResponse field
|
||||||
const pr = s?.plannerResponse;
|
const pr = s?.plannerResponse;
|
||||||
if (pr) {
|
if (pr) {
|
||||||
if (typeof pr === 'string')
|
// Priority: modifiedResponse (confirmed field from AG)
|
||||||
textContent = pr;
|
if (pr.modifiedResponse)
|
||||||
|
textContent = pr.modifiedResponse;
|
||||||
else if (pr.rawText)
|
else if (pr.rawText)
|
||||||
textContent = pr.rawText;
|
textContent = pr.rawText;
|
||||||
|
else if (pr.text)
|
||||||
|
textContent = pr.text;
|
||||||
else if (pr.message)
|
else if (pr.message)
|
||||||
textContent = typeof pr.message === 'string' ? pr.message : JSON.stringify(pr.message);
|
textContent = typeof pr.message === 'string' ? pr.message : '';
|
||||||
else if (pr.content?.parts) {
|
else if (pr.content?.parts) {
|
||||||
for (const p of pr.content.parts) {
|
for (const p of pr.content.parts) {
|
||||||
if (p?.text)
|
if (p?.text)
|
||||||
textContent += p.text;
|
textContent += p.text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pr.parts) {
|
// Log first time to capture actual field names
|
||||||
for (const p of pr.parts) {
|
if (!textContent) {
|
||||||
if (p?.text)
|
logToFile(`[RESPONSE-CAPTURE] plannerResponse keys: [${Object.keys(pr).join(',')}] values(100): ${JSON.stringify(pr).substring(0, 200)}`);
|
||||||
textContent += p.text;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!textContent)
|
|
||||||
textContent = JSON.stringify(pr).substring(0, 500);
|
|
||||||
}
|
}
|
||||||
// Extract from ephemeralMessage field
|
// Extract from ephemeralMessage field
|
||||||
const em = s?.ephemeralMessage;
|
const em = s?.ephemeralMessage;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1779,20 +1779,20 @@ function setupMonitor() {
|
|||||||
// Extract from plannerResponse field
|
// Extract from plannerResponse field
|
||||||
const pr = s?.plannerResponse;
|
const pr = s?.plannerResponse;
|
||||||
if (pr) {
|
if (pr) {
|
||||||
if (typeof pr === 'string') textContent = pr;
|
// Priority: modifiedResponse (confirmed field from AG)
|
||||||
|
if (pr.modifiedResponse) textContent = pr.modifiedResponse;
|
||||||
else if (pr.rawText) textContent = pr.rawText;
|
else if (pr.rawText) textContent = pr.rawText;
|
||||||
else if (pr.message) textContent = typeof pr.message === 'string' ? pr.message : JSON.stringify(pr.message);
|
else if (pr.text) textContent = pr.text;
|
||||||
|
else if (pr.message) textContent = typeof pr.message === 'string' ? pr.message : '';
|
||||||
else if (pr.content?.parts) {
|
else if (pr.content?.parts) {
|
||||||
for (const p of pr.content.parts) {
|
for (const p of pr.content.parts) {
|
||||||
if (p?.text) textContent += p.text;
|
if (p?.text) textContent += p.text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pr.parts) {
|
// Log first time to capture actual field names
|
||||||
for (const p of pr.parts) {
|
if (!textContent) {
|
||||||
if (p?.text) textContent += p.text;
|
logToFile(`[RESPONSE-CAPTURE] plannerResponse keys: [${Object.keys(pr).join(',')}] values(100): ${JSON.stringify(pr).substring(0,200)}`);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!textContent) textContent = JSON.stringify(pr).substring(0, 500);
|
|
||||||
}
|
}
|
||||||
// Extract from ephemeralMessage field
|
// Extract from ephemeralMessage field
|
||||||
const em = s?.ephemeralMessage;
|
const em = s?.ephemeralMessage;
|
||||||
|
|||||||
Reference in New Issue
Block a user