Feat: tenant llm provider (#14595)

### What problem does this PR solve?

Python implementation of the Go-based model_provider API suite.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: bill <yibie_jingnian@163.com>
This commit is contained in:
Lynn
2026-05-29 17:39:41 +08:00
committed by GitHub
parent b79f79d9b9
commit dc4b82523b
148 changed files with 6059 additions and 3075 deletions

View File

@@ -16,6 +16,7 @@ function usage() {
echo " --disable-datasync Disables synchronization of datasource workers."
echo " --enable-mcpserver Enables the MCP server."
echo " --enable-adminserver Enables the Admin server."
echo " --init-model-provider-tables Run model provider table migrations and exit."
echo " --init-superuser Initializes the superuser."
echo " --consumer-no-beg=<num> Start range for consumers (if using range-based)."
echo " --consumer-no-end=<num> End range for consumers (if using range-based)."
@@ -38,6 +39,7 @@ ENABLE_DATASYNC=1
ENABLE_MCP_SERVER=0
ENABLE_ADMIN_SERVER=0 # Default close admin server
INIT_SUPERUSER_ARGS="" # Default to not initialize superuser
INIT_MODEL_PROVIDER_TABLES=0
CONSUMER_NO_BEG=0
CONSUMER_NO_END=0
WORKERS=1
@@ -89,6 +91,10 @@ for arg in "$@"; do
ENABLE_ADMIN_SERVER=1
shift
;;
--init-model-provider-tables)
INIT_MODEL_PROVIDER_TABLES=1
shift
;;
--init-superuser)
INIT_SUPERUSER_ARGS="--init-superuser"
shift
@@ -266,6 +272,14 @@ function wait_for_server() {
ensure_docling
ensure_db_init
if [[ "${INIT_MODEL_PROVIDER_TABLES}" -eq 1 ]]; then
echo "Running model provider table migrations..."
"$PY" tools/scripts/mysql_migration.py --stages tenant_model_provider --config conf/service_conf.yaml --execute
"$PY" tools/scripts/mysql_migration.py --stages tenant_model_instance --config conf/service_conf.yaml --execute
"$PY" tools/scripts/mysql_migration.py --stages tenant_model --config conf/service_conf.yaml --execute
echo "Model provider table migrations completed."
fi
if [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; then
echo "Starting nginx..."
/usr/sbin/nginx
@@ -280,7 +294,7 @@ if [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; then
if [[ "${API_PROXY_SCHEME}" == "hybrid" ]]; then
while true; do
echo "Attempt to start RAGFlow go server..."
wait_for_server "http://127.0.0.1:9380/healthz" "ragflow_server"
wait_for_server "http://127.0.0.1:9380/api/v1/system/healthz" "ragflow_server"
echo "Starting RAGFlow go server..."
bin/server_main
sleep 1;