-
Notifications
You must be signed in to change notification settings - Fork 12
fix: get os from context tool #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
tools: service, port, get-operating-system, open-file, open, start-file, start | ||
|
||
!!Important!! - A file can be local or remote. | ||
|
||
Do all of the following in order and do not skip a step. | ||
1. Run the service. | ||
2. Get the port for the running service. | ||
3. Get the operating system. | ||
4. For the provided file, do one of the following two options: | ||
- If it is remote or starts with github.com, do not edit it. | ||
- If it is local, trim the directory from the file and remove the '.gpt' suffix. | ||
5. Do one of the following options. | ||
- If the operating system is Windows: | ||
- If a file or URL is provided, use the start file tool. | ||
- If no file or URL is provided, use the start tool. | ||
- If the operating system is not Windows: | ||
- If a file or URL is provided, use the open-file tool. | ||
- If a file or URL is not provided, use the open tool. | ||
context: github.com/gptscript-ai/context/os | ||
tools: service, port, open-file-nix, open-nix, open-file-windows, open-windows | ||
params: file: (optional) A reference to a tool file. Can refer to either a local or remote file. | ||
|
||
Never run steps in parallel. | ||
|
||
Perform the following steps in the order they appear: | ||
1. Run the service | ||
2. Get the port for the running service | ||
3. If no {file} was provided AND the local operating system is windows, use the open-windows tool then skip the remaining steps | ||
4. If no {file} was provided use the open-nix tool then skip the remaining steps | ||
5. If the operating system is windows, use the open-file-windows tool then skip the remaining steps | ||
6. Use the open-file-nix tool | ||
Comment on lines
+10
to
+13
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. I think there's probably a more clever way to select the right tools based on OS via contexts, but ATM this was the most straightforward way I could come up with. 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. I'm a little surprised that the LLM does the right thing and doesn't try to do something for each listed step. 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. I did some basic testing to make sure it works for remote and local paths, but I didn't try every combination here (e.g. on windows). I'll check on windows and take a look at the events to see exactly what the LLM does here. 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. checked and remote URLs are working properly on windows |
||
|
||
--- | ||
name: service | ||
|
@@ -32,17 +27,7 @@ description: Get the port for the running service | |
|
||
--- | ||
|
||
name: get-operating-system | ||
|
||
#!/usr/bin/env python3 | ||
|
||
import platform | ||
|
||
print(platform.system()) | ||
|
||
--- | ||
|
||
name: open-file | ||
name: open-file-nix | ||
arg: port: The port the service is listening on | ||
arg: file: The file to open | ||
|
||
|
@@ -52,7 +37,7 @@ open http://localhost:${PORT}/run?file=${FILE} | |
|
||
--- | ||
|
||
name: open | ||
name: open-nix | ||
arg: port: The port the service is listening on | ||
|
||
#!/usr/bin/env sh | ||
|
@@ -61,7 +46,7 @@ open http://localhost:${PORT} | |
|
||
--- | ||
|
||
name: start-file | ||
name: open-file-windows | ||
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. renamed to make it more obvious that these toosl are just the "windows variants" of the others. 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. Eh, OK. 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. Well, I can switch it back if we're feeling "meh" about it. Lmk |
||
arg: port: The port the service is listening on | ||
arg: file: The file to open | ||
|
||
|
@@ -71,7 +56,7 @@ start http://localhost:$env:PORT/run?file=$env:FILE | |
|
||
--- | ||
|
||
name: start | ||
name: open-windows | ||
arg: port: The port the service is listening on | ||
|
||
#!/usr/bin/env sh | ||
|
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.
Was having a problem with steps 1 and 2 running in parallel. This corrects for that.