feat(agent): improve timestamp precision and proxy selection for video screenshots (#374)

This commit is contained in:
Yiling-J
2026-09-01 21:15:28 +08:00
committed by GitHub
parent 64b68e7d63
commit 5a754bcb94
5 changed files with 82 additions and 10 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ function formatAttr(name: string, value: string | undefined): string {
* 1. Tag sequence: <user>, <thread>, <current_asset>, <position>, <annotation>, <attached_files>, <referenced_assets>
* 2. Attribute sequence on every tag follows fixed, invariant order.
* 3. Arrays (attachedFiles, referencedAssets) sorted by id ascending.
* 4. Floats formatted with .toFixed(2), integers rounded.
* 4. Time position floats formatted with .toFixed(4), duration with .toFixed(2), integers rounded.
* 5. String values escaped via escapeXmlAttr.
* 6. Exact 2-space indentation and LF newlines.
*/
@@ -101,7 +101,7 @@ export function serializeContextToXml(context?: ShumaiMessageContext | null): st
// 3. <position ... />
if (context.position) {
if (context.position.type === 'time') {
lines.push(` <position type="time" seconds="${context.position.seconds.toFixed(2)}" />`)
lines.push(` <position type="time" seconds="${context.position.seconds.toFixed(4)}" />`)
} else if (context.position.type === 'page') {
lines.push(` <position type="page" page="${Math.round(context.position.page)}" />`)
}