GitHub Action
commited on
Commit
Β·
17afe48
1
Parent(s):
41f215f
π Auto-deploy from GitHub Actions
Browse files- .devcontainer/devcontainer.json +46 -0
- .devcontainer/postCreate.sh +88 -0
- .devcontainer/postStart.sh +35 -0
- requirements.txt +41 -46
.devcontainer/devcontainer.json
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "FastAPI Django Main Live",
|
3 |
+
"image": "mcr.microsoft.com/devcontainers/python:3.11",
|
4 |
+
"features": {
|
5 |
+
"ghcr.io/devcontainers/features/node:1": {
|
6 |
+
"version": "18"
|
7 |
+
},
|
8 |
+
"ghcr.io/devcontainers/features/git:1": {},
|
9 |
+
"ghcr.io/devcontainers/features/github-cli:1": {}
|
10 |
+
},
|
11 |
+
"postCreateCommand": ".devcontainer/postCreate.sh",
|
12 |
+
"postStartCommand": ".devcontainer/postStart.sh",
|
13 |
+
"forwardPorts": [7860, 7861, 5678],
|
14 |
+
"portsAttributes": {
|
15 |
+
"7860": {
|
16 |
+
"label": "FastAPI Django Main App",
|
17 |
+
"onAutoForward": "notify"
|
18 |
+
},
|
19 |
+
"7861": {
|
20 |
+
"label": "Test Prompt Manager",
|
21 |
+
"onAutoForward": "silent"
|
22 |
+
},
|
23 |
+
"5678": {
|
24 |
+
"label": "Python Debug Server",
|
25 |
+
"onAutoForward": "silent"
|
26 |
+
}
|
27 |
+
},
|
28 |
+
"customizations": {
|
29 |
+
"vscode": {
|
30 |
+
"extensions": [
|
31 |
+
"ms-python.python",
|
32 |
+
"ms-python.debugpy",
|
33 |
+
"bradlc.vscode-tailwindcss",
|
34 |
+
"ms-vscode.vscode-json",
|
35 |
+
"esbenp.prettier-vscode",
|
36 |
+
"ms-vscode.vscode-typescript-next"
|
37 |
+
],
|
38 |
+
"settings": {
|
39 |
+
"python.defaultInterpreterPath": "/usr/local/bin/python",
|
40 |
+
"python.terminal.activateEnvironment": false,
|
41 |
+
"terminal.integrated.shell.linux": "/bin/bash"
|
42 |
+
}
|
43 |
+
}
|
44 |
+
},
|
45 |
+
"remoteUser": "vscode"
|
46 |
+
}
|
.devcontainer/postCreate.sh
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo "π FastAPI Django Main Live - Post Create Setup Starting..."
|
4 |
+
|
5 |
+
# Update system packages
|
6 |
+
sudo apt-get update
|
7 |
+
|
8 |
+
# Install Rust (for tiktoken and other dependencies)
|
9 |
+
echo "π¦ Installing Rust..."
|
10 |
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
11 |
+
source ~/.cargo/env
|
12 |
+
|
13 |
+
# Install Python dependencies
|
14 |
+
echo "π Installing Python dependencies..."
|
15 |
+
pip install --upgrade pip setuptools wheel
|
16 |
+
|
17 |
+
# Install requirements with better error handling
|
18 |
+
echo "π Installing from requirements.txt..."
|
19 |
+
pip install -r requirements.txt
|
20 |
+
|
21 |
+
# Install additional dependencies for debugging
|
22 |
+
echo "π§ Installing debug dependencies..."
|
23 |
+
pip install debugpy python-dotenv
|
24 |
+
|
25 |
+
# Set up environment files
|
26 |
+
echo "βοΈ Setting up environment..."
|
27 |
+
if [ ! -f .env ]; then
|
28 |
+
cp .env.example .env 2>/dev/null || echo "GROQ_API_KEY=your_key_here
|
29 |
+
OPENINTERPRETER_PASSWORD=your_password_here" > .env
|
30 |
+
echo "π .env file created - please update with your API keys"
|
31 |
+
fi
|
32 |
+
|
33 |
+
# Initialize databases
|
34 |
+
echo "ποΈ Initializing databases..."
|
35 |
+
python3 -c "
|
36 |
+
import sqlite3
|
37 |
+
import os
|
38 |
+
|
39 |
+
# Create prompts database
|
40 |
+
if not os.path.exists('prompts.db'):
|
41 |
+
conn = sqlite3.connect('prompts.db')
|
42 |
+
cursor = conn.cursor()
|
43 |
+
cursor.execute('''
|
44 |
+
CREATE TABLE IF NOT EXISTS prompts (
|
45 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
46 |
+
title TEXT NOT NULL,
|
47 |
+
url TEXT,
|
48 |
+
content TEXT NOT NULL,
|
49 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
50 |
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
51 |
+
)
|
52 |
+
''')
|
53 |
+
conn.commit()
|
54 |
+
conn.close()
|
55 |
+
print('β
Prompts database initialized')
|
56 |
+
|
57 |
+
# Create chat history database
|
58 |
+
if not os.path.exists('chat_history.db'):
|
59 |
+
conn = sqlite3.connect('chat_history.db')
|
60 |
+
cursor = conn.cursor()
|
61 |
+
cursor.execute('''
|
62 |
+
CREATE TABLE IF NOT EXISTS history (
|
63 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
64 |
+
role TEXT NOT NULL,
|
65 |
+
type TEXT,
|
66 |
+
content TEXT NOT NULL,
|
67 |
+
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
68 |
+
)
|
69 |
+
''')
|
70 |
+
conn.commit()
|
71 |
+
conn.close()
|
72 |
+
print('β
Chat history database initialized')
|
73 |
+
"
|
74 |
+
|
75 |
+
# Set proper permissions
|
76 |
+
chmod +x .devcontainer/*.sh
|
77 |
+
|
78 |
+
echo "β
FastAPI Django Main Live setup completed!"
|
79 |
+
echo ""
|
80 |
+
echo "π― Next steps:"
|
81 |
+
echo "1. Update .env file with your API keys"
|
82 |
+
echo "2. Run: python3 app.py"
|
83 |
+
echo "3. Access: http://localhost:7860"
|
84 |
+
echo ""
|
85 |
+
echo "π For debugging:"
|
86 |
+
echo "1. Run: python3 app_debug_server.py"
|
87 |
+
echo "2. Use VS Code 'Remote Attach' configuration"
|
88 |
+
echo ""
|
.devcontainer/postStart.sh
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo "π FastAPI Django Main Live - Post Start Setup..."
|
4 |
+
|
5 |
+
# Ensure Rust is in PATH
|
6 |
+
export PATH="$HOME/.cargo/bin:$PATH"
|
7 |
+
|
8 |
+
# Check if all dependencies are installed
|
9 |
+
echo "π Checking dependencies..."
|
10 |
+
python3 -c "
|
11 |
+
try:
|
12 |
+
import gradio
|
13 |
+
import fastapi
|
14 |
+
import open_interpreter
|
15 |
+
import sqlite3
|
16 |
+
print('β
All core dependencies available')
|
17 |
+
except ImportError as e:
|
18 |
+
print(f'β Missing dependency: {e}')
|
19 |
+
print('Run: pip install -r requirements.txt')
|
20 |
+
"
|
21 |
+
|
22 |
+
# Display helpful information
|
23 |
+
echo ""
|
24 |
+
echo "π FastAPI Django Main Live is ready!"
|
25 |
+
echo ""
|
26 |
+
echo "π± Available services:"
|
27 |
+
echo " β’ Main App: http://localhost:7860"
|
28 |
+
echo " β’ Test Manager: http://localhost:7861"
|
29 |
+
echo " β’ Debug Port: 5678"
|
30 |
+
echo ""
|
31 |
+
echo "π οΈ Quick commands:"
|
32 |
+
echo " β’ Start main app: python3 app.py"
|
33 |
+
echo " β’ Start debug mode: python3 app_debug_server.py"
|
34 |
+
echo " β’ Test prompt manager: python3 test_prompt_manager.py"
|
35 |
+
echo ""
|
requirements.txt
CHANGED
@@ -1,54 +1,49 @@
|
|
1 |
-
|
|
|
|
|
2 |
gradio==4.31.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
open-interpreter
|
4 |
-
|
5 |
-
annotated-types==0.6.0; python_version >= '3.8'
|
6 |
-
anyio==4.3.0; python_version >= '3.8'
|
7 |
-
async-timeout==4.0.3; python_version >= '3.7'
|
8 |
-
certifi==2024.2.2; python_version >= '3.6'
|
9 |
-
click==8.1.7; python_version >= '3.7'
|
10 |
-
distro==1.9.0; python_version >= '3.6'
|
11 |
-
fastapi==0.110.0; python_version >= '3.8'
|
12 |
-
groq==0.4.1; python_version >= '3.7'
|
13 |
-
h11==0.14.0; python_version >= '3.7'
|
14 |
-
httpcore==1.0.4; python_version >= '3.8'
|
15 |
-
httpx==0.27.0; python_version >= '3.8'
|
16 |
-
idna==3.6; python_version >= '3.5'
|
17 |
-
pydantic==2.6.2; python_version >= '3.8'
|
18 |
-
pydantic-core==2.16.3; python_version >= '3.8'
|
19 |
-
sniffio==1.3.1; python_version >= '3.7'
|
20 |
-
sse-starlette==2.0.0; python_version >= '3.8'
|
21 |
-
starlette==0.36.3; python_version >= '3.8'
|
22 |
-
typing-extensions==4.10.0; python_version >= '3.8'
|
23 |
-
uvicorn==0.27.1; python_version >= '3.8'
|
24 |
-
duckdb
|
25 |
-
annotated-types==0.6.0 ; python_version >= "3.10" and python_version < "4.0"
|
26 |
-
anyio==4.3.0 ; python_version >= "3.10" and python_version < "4.0"
|
27 |
-
asgiref==3.8.1 ; python_version >= "3.10" and python_version < "4.0"
|
28 |
-
click==8.1.7 ; python_version >= "3.10" and python_version < "4.0"
|
29 |
-
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
|
30 |
-
django==5.0.4 ; python_version >= "3.10" and python_version < "4.0"
|
31 |
-
exceptiongroup==1.2.0 ; python_version >= "3.10" and python_version < "3.11"
|
32 |
-
h11==0.14.0 ; python_version >= "3.10" and python_version < "4.0"
|
33 |
-
idna ; python_version >= "3.10" and python_version < "4.0"
|
34 |
-
#psycopg2==2.9.9 ; python_version >= "3.10" and python_version < "4.0"
|
35 |
-
pydantic-core==2.16.3 ; python_version >= "3.10" and python_version < "4.0"
|
36 |
-
#pydantic==2.6.4 ; python_version >= "3.10" and python_version < "4.0"
|
37 |
-
sniffio==1.3.1 ; python_version >= "3.10" and python_version < "4.0"
|
38 |
-
sqlparse==0.5.0 ; python_version >= "3.10" and python_version < "4.0"
|
39 |
-
starlette ; python_version >= "3.10" and python_version < "4.0"
|
40 |
-
typing-extensions ; python_version >= "3.10" and python_version < "4.0"
|
41 |
-
tzdata==2024.1 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "win32"
|
42 |
-
uvloop==0.19.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "win32"
|
43 |
-
whitenoise==6.6.0 ; python_version >= "3.10" and python_version < "4.0"
|
44 |
llamafactory
|
45 |
-
|
46 |
-
aiofiles
|
47 |
diffusers
|
|
|
|
|
|
|
48 |
psycopg2-binary
|
49 |
-
|
50 |
-
#
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
huggingface-hub
|
53 |
imageio[ffmpeg]
|
54 |
torch
|
|
|
1 |
+
# Core dependencies
|
2 |
+
fastapi==0.110.0
|
3 |
+
uvicorn==0.27.1
|
4 |
gradio==4.31.5
|
5 |
+
starlette==0.36.3
|
6 |
+
pydantic==2.6.2
|
7 |
+
pydantic-core==2.16.3
|
8 |
+
|
9 |
+
# Django
|
10 |
+
django==5.0.4
|
11 |
+
asgiref==3.8.1
|
12 |
+
sqlparse==0.5.0
|
13 |
+
whitenoise==6.6.0
|
14 |
+
|
15 |
+
# AI & ML
|
16 |
open-interpreter
|
17 |
+
groq==0.4.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
llamafactory
|
19 |
+
accelerate
|
|
|
20 |
diffusers
|
21 |
+
|
22 |
+
# Database
|
23 |
+
duckdb
|
24 |
psycopg2-binary
|
25 |
+
|
26 |
+
# Utilities
|
27 |
+
python-dotenv
|
28 |
+
jinja2
|
29 |
+
aiofiles
|
30 |
+
click==8.1.7
|
31 |
+
annotated-types==0.6.0
|
32 |
+
anyio==4.3.0
|
33 |
+
async-timeout==4.0.3
|
34 |
+
certifi==2024.2.2
|
35 |
+
distro==1.9.0
|
36 |
+
h11==0.14.0
|
37 |
+
httpcore==1.0.4
|
38 |
+
httpx==0.27.0
|
39 |
+
idna==3.6
|
40 |
+
sniffio==1.3.1
|
41 |
+
sse-starlette==2.0.0
|
42 |
+
typing-extensions==4.10.0
|
43 |
+
colorama==0.4.6
|
44 |
+
exceptiongroup==1.2.0
|
45 |
+
tzdata==2024.1
|
46 |
+
uvloop==0.19.0
|
47 |
huggingface-hub
|
48 |
imageio[ffmpeg]
|
49 |
torch
|