Skip to content

Commit 835f20f

Browse files
authored
Merge pull request Shamlan321#1 from codoo55/main
Minor project updates and upgrades
2 parents 37cd736 + b1a0c5f commit 835f20f

5 files changed

Lines changed: 79 additions & 13 deletions

File tree

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.env
2+
__pycache__
3+
*.pyc
4+
.git
5+
.gitignore
6+
README.md

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM python:3.9-slim
2+
3+
WORKDIR /app
4+
5+
COPY requirements.txt .
6+
RUN pip install --no-cache-dir -r requirements.txt
7+
8+
COPY . .
9+
10+
CMD ["python", "odoosense.py"]

README.md

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,47 @@ An intelligent AI-powered assistant that integrates with Odoo ERP to provide nat
2323

2424
### Prerequisites
2525

26+
**For Docker (Recommended):**
27+
- Docker installed
28+
- Odoo ERP server (v14.0 or higher)
29+
- Google Cloud account for Gemini AI API
30+
31+
**For Python Setup:**
2632
- Python 3.8+
2733
- Odoo ERP server (v14.0 or higher)
2834
- Google Cloud account for Gemini AI API
2935

3036
### Installation
3137

38+
#### 🐳 Docker (Recommended - Zero Dependency Hassles)
39+
40+
1. Clone the repository:
41+
```bash
42+
git clone https://github.com/Shamlan321/OdooSense.git
43+
cd OdooSense
44+
```
45+
46+
2. Create your `.env` file:
47+
```env
48+
ODOO_URL=http://localhost:8068
49+
ODOO_DB=your_database_name
50+
ODOO_USERNAME=your_username
51+
ODOO_PASSWORD=your_password
52+
GEMINI_API_KEY=your_gemini_api_key
53+
```
54+
55+
3. Run with Docker (one command, no setup):
56+
```bash
57+
# Quick start
58+
./docker-run.sh
59+
60+
# Or manual
61+
docker build -t odoosense .
62+
docker run -i --rm --net=host --env-file .env odoosense
63+
```
64+
65+
#### 🐍 Traditional Python Setup
66+
3267
1. Clone the repository:
3368
```bash
3469
git clone https://github.com/Shamlan321/OdooSense.git
@@ -53,6 +88,10 @@ GEMINI_API_KEY=your_gemini_api_key
5388

5489
1. Start the assistant:
5590
```bash
91+
# Docker
92+
./docker-run.sh
93+
94+
# Python
5695
python odoosense.py
5796
```
5897

@@ -98,13 +137,16 @@ The assistant recognizes different keywords for each module:
98137

99138
### Project Structure
100139
```
101-
odoo-ai-assistant/
102-
├── odoosense.py # Main integration file
103-
├── odoo_inspector.py # Module inspection tool
104-
├── module_access_test.py # Access testing utility
105-
├── requirements.txt # Python dependencies
106-
├── .env # Environment configuration
107-
└── README.md # Documentation
140+
OdooSense/
141+
├── odoosense.py # Main integration file
142+
├── odoo_inspector.py # Module inspection tool
143+
├── module_access_test.py # Access testing utility
144+
├── requirements.txt # Python dependencies
145+
├── Dockerfile # Docker container setup
146+
├── docker-run.sh # Docker convenience script
147+
├── .dockerignore # Docker build exclusions
148+
├── .env # Environment configuration
149+
└── README.md # Documentation
108150
```
109151

110152
### Adding New Features

docker-run.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Build the Docker image
4+
docker build -t odoosense .
5+
6+
# Run with host network and environment file
7+
docker run -i --rm \
8+
--net=host \
9+
--env-file .env \
10+
odoosense

odoosense.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
import xmlrpc.client
12-
from google import genai
12+
import google.generativeai as genai
1313
import json
1414
from typing import List, Dict, Any
1515
from langchain.tools import Tool
@@ -836,7 +836,8 @@ def process_with_llm(data_response: Dict, user_query: str, conversation_history:
836836
"""
837837
try:
838838
# Initialize Gemini client with API key from environment
839-
client = genai.Client(api_key=gemini_api_key)
839+
genai.configure(api_key=gemini_api_key)
840+
model = genai.GenerativeModel('gemini-2.0-flash-exp')
840841

841842
if not gemini_api_key:
842843
logger.error("Gemini API key not found in environment variables")
@@ -857,10 +858,7 @@ def process_with_llm(data_response: Dict, user_query: str, conversation_history:
857858
prompt = create_data_query_prompt(data_response, user_query, conversation_context)
858859

859860
# Get response from Gemini
860-
response = client.models.generate_content(
861-
model="gemini-2.0-flash",
862-
contents=prompt
863-
)
861+
response = model.generate_content(prompt)
864862

865863
# Add the interaction to conversation history
866864
conversation_history.add_message('user', user_query, data_response)

0 commit comments

Comments
 (0)