Skip to content

Commit

Permalink
update prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcguire12 committed Feb 2, 2025
1 parent efcc726 commit 4022d13
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,17 @@ Return an array of elements that match the instruction if they exist, otherwise
export function buildObserveUserMessage(
instruction: string,
domElements: string,
scrollableElemNodes: string,
isUsingAccessibilityTree = false,
): ChatMessage {
const scrollableSection =
isUsingAccessibilityTree && scrollableElemNodes.trim().length
? `Here are some scrollable elements:\n${scrollableElemNodes}\n\n`
: "";

return {
role: "user",
content: `instruction: ${instruction}
${isUsingAccessibilityTree ? "Accessibility Tree" : "DOM"}: ${domElements}`,
content: `instruction: ${instruction}\n
${scrollableSection}${isUsingAccessibilityTree ? "Accessibility Tree" : "DOM"}:\n${domElements}`,
};
}

0 comments on commit 4022d13

Please sign in to comment.