Skip to content

chore: rename sys.print to sys.echo #352

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

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ func (e *Engine) Start(ctx Context, input string) (ret *Return, _ error) {
return e.runDaemon(ctx.Ctx, ctx.Program, tool, input)
} else if tool.IsOpenAPI() {
return e.runOpenAPI(tool, input)
} else if tool.IsPrint() {
return e.runPrint(tool)
} else if tool.IsEcho() {
return e.runEcho(tool)
}
s, err := e.runCommand(ctx.WrappedContext(), tool, input, ctx.ToolCategory)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/engine/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/gptscript-ai/gptscript/pkg/types"
)

func (e *Engine) runPrint(tool types.Tool) (cmdOut *Return, cmdErr error) {
func (e *Engine) runEcho(tool types.Tool) (cmdOut *Return, cmdErr error) {
id := fmt.Sprint(atomic.AddInt64(&completionID, 1))
out := strings.TrimPrefix(tool.Instructions, types.PrintPrefix+"\n")
out := strings.TrimPrefix(tool.Instructions, types.EchoPrefix+"\n")

e.Progress <- types.CompletionStatus{
CompletionID: id,
Expand Down
2 changes: 1 addition & 1 deletion pkg/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func readTool(ctx context.Context, cache *cache.Client, prg *types.Program, base
Parameters: types.Parameters{
Name: base.Name,
},
Instructions: types.PrintPrefix + "\n" + string(data),
Instructions: types.EchoPrefix + "\n" + string(data),
},
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/types/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
const (
DaemonPrefix = "#!sys.daemon"
OpenAPIPrefix = "#!sys.openapi"
PrintPrefix = "#!sys.print"
EchoPrefix = "#!sys.echo"
CommandPrefix = "#!"
)

Expand Down Expand Up @@ -411,8 +411,8 @@ func (t Tool) IsOpenAPI() bool {
return strings.HasPrefix(t.Instructions, OpenAPIPrefix)
}

func (t Tool) IsPrint() bool {
return strings.HasPrefix(t.Instructions, PrintPrefix)
func (t Tool) IsEcho() bool {
return strings.HasPrefix(t.Instructions, EchoPrefix)
}

func (t Tool) IsHTTP() bool {
Expand Down