Merge branch 'ji' into master
This commit is contained in:
commit
49d9ced04f
84 files changed
+13258
-662
No files matched your search
+68
-21
@@ -11,10 +11,15 @@ blocking, making a unified file safe for both workloads. Writers
|
||||
that contend for the lock wait via the default 5-second sqlite3
|
||||
busy timeout rather than failing immediately.
|
||||
|
||||
Postgres mode: both use the same database URL but maintain independent
|
||||
connection pools with different lifecycles.
|
||||
|
||||
MySQL mode: application ORM data uses MySQL. LangGraph's checkpointer does
|
||||
Postgres mode: both use the same database URL but maintain independent
|
||||
connection pools with different lifecycles.
|
||||
|
||||
Gauss mode: application ORM data uses the official openGauss SQLAlchemy
|
||||
dialect over asyncpg. LangGraph's PostgreSQL checkpointer is intentionally not
|
||||
reused for GaussDB; configure the legacy ``checkpointer:`` section separately
|
||||
(normally sqlite).
|
||||
|
||||
MySQL mode: application ORM data uses MySQL. LangGraph's checkpointer does
|
||||
not have a built-in MySQL backend in this project, so deployments that choose
|
||||
MySQL for business tables should configure the legacy ``checkpointer:``
|
||||
section separately (usually sqlite) to preserve conversation checkpoints.
|
||||
@@ -42,24 +47,40 @@ from typing import Literal
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class DatabaseConfig(BaseModel):
|
||||
backend: Literal["memory", "sqlite", "postgres", "mysql"] = Field(
|
||||
default="memory",
|
||||
description=("Storage backend for application data. 'memory' for development (no persistence across restarts), 'sqlite' for single-node deployment, 'postgres' for production multi-node deployment, 'mysql' for MySQL-backed business tables."),
|
||||
class DatabaseConfig(BaseModel):
|
||||
backend: Literal["memory", "sqlite", "postgres", "gauss", "mysql"] = Field(
|
||||
default="memory",
|
||||
description=(
|
||||
"Storage backend for application data. 'memory' for development "
|
||||
"(no persistence across restarts), 'sqlite' for single-node "
|
||||
"deployment, 'postgres' for production multi-node deployment, "
|
||||
"'gauss' for openGauss/GaussDB business tables, and 'mysql' for "
|
||||
"MySQL-backed business tables."
|
||||
),
|
||||
)
|
||||
sqlite_dir: str = Field(
|
||||
default=".deer-flow/data",
|
||||
description=("Directory for the SQLite database file. Both checkpointer and application data share {sqlite_dir}/deerflow.db."),
|
||||
)
|
||||
postgres_url: str = Field(
|
||||
postgres_url: str = Field(
|
||||
default="",
|
||||
description=(
|
||||
"PostgreSQL connection URL, shared by checkpointer and app. "
|
||||
"Use $DATABASE_URL in config.yaml to reference .env. "
|
||||
"Example: postgresql://user:pass@host:5432/deerflow "
|
||||
"(the +asyncpg driver suffix is added automatically where needed)."
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
gauss_url: str = Field(
|
||||
default="",
|
||||
description=(
|
||||
"openGauss/GaussDB connection URL for the application ORM. "
|
||||
"Use $GAUSS_DATABASE_URL in config.yaml to reference .env. "
|
||||
"Example: opengauss+asyncpg://user:pass@host:26000/deerflow. "
|
||||
"Plain opengauss:// or PostgreSQL-style URLs are normalized to the "
|
||||
"official asynchronous openGauss SQLAlchemy dialect."
|
||||
),
|
||||
)
|
||||
mysql_url: str = Field(
|
||||
default="",
|
||||
description=(
|
||||
@@ -75,26 +96,26 @@ class DatabaseConfig(BaseModel):
|
||||
)
|
||||
pool_size: int = Field(
|
||||
default=5,
|
||||
description="Connection pool size for the app ORM engine (postgres/mysql only).",
|
||||
description="Connection pool size for the app ORM engine (postgres/gauss/mysql only).",
|
||||
)
|
||||
max_overflow: int = Field(
|
||||
default=10,
|
||||
description=(
|
||||
"Extra connections allowed beyond pool_size under load (postgres/mysql only). "
|
||||
"Extra connections allowed beyond pool_size under load (postgres/gauss/mysql only). "
|
||||
"The real connection ceiling is pool_size + max_overflow. SQLAlchemy default is 10."
|
||||
),
|
||||
)
|
||||
pool_timeout: int = Field(
|
||||
default=30,
|
||||
description=(
|
||||
"Seconds a caller waits for a free pooled connection before erroring (postgres/mysql only). "
|
||||
"Seconds a caller waits for a free pooled connection before erroring (postgres/gauss/mysql only). "
|
||||
"SQLAlchemy default is 30."
|
||||
),
|
||||
)
|
||||
pool_recycle: int = Field(
|
||||
default=1800,
|
||||
description=(
|
||||
"Recycle pooled connections after this many seconds (postgres/mysql only). "
|
||||
"Recycle pooled connections after this many seconds (postgres/gauss/mysql only). "
|
||||
"Prevents stale-connection errors when a firewall, pgbouncer, or MySQL "
|
||||
"wait_timeout silently drops idle connections. pool_pre_ping catches most "
|
||||
"cases, but pool_recycle is the belt-and-suspenders safety net. "
|
||||
@@ -133,12 +154,38 @@ class DatabaseConfig(BaseModel):
|
||||
"""SQLAlchemy async URL for the application ORM engine."""
|
||||
if self.backend == "sqlite":
|
||||
return f"sqlite+aiosqlite:///{self.sqlite_path}"
|
||||
if self.backend == "postgres":
|
||||
url = self.postgres_url
|
||||
if url.startswith("postgresql://"):
|
||||
url = url.replace("postgresql://", "postgresql+asyncpg://", 1)
|
||||
return url
|
||||
if self.backend == "mysql":
|
||||
if self.backend == "postgres":
|
||||
url = self.postgres_url
|
||||
if url.startswith("postgresql://"):
|
||||
url = url.replace("postgresql://", "postgresql+asyncpg://", 1)
|
||||
return url
|
||||
if self.backend == "gauss":
|
||||
url = self.gauss_url.strip()
|
||||
if not url:
|
||||
raise ValueError("database.gauss_url is required for backend='gauss'")
|
||||
|
||||
# GaussDB speaks the PostgreSQL wire protocol, but its server
|
||||
# version string and DDL capabilities are not identical to
|
||||
# PostgreSQL. Always select the official openGauss dialect instead
|
||||
# of silently sending the URL through SQLAlchemy's generic PG
|
||||
# dialect (the latter commonly connects and then fails while
|
||||
# SQLAlchemy initializes/creates the schema).
|
||||
for prefix in (
|
||||
"opengauss://",
|
||||
"gaussdb://",
|
||||
"postgres://",
|
||||
"postgresql://",
|
||||
"postgresql+asyncpg://",
|
||||
):
|
||||
if url.startswith(prefix):
|
||||
return "opengauss+asyncpg://" + url[len(prefix) :]
|
||||
if url.startswith("opengauss+asyncpg://"):
|
||||
return url
|
||||
raise ValueError(
|
||||
"database.gauss_url must use opengauss://, "
|
||||
"opengauss+asyncpg://, or a PostgreSQL-style URL"
|
||||
)
|
||||
if self.backend == "mysql":
|
||||
url = self.mysql_url
|
||||
if not url:
|
||||
raise ValueError("database.mysql_url is required for backend='mysql'")
|
||||
|
||||
+19
-1
@@ -44,6 +44,7 @@ class WeKnoraConnectionConfig(BaseModel):
|
||||
repr=False,
|
||||
description=("Optional WeKnora administrator password used by DeerFlow's server-side WeKnora API client and detail-page iframe proxy. Prefer $ENV references."),
|
||||
)
|
||||
graph: WeKnoraDirectGraphConfig = Field(default_factory=lambda: WeKnoraDirectGraphConfig())
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
@field_validator("api_base_url", "web_base_url")
|
||||
@@ -52,10 +53,27 @@ class WeKnoraConnectionConfig(BaseModel):
|
||||
return normalize_service_url(value)
|
||||
|
||||
|
||||
class WeKnoraDirectGraphConfig(BaseModel):
|
||||
"""Backend-only, opt-in Neo4j transactional HTTP writer settings."""
|
||||
|
||||
direct_write_enabled: bool = False
|
||||
neo4j_http_url: str = ""
|
||||
username: str = ""
|
||||
password: str = Field(default="", repr=False)
|
||||
database: str = Field(default="neo4j", pattern=r"^[A-Za-z0-9_.-]+$")
|
||||
timeout_seconds: float = Field(default=30, gt=0, le=300)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
@field_validator("neo4j_http_url")
|
||||
@classmethod
|
||||
def _validate_url(cls, value: str) -> str:
|
||||
return normalize_service_url(value)
|
||||
|
||||
|
||||
class LocalWikiEmbeddingConfig(BaseModel):
|
||||
enabled: bool = True
|
||||
provider: str = "openai"
|
||||
model: str = "bge-m3"
|
||||
model: str = "bge-embedding-m3"
|
||||
base_url: str = ""
|
||||
api_key: str = Field(default="", repr=False)
|
||||
dimensions: int | None = Field(
|
||||
|
||||
@@ -160,6 +160,18 @@ class PromptPrefixSettings(BaseModel):
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class SkillKnowledgeAutoSyncSettings(BaseModel):
|
||||
"""Watcher/scheduler policy for bindings that explicitly opt in."""
|
||||
|
||||
watch_enabled: bool = True
|
||||
schedule_enabled: bool = True
|
||||
schedule_cron: str = Field(default="0 */6 * * *", min_length=5, max_length=128)
|
||||
debounce_seconds: int = Field(default=120, ge=10, le=86_400)
|
||||
write_remote_enabled: bool = True
|
||||
review_mode: Literal["required", "auto_high_confidence", "off"] = "auto_high_confidence"
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class AppearanceRouteParam(BaseModel):
|
||||
"""Runtime query-param descriptor for top-bar shortcut buttons.
|
||||
|
||||
@@ -509,6 +521,11 @@ class SystemSettings(BaseModel):
|
||||
concurrency_monitor: ConcurrencyMonitorSettings = Field(default_factory=ConcurrencyMonitorSettings)
|
||||
model_concurrency: ModelConcurrencySettings = Field(default_factory=ModelConcurrencySettings)
|
||||
llmwiki: LlmWikiRuntimeOverride = Field(default_factory=LlmWikiRuntimeOverride)
|
||||
skill_knowledge_auto_sync: SkillKnowledgeAutoSyncSettings = Field(default_factory=SkillKnowledgeAutoSyncSettings)
|
||||
knowledge_base_product_version: Literal["v1", "v2"] = Field(
|
||||
default="v1",
|
||||
description="v1 opens the ordinary WeKnora experience; v2 opens the DeerFlow assistant knowledge base.",
|
||||
)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user