Skip to content

Commit

Permalink
fix: set session size for tmux tool, fixed wrong tmux examples (termi…
Browse files Browse the repository at this point in the history
…nal instead of tmux)
  • Loading branch information
ErikBjare committed Sep 4, 2024
1 parent 4251854 commit 1ef4587
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions gptme/tools/tmux.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ def new_session(command: str) -> Message:
assert result.returncode == 0
print(result.stdout, result.stderr)

# set session size
cmd = ["tmux", "resize-window", "-t", session_id, "-x", "120", "-y", "40"]
print(" ".join(cmd))
result = subprocess.run(
" ".join(cmd),
check=True,
capture_output=True,
text=True,
shell=True,
)

cmd = ["tmux", "send-keys", "-t", session_id, command, "Enter"]
print(" ".join(cmd))
result = subprocess.run(
Expand Down Expand Up @@ -200,7 +211,7 @@ def execute_tmux(
User: Can you show me the current content of the pane?
Assistant: Of course! Let's inspect the pane content:
```terminal
```tmux
inspect_pane 0
```
System:
Expand All @@ -210,7 +221,7 @@ def execute_tmux(
User: Stop the dev server
Assistant: I'll send 'Ctrl+C' to the pane to stop the server:
```terminal
```tmux
send_keys 0 C-c
```
System: Sent 'C-c' to pane 0
Expand All @@ -225,8 +236,8 @@ def execute_tmux(
#### Background process
User: Start the dev server
Assistant: Certainly! To start the dev server we should use the terminal tool to run it in a tmux session:
```terminal
Assistant: Certainly! To start the dev server we should use the tmux tool to run it in a tmux session:
```tmux
new_session 'npm run dev'
```
Expand All @@ -249,12 +260,12 @@ def execute_tmux(
#### Ending a session
User: I changed my mind
Assistant: No problem! Let's kill the session and start over:
```terminal
```tmux
list_sessions
```
System: Active tmux sessions [0]
Assistant:
```terminal
```tmux
kill_session 0
```
System: Killed tmux session with ID 0
Expand Down

0 comments on commit 1ef4587

Please sign in to comment.