fix: core flow prerequisites - diagnosis API, healthcheck, agent framework optional

- Fix frontend diagnosis.ts: add triggerGEODiagnosis (POST), fix getGEODiagnosis to use /result endpoint
- Make agents_router conditionally registered (agent_framework optional)
- Replace curl with Python urllib in Docker healthcheck (no curl dependency)
This commit is contained in:
chiguyong 2026-06-05 17:41:42 +08:00
parent 106f0b9a24
commit 903803c09a
4 changed files with 15 additions and 5 deletions

View File

@ -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.contents import router as contents_router
from app.api.clients import router as clients_router from app.api.clients import router as clients_router
from app.api.organization import router as organization_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.knowledge import router as knowledge_router
from app.api.distribution import router as distribution_router from app.api.distribution import router as distribution_router
from app.api.analytics import router as analytics_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(reports_router, prefix="/api/v1/reports", tags=["报告"])
app.include_router(subscription_router) app.include_router(subscription_router)
app.include_router(admin_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(lifecycle_router, prefix="/api/v1/lifecycle", tags=["lifecycle"])
app.include_router(knowledge_router, prefix="/api/v1/knowledge", tags=["知识库"]) app.include_router(knowledge_router, prefix="/api/v1/knowledge", tags=["知识库"])
app.include_router(content_router, prefix="/api/v1/content", tags=["内容生产"]) app.include_router(content_router, prefix="/api/v1/content", tags=["内容生产"])

View File

@ -97,7 +97,7 @@ services:
redis: redis:
condition: service_healthy condition: service_healthy
healthcheck: 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 interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3

View File

@ -71,7 +71,7 @@ services:
condition: service_healthy condition: service_healthy
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
healthcheck: 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 interval: 30s
timeout: 10s timeout: 10s
start_period: 30s start_period: 30s

View File

@ -5,9 +5,13 @@ export const diagnosisApi = {
getSEODiagnosis: (token: string, brandId: string) => getSEODiagnosis: (token: string, brandId: string) =>
fetchWithAuth(`/api/v1/diagnosis/seo/${brandId}`, {}, token), fetchWithAuth(`/api/v1/diagnosis/seo/${brandId}`, {}, token),
/** 触发GEO诊断POST异步任务 */
triggerGEODiagnosis: (token: string, brandId: string) =>
fetchWithAuth(`/api/v1/diagnosis/geo/${brandId}`, { method: "POST" }, token),
/** 获取GEO诊断结果 */ /** 获取GEO诊断结果 */
getGEODiagnosis: (token: string, brandId: string) => 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) => getCombinedDiagnosis: (token: string, brandId: string) =>