Skip to content

Commit 4f5e97d

Browse files
committed
feat(core): initial implementation of CoderAI platform
This commit includes the following components: - feat(ui): implement Streamlit-based user interface with main panel, sidebar, and provider config - feat(models): add integration with Ollama and Hugging Face models - feat(services): implement model service, embedding service, and vector store service - feat(utils): add document processing and API utilities - chore(config): add configuration files and environment variables - docs(readme): add comprehensive documentation for the platform The application provides a SaaS platform for AI integration with: - Multiple provider support (Ollama, OpenAI, Anthropic, Hugging Face) - Document processing and vector storage - Embedding generation using Hugging Face models - Customizable UI with branding
0 parents  commit 4f5e97d

22 files changed

+2040
-0
lines changed

.env.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# CoderAI Environment Configuration
2+
3+
# OpenAI API Key (Optional)
4+
OPENAI_API_KEY=your_openai_key_here
5+
6+
# Anthropic API Key (Optional)
7+
ANTHROPIC_API_KEY=your_anthropic_key_here
8+
9+
# Hugging Face Token (Optional)
10+
HF_TOKEN=your_huggingface_token_here
11+
12+
# Ollama Configuration
13+
OLLAMA_BASE_URL=http://localhost:11434
14+
15+
# Vector Database Path
16+
VECTOR_DB_PATH=./data/vector_db
17+
18+
# Default Models
19+
DEFAULT_OLLAMA_MODEL=llama2
20+
DEFAULT_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Python virtual environments
2+
.venv/
3+
venv/
4+
env/
5+
ENV/
6+
7+
# Python cache files
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
12+
# Documentation files
13+
CoderAI - Documentation v3.0.docx
14+
15+
# Environment variables
16+
.env
17+
18+
# OS specific files
19+
.DS_Store
20+
Thumbs.db
21+
22+
# IDE specific files
23+
.idea/
24+
.vscode/
25+
*.swp
26+
*.swo
27+
28+
# Distribution / packaging
29+
dist/
30+
build/
31+
*.egg-info/
32+
33+
# Logs
34+
*.log

Logo.png

80.3 KB
Loading

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# CoderAI - AI Integration Platform
2+
3+
CoderAI is a powerful SaaS platform that enables seamless integration with various AI solution providers. This application allows users to:
4+
5+
- Connect to local Ollama models or external AI providers
6+
- Process and analyze documents using state-of-the-art AI models
7+
- Generate embeddings using Hugging Face models
8+
- Create and manage vector databases for semantic search
9+
- Build custom AI workflows with a user-friendly interface
10+
11+
## Features
12+
13+
- **Multi-Provider Integration**: Connect to Ollama, OpenAI, Anthropic, and other AI providers
14+
- **Document Processing**: Upload and analyze documents with AI assistance
15+
- **Vector Database**: Store and search through document embeddings
16+
- **Custom Workflows**: Create tailored AI workflows for specific use cases
17+
- **Analytics Dashboard**: Monitor usage and performance metrics
18+
19+
## Getting Started
20+
21+
1. Install the required dependencies:
22+
```
23+
pip install -r requirements.txt
24+
```
25+
26+
2. Set up your environment variables in a `.env` file:
27+
```
28+
OPENAI_API_KEY=your_openai_key_here (optional)
29+
ANTHROPIC_API_KEY=your_anthropic_key_here (optional)
30+
HF_TOKEN=your_huggingface_token_here (optional)
31+
```
32+
33+
3. Run the application:
34+
```
35+
streamlit run app.py
36+
```
37+
38+
## Requirements
39+
40+
- Python 3.9+
41+
- Ollama installed locally (for local model integration)
42+
- Internet connection (for external API access)
43+
44+
## Project Structure
45+
46+
- `app.py`: Main Streamlit application
47+
- `config.py`: Configuration settings
48+
- `models/`: Model integration modules
49+
- `utils/`: Utility functions
50+
- `components/`: Streamlit UI components
51+
- `services/`: Core services (embedding, vector store, etc.)
52+
- `data/`: Data storage directory

app.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import streamlit as st
2+
import os
3+
from dotenv import load_dotenv
4+
5+
# Import custom modules
6+
from config import AppConfig
7+
from components.sidebar import render_sidebar
8+
from components.main_panel import render_main_panel
9+
from components.provider_config import render_provider_config
10+
from services.model_service import ModelService
11+
from services.embedding_service import EmbeddingService
12+
from services.vector_store_service import VectorStoreService
13+
14+
# Load environment variables
15+
load_dotenv()
16+
17+
# Set page configuration
18+
st.set_page_config(
19+
page_title="CoderAI - AI Integration Platform",
20+
page_icon="🧠",
21+
layout="wide",
22+
initial_sidebar_state="expanded"
23+
)
24+
25+
def initialize_session_state():
26+
"""Initialize session state variables if they don't exist"""
27+
if 'config' not in st.session_state:
28+
st.session_state.config = AppConfig()
29+
30+
if 'model_service' not in st.session_state:
31+
st.session_state.model_service = ModelService()
32+
33+
if 'embedding_service' not in st.session_state:
34+
st.session_state.embedding_service = EmbeddingService()
35+
36+
if 'vector_store' not in st.session_state:
37+
st.session_state.vector_store = VectorStoreService()
38+
39+
if 'current_page' not in st.session_state:
40+
st.session_state.current_page = "Home"
41+
42+
if 'chat_history' not in st.session_state:
43+
st.session_state.chat_history = []
44+
45+
if 'documents' not in st.session_state:
46+
st.session_state.documents = []
47+
48+
if 'providers' not in st.session_state:
49+
st.session_state.providers = {
50+
"ollama": {"active": True, "base_url": "http://localhost:11434"},
51+
"openai": {"active": False, "api_key": os.getenv("OPENAI_API_KEY", "")},
52+
"anthropic": {"active": False, "api_key": os.getenv("ANTHROPIC_API_KEY", "")},
53+
"huggingface": {"active": True, "token": os.getenv("HF_TOKEN", "")}
54+
}
55+
56+
def main():
57+
"""Main application entry point"""
58+
# Initialize session state
59+
initialize_session_state()
60+
61+
# Custom CSS
62+
st.markdown("""
63+
<style>
64+
.main-header {
65+
font-size: 2.5rem;
66+
color: #4B8BF5;
67+
margin-bottom: 0.5rem;
68+
}
69+
.subheader {
70+
font-size: 1.5rem;
71+
color: #5F6368;
72+
margin-bottom: 1.5rem;
73+
}
74+
.stButton button {
75+
background-color: #4B8BF5;
76+
color: white;
77+
border-radius: 5px;
78+
}
79+
.provider-card {
80+
padding: 1.5rem;
81+
border-radius: 10px;
82+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
83+
margin-bottom: 1rem;
84+
}
85+
/* Logo styling */
86+
img {
87+
border-radius: 8px;
88+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
89+
}
90+
/* Header container styling */
91+
.stColumn > div:first-child {
92+
display: flex;
93+
align-items: center;
94+
}
95+
</style>
96+
""", unsafe_allow_html=True)
97+
98+
# Render sidebar
99+
render_sidebar()
100+
101+
# Render main panel based on current page
102+
if st.session_state.current_page == "Home":
103+
render_main_panel()
104+
elif st.session_state.current_page == "Provider Configuration":
105+
render_provider_config()
106+
107+
if __name__ == "__main__":
108+
main()

components/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)