Skip to content

Commit 346ef5d

Browse files
authored
remove old observation map (#705)
* remove old observation map * changeset * remove object
1 parent d9f4243 commit 346ef5d

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

.changeset/loose-cooks-lead.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Fixed removing a hanging observation map that is no longer used

lib/handlers/observeHandler.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Stagehand, StagehandFunctionName } from "../index";
33
import { observe } from "../inference";
44
import { LLMClient } from "../llm/LLMClient";
55
import { StagehandPage } from "../StagehandPage";
6-
import { generateId, drawObserveOverlay } from "../utils";
6+
import { drawObserveOverlay } from "../utils";
77
import {
88
getAccessibilityTree,
99
getXPathByResolvedObjectId,
@@ -14,12 +14,7 @@ export class StagehandObserveHandler {
1414
private readonly stagehand: Stagehand;
1515
private readonly logger: (logLine: LogLine) => void;
1616
private readonly stagehandPage: StagehandPage;
17-
private observations: {
18-
[key: string]: {
19-
result: { selector: string; description: string }[];
20-
instruction: string;
21-
};
22-
};
17+
2318
private readonly userProvidedInstructions?: string;
2419
constructor({
2520
stagehand,
@@ -36,18 +31,6 @@ export class StagehandObserveHandler {
3631
this.logger = logger;
3732
this.stagehandPage = stagehandPage;
3833
this.userProvidedInstructions = userProvidedInstructions;
39-
this.observations = {};
40-
}
41-
42-
private async _recordObservation(
43-
instruction: string,
44-
result: { selector: string; description: string }[],
45-
): Promise<string> {
46-
const id = generateId(instruction);
47-
48-
this.observations[id] = { result, instruction };
49-
50-
return id;
5134
}
5235

5336
public async observe({
@@ -219,7 +202,6 @@ export class StagehandObserveHandler {
219202
await drawObserveOverlay(this.stagehandPage.page, elementsWithSelectors);
220203
}
221204

222-
await this._recordObservation(instruction, elementsWithSelectors);
223205
return elementsWithSelectors;
224206
}
225207
}

0 commit comments

Comments
 (0)