File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,13 +21,12 @@ import {
2121import {
2222 assembleSystemPrompt ,
2323 isSystemPromptTemplate ,
24- defaultNormalizeCoords ,
2524 normalizeActionCoords ,
2625 sleep ,
2726} from '@gui-agent/shared/utils' ;
2827import { GUI_ADAPTED_TOOL_NAME } from './constants' ;
2928import { convertToAgentUIAction , createGUIErrorResponse } from './utils' ;
30- import { defaultDetailCalculator } from './defaultImpls' ;
29+ import { defaultNormalizeCoords , defaultDetailCalculator } from './defaultImpls' ;
3130
3231const defaultLogger = new ConsoleLogger ( '[GUIAgent]' , LogLevel . DEBUG ) ;
3332
Original file line number Diff line number Diff line change 22 * Copyright (c) 2025 Bytedance, Inc. and its affiliates.
33 * SPDX-License-Identifier: Apache-2.0
44 */
5- import { ImageDetailCalculator } from '@gui-agent/shared/types' ;
5+ import { Coordinates , ImageDetailCalculator , NormalizeCoordinates } from '@gui-agent/shared/types' ;
6+
7+ /**
8+ * Default coordinate normalization function
9+ * Normalizes raw coordinates by dividing by 1000 (simple scaling)
10+ * @param rawCoords - The raw coordinates to normalize
11+ * @returns Object containing normalized coordinates
12+ */
13+ export const defaultNormalizeCoords : NormalizeCoordinates = ( rawCoords : Coordinates ) => {
14+ if ( ! rawCoords . raw ) {
15+ return { normalized : rawCoords } ;
16+ }
17+ const normalizedCoords = {
18+ ...rawCoords ,
19+ normalized : {
20+ x : rawCoords . raw . x / 1000 ,
21+ y : rawCoords . raw . y / 1000 ,
22+ } ,
23+ } ;
24+ return { normalized : normalizedCoords } ;
25+ } ;
626
727/**
828 * Default implementation for detail calculation based on pixel count
Original file line number Diff line number Diff line change 55
66import { BaseAction , Coordinates , NormalizeCoordinates } from '../types' ;
77
8- /**
9- * Default coordinate normalization function
10- * Normalizes raw coordinates by dividing by 1000 (simple scaling)
11- * @param rawCoords - The raw coordinates to normalize
12- * @returns Object containing normalized coordinates
13- */
14- export const defaultNormalizeCoords : NormalizeCoordinates = ( rawCoords : Coordinates ) => {
15- if ( ! rawCoords . raw ) {
16- return { normalized : rawCoords } ;
17- }
18- const normalizedCoords = {
19- ...rawCoords ,
20- normalized : {
21- x : rawCoords . raw . x / 1000 ,
22- y : rawCoords . raw . y / 1000 ,
23- } ,
24- } ;
25- return { normalized : normalizedCoords } ;
26- } ;
27-
288/**
299 * Normalizes coordinates in a BaseAction object
3010 * Processes point, start, and end coordinate fields if they exist
You can’t perform that action at this time.
0 commit comments