Skip to content

Commit 1b557d1

Browse files
fix: do not lowercase all items in tool(like) lists (#344)
* fix: do not lowercase all items in tool(like) lists When importing things from github or other case sensitive location the previous functionality would lowercase everything causing clones from VCS to fail. This fix removes the calls to lowercase tools and contexts along with the other places they occur. Signed-off-by: Bill Maxwell <[email protected]> * fix: the tool name was not used in the prompt When the next tool chats, the name is lost when the resp variable is reinitialized in the for loop. It always appeared to the user they were chatting with the main entrypoint tool. This changes it so the previous response is saved, and passed to the set prompt function. So now if a tool is communicating the user knows which tool is handling the chat turn. Signed-off-by: Bill Maxwell <[email protected]> --------- Signed-off-by: Bill Maxwell <[email protected]>
1 parent 5807fce commit 1b557d1

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

pkg/chat/chat.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ func Start(ctx context.Context, prevState runner.ChatState, chatter Chatter, prg
4141
}
4242
defer prompter.Close()
4343

44+
// We will want the tool name to be displayed in the prompt
45+
var prevResp runner.ChatResponse
4446
for {
4547
var (
4648
input string
@@ -53,7 +55,7 @@ func Start(ctx context.Context, prevState runner.ChatState, chatter Chatter, prg
5355
return err
5456
}
5557

56-
prompter.SetPrompt(getPrompt(prg, resp))
58+
prompter.SetPrompt(getPrompt(prg, prevResp))
5759

5860
if startInput != "" {
5961
input = startInput
@@ -79,5 +81,6 @@ func Start(ctx context.Context, prevState runner.ChatState, chatter Chatter, prg
7981
}
8082

8183
prevState = resp.State
84+
prevResp = resp
8285
}
8386
}

pkg/parser/parser.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ func isParam(line string, tool *types.Tool) (_ bool, err error) {
101101
}
102102
tool.Parameters.Chat = v
103103
case "export":
104-
tool.Parameters.Export = append(tool.Parameters.Export, csv(strings.ToLower(value))...)
104+
tool.Parameters.Export = append(tool.Parameters.Export, csv(value)...)
105105
case "tool", "tools":
106-
tool.Parameters.Tools = append(tool.Parameters.Tools, csv(strings.ToLower(value))...)
106+
tool.Parameters.Tools = append(tool.Parameters.Tools, csv(value)...)
107107
case "globaltool", "globaltools":
108-
tool.Parameters.GlobalTools = append(tool.Parameters.GlobalTools, csv(strings.ToLower(value))...)
108+
tool.Parameters.GlobalTools = append(tool.Parameters.GlobalTools, csv(value)...)
109109
case "exportcontext":
110-
tool.Parameters.ExportContext = append(tool.Parameters.ExportContext, csv(strings.ToLower(value))...)
110+
tool.Parameters.ExportContext = append(tool.Parameters.ExportContext, csv(value)...)
111111
case "context":
112-
tool.Parameters.Context = append(tool.Parameters.Context, csv(strings.ToLower(value))...)
112+
tool.Parameters.Context = append(tool.Parameters.Context, csv(value)...)
113113
case "args", "arg", "param", "params", "parameters", "parameter":
114114
if err := addArg(value, tool); err != nil {
115115
return false, err

pkg/tests/testdata/TestCase/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"function": {
77
"toolID": "testdata/TestCase/test.gpt:6",
8-
"name": "bob",
8+
"name": "Bob",
99
"description": "I'm Bob, a friendly guy.",
1010
"parameters": {
1111
"properties": {

pkg/tests/testdata/TestCase2/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"function": {
77
"toolID": "testdata/TestCase2/test.gpt:6",
8-
"name": "bob",
8+
"name": "Bob",
99
"description": "I'm Bob, a friendly guy.",
1010
"parameters": {
1111
"properties": {

0 commit comments

Comments
 (0)