diff --git a/backend/app/main.py b/backend/app/main.py index b8418d1..ce52b2c 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -30,7 +30,12 @@ from app.api.content import router as content_router from app.api.contents import router as contents_router from app.api.clients import router as clients_router from app.api.organization import router as organization_router -from app.api.agents import router as agents_router +# Agent framework router — optional, only if agent_framework module is available +try: + from app.api.agents import router as agents_router + _HAS_AGENT_FRAMEWORK = True +except ImportError: + _HAS_AGENT_FRAMEWORK = False from app.api.knowledge import router as knowledge_router from app.api.distribution import router as distribution_router from app.api.analytics import router as analytics_router @@ -183,7 +188,8 @@ app.include_router(citations_router, prefix="/api/v1/citations", tags=["引用 app.include_router(reports_router, prefix="/api/v1/reports", tags=["报告"]) app.include_router(subscription_router) app.include_router(admin_router) -app.include_router(agents_router, prefix="/api/v1/agents", tags=["Agent管理"]) +if _HAS_AGENT_FRAMEWORK: + app.include_router(agents_router, prefix="/api/v1/agents", tags=["Agent管理"]) app.include_router(lifecycle_router, prefix="/api/v1/lifecycle", tags=["lifecycle"]) app.include_router(knowledge_router, prefix="/api/v1/knowledge", tags=["知识库"]) app.include_router(content_router, prefix="/api/v1/content", tags=["内容生产"]) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index f6d45f5..751f46e 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -97,7 +97,7 @@ services: redis: condition: service_healthy healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/health"] + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s retries: 3 diff --git a/docker-compose.yml b/docker-compose.yml index 3797557..2d91cc6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -71,7 +71,7 @@ services: condition: service_healthy command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/health"] + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s start_period: 30s diff --git a/frontend/lib/api/diagnosis.ts b/frontend/lib/api/diagnosis.ts index 5f6ae79..883b866 100644 --- a/frontend/lib/api/diagnosis.ts +++ b/frontend/lib/api/diagnosis.ts @@ -5,9 +5,13 @@ export const diagnosisApi = { getSEODiagnosis: (token: string, brandId: string) => fetchWithAuth(`/api/v1/diagnosis/seo/${brandId}`, {}, token), + /** 触发GEO诊断(POST,异步任务) */ + triggerGEODiagnosis: (token: string, brandId: string) => + fetchWithAuth(`/api/v1/diagnosis/geo/${brandId}`, { method: "POST" }, token), + /** 获取GEO诊断结果 */ getGEODiagnosis: (token: string, brandId: string) => - fetchWithAuth(`/api/v1/diagnosis/geo/${brandId}`, {}, token), + fetchWithAuth(`/api/v1/diagnosis/geo/${brandId}/result`, {}, token), /** 获取综合诊断结果 */ getCombinedDiagnosis: (token: string, brandId: string) =>