You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: prompts/chrome.md
+9-44Lines changed: 9 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,17 +8,17 @@ arguments:
8
8
parameter-values:
9
9
query: "Show me the most viral yt thumbnail from the last 2 weeks."
10
10
tools:
11
-
- name: websocat
12
-
description: A tool to send and receive messages over a websocket.
11
+
- name: interact-with-chrome
12
+
description: A tool to send and receive messages to headless chrome via a websocket. Make sure the Chrome websocket server is running before using this tool.
13
13
parameters:
14
14
type: object
15
15
properties:
16
16
endpoint:
17
17
type: string
18
-
description: The url of the websocket endpoint.
18
+
description: "The url of the websocket endpoint Chrome is listening on. REPLACE LOCALHOST WITH HOST.DOCKER.INTERNAL. Example: `ws://host.docker.internal:9222/devtools/page/<PAGE_ID>`"
19
19
message:
20
20
type: string
21
-
description: The message to send to websocat on stdin.
21
+
description: "The message to send to the Chrome websocket. Example: `{\"id\":2,\"method\":\"Page.navigate\",\"params\":{\"url\":\"https://www.youtube.com\"}}`"
22
22
required:
23
23
- endpoint
24
24
- message
@@ -31,19 +31,19 @@ tools:
31
31
- "-H=Host: localhost:9222"
32
32
- '{{endpoint|safe}}'
33
33
- name: curl
34
-
description: Run a curl command.
34
+
description: Run a curl command to get the websocket url and make sure that Chrome's websocket server is running. ALWAYS USE THIS TOOL FIRST. MAKE SURE TO USE THE CORRECT HOST HEADER AND ENDPOINT.
35
35
parameters:
36
36
type: object
37
37
properties:
38
38
args:
39
39
type: string
40
-
description: The arguments to pass to curl
40
+
description: "The arguments to pass to curl. Make sure to use the correct host header (localhost) and endpoint (9222). Example: `-X PUT -H \"Host: localhost:9222\" -sg http://host.docker.internal:9222/json/new`"
41
41
container:
42
42
image: vonwig/curl:latest
43
-
command:
43
+
command:
44
44
- "{{raw|safe}}"
45
-
- name: chrome
46
-
description: Starts the chrome browser.
45
+
- name: start-chrome
46
+
description: Starts the chrome browser in case it is not already running.
47
47
parameters:
48
48
type: object
49
49
properties:
@@ -68,41 +68,6 @@ tools:
68
68
69
69
You are a helpful assistant who can control a headless chrome browser running in Docker to answer questions. This browser may or may not be running.
70
70
71
-
You have `curl` and `websocat` available to you to control the browser and to answer the user's question. CURL should be used sparingly for basic tasks like getting the websocket url and making sure the server is running.
72
-
73
-
If you don't see the browser running, use the chrome tool to start it. Otherwise, you can use the curl and websocat tools to control the existing browser.
74
-
75
-
## Verify the server is running
76
-
77
-
Use curl to get the websocket url and make sure the server is running. If it isn't start it with the chrome tool. You can be easily overwhelmed when using curl to get html. Instead, use curl only for basic tasks like getting the websocket url and making sure the server is running.
78
-
79
-
When you get a websocket url back, replace localhost with host.docker.internal because we are running in Docker.
80
-
81
-
Examples:
82
-
83
-
```sh
84
-
# Get the websocket url
85
-
# NOTE: Set the host header to be localhost:9222 due to chrome's default behavior to only allow localhost
86
-
curl -X PUT -H "Host: localhost:9222" -sg http://host.docker.internal:9222/json/new
For more complex tasks, use websocat to send and receive messages to the browser. This can be used to execute javascript, navigate to a page, or screenshot the page.
97
-
98
-
## Answering the Question
99
-
100
-
Your goal is to control the Chrome instance to answer the user's question. You can also use curl to save things to the `/thread/` folder. Anything in the `/thread` folder will be memoized for you. This is particularly useful for saving screenshots.
101
-
102
-
## Cleanup
103
-
104
-
It is important that when you are done with your page, you close it. This is important because the browser could continue to run even after you close the websocket connection.
105
-
106
71
## Question
107
72
108
73
The following is the question you are trying to answer:
0 commit comments