Skip to content

Commit d2bba95

Browse files
author
Wenbo Cao
committed
Revert all changes
1 parent d0b4a49 commit d2bba95

File tree

6 files changed

+4
-77
lines changed

6 files changed

+4
-77
lines changed

src/Plugins/BotSharp.Plugin.WebDriver/BotSharp.Plugin.WebDriver.csproj

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-web-close_browser.json">
3232
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3333
</Content>
34-
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-web-extract_data_from_page.json">
35-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36-
</Content>
3734
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-web-go_to_page.json">
3835
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3936
</Content>
@@ -106,10 +103,4 @@
106103
<ProjectReference Include="..\..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
107104
</ItemGroup>
108105

109-
<ItemGroup>
110-
<None Update="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-web-extract-data.json">
111-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
112-
</None>
113-
</ItemGroup>
114-
115106
</Project>

src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.ExtractData.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ public async Task<string> ExtractData(BrowserActionParams actionParams)
99
await Task.Delay(3000);
1010

1111
// Retrieve the page raw html and infer the element path
12-
var pageContent = _instance.GetPage(actionParams.ContextId);
13-
var body = await pageContent.QuerySelectorAsync("body");
14-
var pageUrl = pageContent.Url;
15-
var pageBody = await body.InnerTextAsync();
16-
string content = $"Page URL: `{pageUrl}` <br/> PageBody: {pageBody}";
12+
var body = await _instance.GetPage(actionParams.ContextId).QuerySelectorAsync("body");
13+
var content = await body.InnerTextAsync();
1714

1815
var driverService = _services.GetRequiredService<WebDriverService>();
1916
var answer = await driverService.ExtraData(actionParams.Agent, content, actionParams.Context.Question, actionParams.MessageId);

src/Plugins/BotSharp.Plugin.WebDriver/Hooks/WebUtilityHook.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public class WebUtilityHook : IAgentUtilityHook
77
private const string GO_TO_PAGE_FN = $"{PREFIX}go_to_page";
88
private const string LOCATE_ELEMENT_FN = $"{PREFIX}locate_element";
99
private const string ACTION_ON_ELEMENT_FN = $"{PREFIX}action_on_element";
10-
private const string EXTRACT_DATA_FN = $"{PREFIX}extract_data_from_page";
1110

1211
public void AddUtilities(List<AgentUtility> utilities)
1312
{
@@ -21,8 +20,7 @@ public void AddUtilities(List<AgentUtility> utilities)
2120
new(CLOSE_BROWSER_FN),
2221
new(GO_TO_PAGE_FN),
2322
new(LOCATE_ELEMENT_FN),
24-
new(ACTION_ON_ELEMENT_FN),
25-
new(EXTRACT_DATA_FN)
23+
new(ACTION_ON_ELEMENT_FN)
2624
],
2725
Templates =
2826
[

src/Plugins/BotSharp.Plugin.WebDriver/UtilFunctions/UtilWebActionOnElementFn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public async Task<bool> Execute(RoleDialogModel message)
4545
};
4646
var result = await browser.ActionOnElement(msg, locatorArgs, actionArgs);
4747

48-
message.Content = $"{actionArgs.Action} executed {(result.IsSuccess ? "success" : "failed")}";
48+
message.Content = $"{actionArgs.Action} executed {(result.IsSuccess ? "success" : "failed")}. Current page url: '{result.UrlAfterAction}'.";
4949

5050
var path = webDriverService.GetScreenshotFilePath(message.MessageId);
5151

src/Plugins/BotSharp.Plugin.WebDriver/UtilFunctions/UtilWebExtractDataFn.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/Plugins/BotSharp.Plugin.WebDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-web-extract_data_from_page.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)