Skip to content
Open
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
18 changes: 9 additions & 9 deletions cmd/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func chatSingleShot(agentKey, message, session string, noStream bool) error {
defer ws.Close()

params := map[string]any{
"agent_key": agentKey,
"message": message,
"agentId": agentKey,
"message": message,
}
if session != "" {
params["session_key"] = session
params["sessionKey"] = session
}

if noStream || cfg.OutputFormat == "json" {
Expand Down Expand Up @@ -151,11 +151,11 @@ func chatInteractive(agentKey, session string) error {
fmt.Println("Goodbye!")
return nil
case "/abort":
_, _ = ws.Call("chat.abort", map[string]any{"agent_key": agentKey})
_, _ = ws.Call("chat.abort", map[string]any{"agentId": agentKey})
fmt.Println("[aborted]")
continue
case "/sessions":
resp, err := ws.Call("sessions.list", map[string]any{"agent_key": agentKey})
resp, err := ws.Call("sessions.list", map[string]any{"agentId": agentKey})
if err != nil {
fmt.Printf("Error: %s\n", err)
continue
Expand All @@ -164,18 +164,18 @@ func chatInteractive(agentKey, session string) error {
continue
case "/clear":
if session != "" {
_, _ = ws.Call("sessions.reset", map[string]any{"session_key": session})
_, _ = ws.Call("sessions.reset", map[string]any{"sessionKey": session})
fmt.Println("[session cleared]")
}
continue
}

params := map[string]any{
"agent_key": agentKey,
"message": input,
"agentId": agentKey,
"message": input,
}
if session != "" {
params["session_key"] = session
params["sessionKey"] = session
}

_, err := ws.Stream("chat.send", params, func(e *client.WSEvent) {
Expand Down
12 changes: 6 additions & 6 deletions cmd/chat_ai_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ Examples:
defer ws.Close()

params := map[string]any{
"agent_key": args[0],
"role": role,
"content": content,
"agentId": args[0],
"role": role,
"content": content,
}
if session != "" {
params["session_key"] = session
params["sessionKey"] = session
}

data, err := ws.Call("chat.inject", params)
Expand Down Expand Up @@ -155,9 +155,9 @@ Examples:
}
defer ws.Close()

params := map[string]any{"agent_key": args[0]}
params := map[string]any{"agentId": args[0]}
if session != "" {
params["session_key"] = session
params["sessionKey"] = session
}

data, err := ws.Call("chat.session.status", params)
Expand Down
6 changes: 3 additions & 3 deletions cmd/chat_replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ func runChatHistory(agent, session, before string, limit int) error {
defer ws.Close()

params := map[string]any{
"agent_key": agent,
"limit": limit,
"agentId": agent,
"limit": limit,
}
if before != "" {
params["before"] = before
}
if session != "" {
params["session_key"] = session
params["sessionKey"] = session
}

data, err := ws.Call("chat.history", params)
Expand Down
2 changes: 1 addition & 1 deletion internal/client/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (ws *WSClient) Call(method string, params any) (json.RawMessage, error) {
return nil, resp.Error
}
return resp.Payload, nil
case <-time.After(30 * time.Second):
case <-time.After(300 * time.Second):
return nil, fmt.Errorf("timeout waiting for response to %s", method)
case <-ws.done:
return nil, fmt.Errorf("connection closed")
Expand Down