Skip to content

Commit

Permalink
Merge pull request #16 from sotopia-lab/readme_up
Browse files Browse the repository at this point in the history
Readme update
  • Loading branch information
akhatua2 authored Dec 20, 2024
2 parents f906017 + f109c56 commit a0ae1b8
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 28 deletions.
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Development Environment Setup Guide

This guide provides instructions for setting up and running the development environment both locally and on Google VM.

## Local Development Setup

### Prerequisites

1. **Redis Server**
- Must be running on `localhost:6379`
- Ensure Redis is installed and properly configured

### Project Setup

#### AACT-OpenHands Backend
1. Clone the repository:
git clone https://github.com/akhatua2/aact-openhands

2. Follow the repository's README for detailed setup instructions
3. Verify the Flask server is running successfully
```
# Install dependencies
bun i
# Start development server
bun run dev
```
### Google VM Environment
#### Project Structure
```
Root Directory
├── cotomata/ # Cotomata project files
└── aact-openhands/ # AACT-OpenHands project files
```
API Endpoints
- Base Server URL: http://34.57.199.157
- Cotomata API: http://34.57.199.157:3000/{endpoint}
- AACT-OpenHands API: http://34.57.199.157:5000/{endpoint}
#### Server Management
Status Monitoring
Check the current server status:
```
sudo systemctl status {branch}.service
```
Restart the server:
```
# Reload system configurations
sudo systemctl daemon-reload

# Restart specific service
sudo systemctl restart {branch}.service
```
Stop server (required before local testing):
```
sudo systemctl stop cotomata
```
#### Local Development on VM
Running Cotomata
```
# Navigate to frontend directory
cd cotomata/frontend

# Start development server
bun run dev
```
Running AACT-OpenHands
```
# Navigate to project directory
cd aact-openhands/aact_openhands

# Start Python application
poetry run python app.py
```
Access your local development instance at: http://34.57.199.157:{PORT}/
33 changes: 23 additions & 10 deletions frontend/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ import { SidebarTrigger } from '@/components/ui/sidebar';

type PanelOption = 'fileSystem' | 'sceneContext';

async function runPythonCommand() {
const response = await fetch('/api/run-agent', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ command: 'print("Hello, Python!")' }),
});
const result = await response.json();
console.log(result);
}
// need for run-dataflow post req

// async function runPythonCommand() {
// const response = await fetch('/api/run-agent', {
// method: 'POST',
// headers: { 'Content-Type': 'application/json' },
// body: JSON.stringify({ command: 'print("Hello, Python!")' }),
// });
// const result = await response.json();
// console.log(result);
// }

export default function App() {
const {
Expand Down Expand Up @@ -90,14 +92,25 @@ export default function App() {
// Log connection status
socketInstance.on('connect', () => {
console.log('Connected to server with ID:', socketInstance.id);
runPythonCommand();
// runPythonCommand();
});
console.log('socket connect', socketInstance)

// Log connection errors
socketInstance.on('connect_error', (error) => {
console.error('Connection error:', error);
});

socketInstance.emit('init_process');
socketInstance.on('init_process_result', (result) => {
if (result.status === 'error') {
console.error('Process initialization failed:', result.error);
} else {
console.log('Process started successfully');
}
});


setSocket(socketInstance);

// Cleanup on component unmount
Expand Down
18 changes: 0 additions & 18 deletions frontend/pages/api/run-agent.ts

This file was deleted.

20 changes: 20 additions & 0 deletions frontend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,26 @@ app.prepare().then(async () => {
}
});

// Handle process initialization
socket.on('init_process', async () => {
try {
const response = await fetch('http://localhost:5000/run-dataflow', {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});

if (!response.ok) {
throw new Error(`Failed to initialize process: ${response.statusText}`);
}

const result = await response.json();
socket.emit('init_process_result', result);
console.log('openhands connected')
} catch (err) {
console.error('Error initializing process:', err);
}
});

socket.on('disconnect', () => {
console.log('A user disconnected');
});
Expand Down

0 comments on commit a0ae1b8

Please sign in to comment.