feat: add openai-compatible model gateway

This commit is contained in:
hailin
2026-07-14 13:44:55 +08:00
parent 13b0768dfd
commit 11bab3e98f
22 changed files with 940 additions and 4 deletions

View File

@@ -1 +1,3 @@
from config.celery import app as celery_app
__all__ = ("celery_app",)

View File

@@ -21,6 +21,7 @@ INSTALLED_APPS = [
"apps.tickets",
"apps.solutions",
"apps.knowledge",
"apps.modelhub",
]
MIDDLEWARE = [
@@ -90,3 +91,13 @@ DJANGO_SUPERUSER_EMAIL = os.getenv("DJANGO_SUPERUSER_EMAIL", "admin@example.com"
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL", "redis://localhost:6379/0")
CELERY_RESULT_BACKEND = os.getenv("CELERY_RESULT_BACKEND", "redis://localhost:6379/1")
AI_CREDENTIAL_ENCRYPTION_KEY = os.getenv("AI_CREDENTIAL_ENCRYPTION_KEY", "")
AI_RUN_RETENTION_DAYS = int(os.getenv("AI_RUN_RETENTION_DAYS", "90"))
CELERY_BEAT_SCHEDULE = {
"cleanup-expired-agent-runs": {
"task": "apps.agents.tasks.cleanup_expired_agent_runs",
"schedule": 86400.0,
}
}

View File

@@ -10,3 +10,7 @@ DATABASES = {
PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
]
AI_CREDENTIAL_ENCRYPTION_KEY = "t8XuQv9e8WDoFv7RXT4-zdw1hQChGFKtr7E6ccRZAzU="
CELERY_TASK_ALWAYS_EAGER = True
CELERY_TASK_EAGER_PROPAGATES = True

View File

@@ -5,6 +5,7 @@ from ninja import NinjaAPI
from apps.accounts.api import router as accounts_router
from apps.audit.api import router as audit_router
from apps.knowledge.api import router as knowledge_router
from apps.modelhub.api import router as modelhub_router
from apps.solutions.api import router as solutions_router
from apps.system.api import router as system_router
from apps.tickets.api import router as tickets_router
@@ -16,6 +17,7 @@ api.add_router("/audit", audit_router)
api.add_router("/tickets", tickets_router)
api.add_router("/solutions", solutions_router)
api.add_router("/knowledge", knowledge_router)
api.add_router("/modelhub", modelhub_router)
urlpatterns = [
path("admin/", admin.site.urls),