代码提交
This commit is contained in:
1 parent
27e6b0b23e
commit
d7ad0624b7
36 files changed
+2194
-287
No files matched your search
@@ -78,6 +78,8 @@ from app.gateway.routers import (
|
||||
system_settings,
|
||||
tags,
|
||||
task_buttons,
|
||||
taskcop_tasks,
|
||||
task_reports,
|
||||
thread_runs,
|
||||
tool_metrics,
|
||||
thread_shares,
|
||||
@@ -85,6 +87,7 @@ from app.gateway.routers import (
|
||||
uploads,
|
||||
user_preferences,
|
||||
user_prompts,
|
||||
weknora_sources,
|
||||
writing,
|
||||
)
|
||||
from deerflow.config import app_config as deerflow_app_config
|
||||
@@ -1329,6 +1332,12 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
|
||||
cors_origins_env = os.environ.get("GATEWAY_CORS_ORIGINS", "").strip()
|
||||
cors_origins: list[str] = [o.strip() for o in cors_origins_env.split(",") if o.strip()] if cors_origins_env else []
|
||||
# The standalone TaskCOP Vue UI is served on a separate Vite dev server and
|
||||
# calls the Gateway directly via b1ConsumerUrl. Keep these local origins in
|
||||
# the Gateway policy even when another frontend has set CORS origins.
|
||||
taskcop_vite_origins = ["http://localhost:8080", "http://127.0.0.1:8080"]
|
||||
if cors_origins:
|
||||
cors_origins = list(dict.fromkeys([*cors_origins, *taskcop_vite_origins]))
|
||||
|
||||
# Headers the LangGraph SDK / browser clients need to read from cross-origin
|
||||
# responses. Without exposing them, the SDK's `response.headers.get(...)` returns
|
||||
@@ -1341,6 +1350,18 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
"X-Thread-Id",
|
||||
]
|
||||
|
||||
# Public pages (e.g. http://47.x.x.x:7010) calling this Gateway on localhost
|
||||
# trigger Chrome/Edge Private Network Access preflights. Without
|
||||
# allow_private_network=True the browser reports a generic CORS failure even
|
||||
# when Access-Control-Allow-Origin is correct.
|
||||
cors_kwargs = {
|
||||
"allow_credentials": True,
|
||||
"allow_methods": ["*"],
|
||||
"allow_headers": ["*"],
|
||||
"expose_headers": cors_expose_headers,
|
||||
"allow_private_network": True,
|
||||
}
|
||||
|
||||
if _cors_allow_any_origin():
|
||||
logger.warning(
|
||||
"Permissive CORS enabled ? any Origin is echoed back (GATEWAY_CORS_ALLOW_ALL or "
|
||||
@@ -1351,10 +1372,7 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
allow_origins=[],
|
||||
# fullmatch() on the Origin header; browsers send scheme://host[:port]
|
||||
allow_origin_regex=r".+",
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
expose_headers=cors_expose_headers,
|
||||
**cors_kwargs,
|
||||
)
|
||||
elif cors_origins:
|
||||
if "*" in cors_origins:
|
||||
@@ -1367,10 +1385,7 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=cors_origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
expose_headers=cors_expose_headers,
|
||||
**cors_kwargs,
|
||||
)
|
||||
else:
|
||||
# Safe-by-default fallback for local frontend development. Without any CORS
|
||||
@@ -1381,6 +1396,7 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
"http://127.0.0.1:5173",
|
||||
"http://localhost:5174",
|
||||
"http://127.0.0.1:5174",
|
||||
*taskcop_vite_origins,
|
||||
"http://localhost:3000",
|
||||
"http://127.0.0.1:3000",
|
||||
]
|
||||
@@ -1392,10 +1408,7 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=dev_origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
expose_headers=cors_expose_headers,
|
||||
**cors_kwargs,
|
||||
)
|
||||
|
||||
# Include routers
|
||||
@@ -1405,6 +1418,9 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
# MCP API is mounted at /api/mcp
|
||||
app.include_router(mcp.router)
|
||||
|
||||
# Authenticated source-context proxy for the WeKnora retrieval skill.
|
||||
app.include_router(weknora_sources.router)
|
||||
|
||||
# Memory API is mounted at /api/memory
|
||||
app.include_router(memory.router)
|
||||
|
||||
@@ -1467,6 +1483,12 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
|
||||
# Task-workspace configurable jump buttons (按钮管理) at /api/task-buttons
|
||||
app.include_router(task_buttons.router)
|
||||
|
||||
# Temporary compatibility bridge for the TaskCOP situation-overview frontend.
|
||||
app.include_router(taskcop_tasks.router)
|
||||
|
||||
# Task-scoped situation-report details used by dashboard drawing / task gates.
|
||||
app.include_router(task_reports.router)
|
||||
|
||||
# Standalone parallel multi-agent panel: fan-out streaming + saved tasks
|
||||
app.include_router(parallel_agents.router)
|
||||
app.include_router(parallel_agent_tasks.router)
|
||||
|
||||
Reference in new issue
Block a user