-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
browser automation support #668
Changes from 1 commit
298ee5d
7db0f07
eebbb79
0c170e2
b1d5130
3e4b3ce
3ebc166
388179d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ | |
} from "./azuretoken" | ||
import { LanguageModel } from "../../core/src/chat" | ||
import { errorMessage } from "../../core/src/error" | ||
import { BrowserManager } from "./playwright" | ||
|
||
class NodeServerManager implements ServerManager { | ||
async start(): Promise<void> { | ||
|
@@ -103,7 +104,8 @@ | |
readonly path = createNodePath() | ||
readonly server = new NodeServerManager() | ||
readonly workspace = createFileSystem() | ||
readonly docker = new DockerManager() | ||
readonly containers = new DockerManager() | ||
readonly browsers = new BrowserManager() | ||
readonly defaultModelOptions = { | ||
model: DEFAULT_MODEL, | ||
temperature: DEFAULT_TEMPERATURE, | ||
|
@@ -258,14 +260,21 @@ | |
await remove(name) | ||
} | ||
|
||
async browse( | ||
url: string, | ||
options?: BrowseSessionOptions & TraceOptions | ||
): Promise<BrowserPage> { | ||
return this.browsers.browse(url, options) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no error handling for the async function
|
||
|
||
async exec( | ||
containerId: string, | ||
command: string, | ||
args: string[], | ||
options: ShellOptions & TraceOptions | ||
) { | ||
if (containerId) { | ||
const container = await this.docker.container(containerId) | ||
const container = await this.containers.container(containerId) | ||
return await container.exec(command, args, options) | ||
} | ||
|
||
|
@@ -331,10 +340,14 @@ | |
async container( | ||
options: ContainerOptions & TraceOptions | ||
): Promise<ContainerHost> { | ||
return await this.docker.startContainer(options) | ||
return await this.containers.startContainer(options) | ||
} | ||
|
||
async removeContainers(): Promise<void> { | ||
await this.docker.stopAndRemove() | ||
await this.containers.stopAndRemove() | ||
} | ||
|
||
async removeBrowsers(): Promise<void> { | ||
await this.browsers.stopAndRemove() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DockerManager class is not imported but it is used in this file.