@@ -140,6 +140,93 @@ Action: click(start_box='(100,200)')
140
140
} ) ;
141
141
} ) ;
142
142
143
+ // M8 mode tests
144
+ describe ( 'M8 mode' , ( ) => {
145
+ it ( 'should correctly parse M8 format input' , ( ) => {
146
+ const input = `Thought: 我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。
147
+ Action: click(start_box='<bbox>637 964 637 964</bbox>')` ;
148
+
149
+ const result = parseActionVlm ( input , [ 1000 , 1000 ] , 'bc' ) ;
150
+
151
+ expect ( result ) . toEqual ( [
152
+ {
153
+ reflection : null ,
154
+ thought :
155
+ '我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。' ,
156
+ action_type : 'click' ,
157
+ action_inputs : {
158
+ start_box : '[0.637,0.964,0.637,0.964]' ,
159
+ } ,
160
+ } ,
161
+ ] ) ;
162
+ } ) ;
163
+
164
+ it ( 'should correctly parse M8 format input' , ( ) => {
165
+ const input = `Thought: 我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。
166
+ Action: click(start_box='<bbox>637 964 637 964</bbox>')` ;
167
+
168
+ const result = parseActionVlm ( input , [ 1000 , 1000 ] , 'bc' , {
169
+ width : 2560 ,
170
+ height : 1440 ,
171
+ } ) ;
172
+
173
+ expect ( result ) . toEqual ( [
174
+ {
175
+ reflection : null ,
176
+ thought :
177
+ '我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。' ,
178
+ action_type : 'click' ,
179
+ action_inputs : {
180
+ start_box : '[0.637,0.964,0.637,0.964]' ,
181
+ start_coords : [ 1630.72 , 1388.16 ] ,
182
+ } ,
183
+ } ,
184
+ ] ) ;
185
+ } ) ;
186
+
187
+ it ( 'should correctly parse M8 format input' , ( ) => {
188
+ const input = `Thought: 我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。
189
+ Action: click(start_box='[637,964,637,964]')` ;
190
+
191
+ const result = parseActionVlm ( input , [ 1000 , 1000 ] , 'bc' ) ;
192
+
193
+ expect ( result ) . toEqual ( [
194
+ {
195
+ reflection : null ,
196
+ thought :
197
+ '我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。' ,
198
+ action_type : 'click' ,
199
+ action_inputs : {
200
+ start_box : '[0.637,0.964,0.637,0.964]' ,
201
+ } ,
202
+ } ,
203
+ ] ) ;
204
+ } ) ;
205
+
206
+ it ( 'should correctly parse M8 format input' , ( ) => {
207
+ const input = `Thought: 我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。
208
+ Action: click(start_box='[637,964,637,964]')` ;
209
+
210
+ const result = parseActionVlm ( input , [ 1000 , 1000 ] , 'bc' , {
211
+ width : 2560 ,
212
+ height : 1440 ,
213
+ } ) ;
214
+
215
+ expect ( result ) . toEqual ( [
216
+ {
217
+ reflection : null ,
218
+ thought :
219
+ '我看到当前屏幕显示的是一个电子表格软件和一个聊天窗口,而任务要求我需要在浏览器中搜索北京明天天气。我需要先点击任务栏上的浏览器图标来启动浏览器。' ,
220
+ action_type : 'click' ,
221
+ action_inputs : {
222
+ start_box : '[0.637,0.964,0.637,0.964]' ,
223
+ start_coords : [ 1630.72 , 1388.16 ] ,
224
+ } ,
225
+ } ,
226
+ ] ) ;
227
+ } ) ;
228
+ } ) ;
229
+
143
230
describe ( 'Box coordinates normalization' , ( ) => {
144
231
it ( 'should correctly normalize box with four coordinates' , ( ) => {
145
232
const input = `Thought: I need to click on this element
0 commit comments