Skip to content

Commit

Permalink
fix: moved vue@create example into bash tool (dont try to do it inter…
Browse files Browse the repository at this point in the history
…actively)
  • Loading branch information
ErikBjare committed Aug 20, 2024
1 parent 42ee56a commit 5ed36eb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 32 deletions.
17 changes: 17 additions & 0 deletions gptme/tools/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ def get_installed_programs() -> set[str]:
(contents of main.py)
```
Assistant: The project is...
#### Create vue project
User: Create a new vue project with typescript and pinia named fancy-project
Assistant: Sure! Let's create a new vue project with TypeScript and Pinia named fancy-project:
```bash
npm init vue@latest fancy-project --yes -- --typescript --pinia
```
System:
```output
> npx
> create-vue
Vue.js - The Progressive JavaScript Framework
Scaffolding project in ./fancy-project...
```
""".strip()


Expand Down
42 changes: 10 additions & 32 deletions gptme/tools/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
You can use the terminal tool to run long-lived and/or interactive applications in a tmux session. Requires tmux to be installed.
This tool is suitable to run long-running commands or interactive applications that require user input.
Examples of such commands: ``npm run dev``, ``npm create vue@latest``, ``python3 server.py``, ``python3 train.py``, etc.
Examples of such commands: ``npm run dev``, ``python3 server.py``, ``python3 train.py``, etc.
It allows for inspecting pane contents and sending input.
"""

import logging
import shutil
import subprocess
Expand Down Expand Up @@ -194,8 +193,8 @@ def execute_terminal(
Server is running on localhost:5600
```
User: Can you stop the dev server?
Assistant: Certainly! I'll send 'Ctrl+C' to the pane to stop the server:
User: Stop the dev server
Assistant: I'll send 'Ctrl+C' to the pane to stop the server:
```terminal
send_keys 0 C-c
```
Expand All @@ -216,42 +215,21 @@ def execute_terminal(
new_session 'npm run dev'
```
#### Interactive process
User: Create a new vue project with typescript
Assistant: Sure! Let's create a new vue project in a tmux session:
```terminal
new_session 'npm create vue@latest'
#### Create vue project
User: Create a new vue project with typescript and pinia named fancy-project
Assistant: Sure! Let's create a new vue project with TypeScript and Pinia named fancy-project:
```bash
npm init vue@latest fancy-project --yes -- --typescript --pinia
```
System: Running 'npm create vue@latest' in session 0
System:
```output
> npx
> create-vue
Vue.js - The Progressive JavaScript Framework
? Project name: › vue-project
```
Assistant: vue-project is a placeholder we can fill in. What would you like to name your project?
User: fancy-project
Assistant:
```terminal
send_keys 0 fancy-project Enter
```
System: Sent 'fancy-project Enter' to pane 0
Assistant: Lets check that the name was set and move on
```terminal
inspect_pane 0
```
System:
```output
? Project name: › fancy-project
? Add TypeScript? › No / Yes
```
Assistant: The project name has been set, now we choose TypeScript
```terminal
send_keys 0 Right Enter
Scaffolding project in ./fancy-project...
```
System: Sent 'Right Enter' to pane 0
#### Ending a session
User: I changed my mind
Expand Down

0 comments on commit 5ed36eb

Please sign in to comment.