11import assert from 'node:assert' ;
2- import path from 'node:path' ;
32import type {
43 AIAssertionResponse ,
54 AIElementResponse ,
@@ -9,29 +8,26 @@ import type {
98 AIUsageInfo ,
109 BaseElement ,
1110 ElementById ,
12- Point ,
1311 Size ,
1412 UIContext ,
1513} from '@/types' ;
16- import { savePositionImg } from '@midscene/shared/img' ;
1714import type {
1815 ChatCompletionSystemMessageParam ,
1916 ChatCompletionUserMessageParam ,
2017} from 'openai/resources' ;
2118import { AIActionType , callAiFn } from './common' ;
22- import { call , callToGetJSONObject } from './openai' ;
2319import {
2420 findElementPrompt ,
25- multiDescription ,
26- systemPromptToFindElement ,
27- } from './prompt/element-inspector' ;
21+ systemPromptToLocateElement ,
22+ } from './prompt/llm-locator' ;
2823import {
2924 describeUserPage ,
3025 elementByPositionWithElementInfo ,
3126 extractDataPrompt ,
3227 systemPromptToAssert ,
3328 systemPromptToExtract ,
3429} from './prompt/util' ;
30+ import { callToGetJSONObject } from './service-caller' ;
3531
3632export type AIArgs = [
3733 ChatCompletionSystemMessageParam ,
@@ -69,11 +65,7 @@ export async function transformElementPositionToId(
6965 } ,
7066 size ,
7167 ) ;
72- // await savePositionImg({
73- // inputImgBase64: screenshotBase64,
74- // rect: absolutePosition,
75- // outputPath: path.join(__dirname, 'test-data', `output-${index++}.png`),
76- // });
68+
7769 const element = elementByPositionWithElementInfo (
7870 elementsInfo ,
7971 absolutePosition ,
@@ -182,7 +174,7 @@ export async function AiInspectElement<
182174 targetElementDescription,
183175 multi,
184176 } ) ;
185- const systemPrompt = systemPromptToFindElement ( ) ;
177+ const systemPrompt = systemPromptToLocateElement ( ) ;
186178 const msgs : AIArgs = [
187179 { role : 'system' , content : systemPrompt } ,
188180 {
0 commit comments