aisbf 0.1.2__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aisbf-0.1.2/aisbf.egg-info → aisbf-0.2.0}/PKG-INFO +1 -1
- {aisbf-0.1.2 → aisbf-0.2.0/aisbf.egg-info}/PKG-INFO +1 -1
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf.egg-info/SOURCES.txt +1 -0
- aisbf-0.2.0/aisbf.sh +153 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/pyproject.toml +1 -1
- {aisbf-0.1.2 → aisbf-0.2.0}/setup.py +10 -141
- {aisbf-0.1.2 → aisbf-0.2.0}/LICENSE.txt +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/MANIFEST.in +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/README.md +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf/__init__.py +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf/config.py +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf/handlers.py +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf/models.py +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf/providers.py +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf.egg-info/dependency_links.txt +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf.egg-info/entry_points.txt +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf.egg-info/requires.txt +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/aisbf.egg-info/top_level.txt +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/config/autoselect.json +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/config/autoselect.md +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/config/providers.json +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/config/rotations.json +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/main.py +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/requirements.txt +0 -0
- {aisbf-0.1.2 → aisbf-0.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aisbf
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations
|
|
5
5
|
Home-page: https://git.nexlab.net/nexlab/aisbf.git
|
|
6
6
|
Author: AISBF Contributors
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aisbf
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations
|
|
5
5
|
Home-page: https://git.nexlab.net/nexlab/aisbf.git
|
|
6
6
|
Author: AISBF Contributors
|
aisbf-0.2.0/aisbf.sh
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
########################################################
|
|
3
|
+
# Copyright (C) 2026 Stefy Lanza <stefy@nexlab.net>
|
|
4
|
+
#
|
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
#
|
|
18
|
+
# Why did the programmer quit his job? Because he didn't get arrays!
|
|
19
|
+
########################################################
|
|
20
|
+
|
|
21
|
+
# AISBF - AI Service Broker Framework || AI Should Be Free
|
|
22
|
+
# This script manages the AISBF server using the installed virtual environment
|
|
23
|
+
|
|
24
|
+
PIDFILE="/tmp/aisbf.pid"
|
|
25
|
+
|
|
26
|
+
# Determine the correct share directory at runtime
|
|
27
|
+
# Check for system installation first (/usr/share/aisbf)
|
|
28
|
+
if [ -d "/usr/share/aisbf" ]; then
|
|
29
|
+
SHARE_DIR="/usr/share/aisbf"
|
|
30
|
+
VENV_DIR="/usr/share/aisbf/venv"
|
|
31
|
+
# Running as root - use /var/log/aisbf
|
|
32
|
+
LOG_DIR="/var/log/aisbf"
|
|
33
|
+
else
|
|
34
|
+
# Fall back to user installation (~/.local/share/aisbf)
|
|
35
|
+
SHARE_DIR="$HOME/.local/share/aisbf"
|
|
36
|
+
VENV_DIR="$HOME/.local/share/aisbf/venv"
|
|
37
|
+
# Running as user - use ~/.local/var/log/aisbf
|
|
38
|
+
LOG_DIR="$HOME/.local/var/log/aisbf"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Create log directory if it doesn't exist
|
|
42
|
+
mkdir -p "$LOG_DIR"
|
|
43
|
+
|
|
44
|
+
# Function to create venv if it doesn't exist
|
|
45
|
+
ensure_venv() {
|
|
46
|
+
if [ ! -d "$VENV_DIR" ]; then
|
|
47
|
+
echo "Creating virtual environment at $VENV_DIR"
|
|
48
|
+
python3 -m venv "$VENV_DIR"
|
|
49
|
+
|
|
50
|
+
# Install requirements if requirements.txt exists
|
|
51
|
+
if [ -f "$SHARE_DIR/requirements.txt" ]; then
|
|
52
|
+
echo "Installing requirements from $SHARE_DIR/requirements.txt"
|
|
53
|
+
"$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Install aisbf package from system site-packages into venv
|
|
57
|
+
# This allows the venv to find the aisbf module
|
|
58
|
+
echo "Installing aisbf package in venv"
|
|
59
|
+
"$VENV_DIR/bin/pip" install aisbf
|
|
60
|
+
fi
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Function to start the server
|
|
64
|
+
start_server() {
|
|
65
|
+
# Ensure venv exists
|
|
66
|
+
ensure_venv
|
|
67
|
+
|
|
68
|
+
# Activate the virtual environment
|
|
69
|
+
source $VENV_DIR/bin/activate
|
|
70
|
+
|
|
71
|
+
# Change to share directory where main.py is located
|
|
72
|
+
cd $SHARE_DIR
|
|
73
|
+
|
|
74
|
+
# Start the proxy server with logging
|
|
75
|
+
uvicorn main:app --host 0.0.0.0 --port 8000 2>&1 | tee -a "$LOG_DIR/aisbf_stdout.log"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# Function to start as daemon
|
|
79
|
+
start_daemon() {
|
|
80
|
+
# Check if already running
|
|
81
|
+
if [ -f "$PIDFILE" ]; then
|
|
82
|
+
PID=$(cat "$PIDFILE")
|
|
83
|
+
if ps -p "$PID" > /dev/null 2>&1; then
|
|
84
|
+
echo "AISBF is already running (PID: $PID)"
|
|
85
|
+
exit 1
|
|
86
|
+
else
|
|
87
|
+
# Stale PID file, remove it
|
|
88
|
+
rm -f "$PIDFILE"
|
|
89
|
+
fi
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# Ensure venv exists
|
|
93
|
+
ensure_venv
|
|
94
|
+
|
|
95
|
+
# Start in background with nohup and logging
|
|
96
|
+
nohup bash -c "source $VENV_DIR/bin/activate && cd $SHARE_DIR && uvicorn main:app --host 0.0.0.0 --port 8000" >> "$LOG_DIR/aisbf_stdout.log" 2>&1 &
|
|
97
|
+
PID=$!
|
|
98
|
+
echo $PID > "$PIDFILE"
|
|
99
|
+
echo "AISBF started in background (PID: $PID)"
|
|
100
|
+
echo "Logs are being written to: $LOG_DIR"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
# Function to check status
|
|
104
|
+
check_status() {
|
|
105
|
+
if [ -f "$PIDFILE" ]; then
|
|
106
|
+
PID=$(cat "$PIDFILE")
|
|
107
|
+
if ps -p "$PID" > /dev/null 2>&1; then
|
|
108
|
+
echo "AISBF is running (PID: $PID)"
|
|
109
|
+
exit 0
|
|
110
|
+
else
|
|
111
|
+
echo "AISBF is not running (stale PID file)"
|
|
112
|
+
rm -f "$PIDFILE"
|
|
113
|
+
exit 1
|
|
114
|
+
fi
|
|
115
|
+
else
|
|
116
|
+
echo "AISBF is not running"
|
|
117
|
+
exit 1
|
|
118
|
+
fi
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
# Function to stop the daemon
|
|
122
|
+
stop_daemon() {
|
|
123
|
+
if [ -f "$PIDFILE" ]; then
|
|
124
|
+
PID=$(cat "$PIDFILE")
|
|
125
|
+
if ps -p "$PID" > /dev/null 2>&1; then
|
|
126
|
+
kill "$PID"
|
|
127
|
+
rm -f "$PIDFILE"
|
|
128
|
+
echo "AISBF stopped (PID: $PID)"
|
|
129
|
+
else
|
|
130
|
+
echo "AISBF is not running (stale PID file)"
|
|
131
|
+
rm -f "$PIDFILE"
|
|
132
|
+
fi
|
|
133
|
+
else
|
|
134
|
+
echo "AISBF is not running"
|
|
135
|
+
fi
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# Main command handling
|
|
139
|
+
case "$1" in
|
|
140
|
+
daemon)
|
|
141
|
+
start_daemon
|
|
142
|
+
;;
|
|
143
|
+
status)
|
|
144
|
+
check_status
|
|
145
|
+
;;
|
|
146
|
+
stop)
|
|
147
|
+
stop_daemon
|
|
148
|
+
;;
|
|
149
|
+
*)
|
|
150
|
+
# Default: start in foreground
|
|
151
|
+
start_server
|
|
152
|
+
;;
|
|
153
|
+
esac
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "aisbf"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "GPL-3.0-or-later"
|
|
@@ -60,162 +60,30 @@ class InstallCommand(_install):
|
|
|
60
60
|
if '--user' in sys.argv or os.geteuid() != 0:
|
|
61
61
|
# User installation - use ~/.local/bin
|
|
62
62
|
bin_dir = Path.home() / '.local' / 'bin'
|
|
63
|
+
share_dir = Path.home() / '.local' / 'share' / 'aisbf'
|
|
63
64
|
else:
|
|
64
65
|
# System installation - use /usr/local/bin
|
|
65
66
|
bin_dir = Path('/usr/local/bin')
|
|
67
|
+
share_dir = Path('/usr/share/aisbf')
|
|
66
68
|
|
|
67
69
|
# Create the bin directory if it doesn't exist
|
|
68
70
|
bin_dir.mkdir(parents=True, exist_ok=True)
|
|
69
71
|
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
script_content = """#!/bin/bash
|
|
73
|
-
# AISBF - AI Service Broker Framework || AI Should Be Free
|
|
74
|
-
# This script manages the AISBF server using the installed virtual environment
|
|
75
|
-
|
|
76
|
-
PIDFILE="/tmp/aisbf.pid"
|
|
77
|
-
|
|
78
|
-
# Determine the correct share directory at runtime
|
|
79
|
-
# Check for system installation first (/usr/share/aisbf)
|
|
80
|
-
if [ -d "/usr/share/aisbf" ]; then
|
|
81
|
-
SHARE_DIR="/usr/share/aisbf"
|
|
82
|
-
VENV_DIR="/usr/share/aisbf/venv"
|
|
83
|
-
# Running as root - use /var/log/aisbf
|
|
84
|
-
LOG_DIR="/var/log/aisbf"
|
|
85
|
-
else
|
|
86
|
-
# Fall back to user installation (~/.local/share/aisbf)
|
|
87
|
-
SHARE_DIR="$HOME/.local/share/aisbf"
|
|
88
|
-
VENV_DIR="$HOME/.local/share/aisbf/venv"
|
|
89
|
-
# Running as user - use ~/.local/var/log/aisbf
|
|
90
|
-
LOG_DIR="$HOME/.local/var/log/aisbf"
|
|
91
|
-
fi
|
|
92
|
-
|
|
93
|
-
# Create log directory if it doesn't exist
|
|
94
|
-
mkdir -p "$LOG_DIR"
|
|
95
|
-
|
|
96
|
-
# Function to create venv if it doesn't exist
|
|
97
|
-
ensure_venv() {
|
|
98
|
-
if [ ! -d "$VENV_DIR" ]; then
|
|
99
|
-
echo "Creating virtual environment at $VENV_DIR"
|
|
100
|
-
python3 -m venv "$VENV_DIR"
|
|
101
|
-
|
|
102
|
-
# Install requirements if requirements.txt exists
|
|
103
|
-
if [ -f "$SHARE_DIR/requirements.txt" ]; then
|
|
104
|
-
echo "Installing requirements from $SHARE_DIR/requirements.txt"
|
|
105
|
-
"$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt"
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
# Install aisbf package from system site-packages into venv
|
|
109
|
-
# This allows the venv to find the aisbf module
|
|
110
|
-
echo "Installing aisbf package in venv"
|
|
111
|
-
"$VENV_DIR/bin/pip" install aisbf
|
|
112
|
-
fi
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
# Function to start the server
|
|
116
|
-
start_server() {
|
|
117
|
-
# Ensure venv exists
|
|
118
|
-
ensure_venv
|
|
119
|
-
|
|
120
|
-
# Activate the virtual environment
|
|
121
|
-
source $VENV_DIR/bin/activate
|
|
122
|
-
|
|
123
|
-
# Change to share directory where main.py is located
|
|
124
|
-
cd $SHARE_DIR
|
|
125
|
-
|
|
126
|
-
# Start the proxy server with logging
|
|
127
|
-
uvicorn main:app --host 0.0.0.0 --port 8000 2>&1 | tee -a "$LOG_DIR/aisbf_stdout.log"
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
# Function to start as daemon
|
|
131
|
-
start_daemon() {
|
|
132
|
-
# Check if already running
|
|
133
|
-
if [ -f "$PIDFILE" ]; then
|
|
134
|
-
PID=$(cat "$PIDFILE")
|
|
135
|
-
if ps -p "$PID" > /dev/null 2>&1; then
|
|
136
|
-
echo "AISBF is already running (PID: $PID)"
|
|
137
|
-
exit 1
|
|
138
|
-
else
|
|
139
|
-
# Stale PID file, remove it
|
|
140
|
-
rm -f "$PIDFILE"
|
|
141
|
-
fi
|
|
142
|
-
fi
|
|
143
|
-
|
|
144
|
-
# Ensure venv exists
|
|
145
|
-
ensure_venv
|
|
146
|
-
|
|
147
|
-
# Start in background with nohup and logging
|
|
148
|
-
nohup bash -c "source $VENV_DIR/bin/activate && cd $SHARE_DIR && uvicorn main:app --host 0.0.0.0 --port 8000" >> "$LOG_DIR/aisbf_stdout.log" 2>&1 &
|
|
149
|
-
PID=$!
|
|
150
|
-
echo $PID > "$PIDFILE"
|
|
151
|
-
echo "AISBF started in background (PID: $PID)"
|
|
152
|
-
echo "Logs are being written to: $LOG_DIR"
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
# Function to check status
|
|
156
|
-
check_status() {
|
|
157
|
-
if [ -f "$PIDFILE" ]; then
|
|
158
|
-
PID=$(cat "$PIDFILE")
|
|
159
|
-
if ps -p "$PID" > /dev/null 2>&1; then
|
|
160
|
-
echo "AISBF is running (PID: $PID)"
|
|
161
|
-
exit 0
|
|
162
|
-
else
|
|
163
|
-
echo "AISBF is not running (stale PID file)"
|
|
164
|
-
rm -f "$PIDFILE"
|
|
165
|
-
exit 1
|
|
166
|
-
fi
|
|
167
|
-
else
|
|
168
|
-
echo "AISBF is not running"
|
|
169
|
-
exit 1
|
|
170
|
-
fi
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
# Function to stop the daemon
|
|
174
|
-
stop_daemon() {
|
|
175
|
-
if [ -f "$PIDFILE" ]; then
|
|
176
|
-
PID=$(cat "$PIDFILE")
|
|
177
|
-
if ps -p "$PID" > /dev/null 2>&1; then
|
|
178
|
-
kill "$PID"
|
|
179
|
-
rm -f "$PIDFILE"
|
|
180
|
-
echo "AISBF stopped (PID: $PID)"
|
|
181
|
-
else
|
|
182
|
-
echo "AISBF is not running (stale PID file)"
|
|
183
|
-
rm -f "$PIDFILE"
|
|
184
|
-
fi
|
|
185
|
-
else
|
|
186
|
-
echo "AISBF is not running"
|
|
187
|
-
fi
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
# Main command handling
|
|
191
|
-
case "$1" in
|
|
192
|
-
daemon)
|
|
193
|
-
start_daemon
|
|
194
|
-
;;
|
|
195
|
-
status)
|
|
196
|
-
check_status
|
|
197
|
-
;;
|
|
198
|
-
stop)
|
|
199
|
-
stop_daemon
|
|
200
|
-
;;
|
|
201
|
-
*)
|
|
202
|
-
# Default: start in foreground
|
|
203
|
-
start_server
|
|
204
|
-
;;
|
|
205
|
-
esac
|
|
206
|
-
"""
|
|
207
|
-
|
|
72
|
+
# Copy the aisbf.sh script from the share directory to the bin directory
|
|
73
|
+
src = share_dir / 'aisbf.sh'
|
|
208
74
|
dst = bin_dir / 'aisbf'
|
|
209
75
|
|
|
210
|
-
|
|
211
|
-
|
|
76
|
+
# Copy the script
|
|
77
|
+
import shutil
|
|
78
|
+
shutil.copy(src, dst)
|
|
212
79
|
|
|
80
|
+
# Make it executable
|
|
213
81
|
os.chmod(dst, 0o755)
|
|
214
82
|
print(f"Installed 'aisbf' script to {dst}")
|
|
215
83
|
|
|
216
84
|
setup(
|
|
217
85
|
name="aisbf",
|
|
218
|
-
version="0.
|
|
86
|
+
version="0.2.0",
|
|
219
87
|
author="AISBF Contributors",
|
|
220
88
|
author_email="stefy@nexlab.net",
|
|
221
89
|
description="AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations",
|
|
@@ -247,6 +115,7 @@ setup(
|
|
|
247
115
|
('share/aisbf', [
|
|
248
116
|
'main.py',
|
|
249
117
|
'requirements.txt',
|
|
118
|
+
'aisbf.sh',
|
|
250
119
|
'config/providers.json',
|
|
251
120
|
'config/rotations.json',
|
|
252
121
|
'config/autoselect.json',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|