sync update from LAN repo (source dhk-1 @ 3b1ec5b4)

This commit is contained in:
gozeros committed 2026-11-05 10:56:34 +08:00
1 parent da6521b6cb
commit 264e2200d6
995 files changed
+148105 -13399

No files matched your search

@@ -135,7 +135,16 @@ class LocalWikiIndexConfig(BaseModel):
default="http://127.0.0.1:5174",
description="DeerFlow frontend base URL used to build directly usable Wiki links in public vector-search results.",
)
auto_sync: bool = True
frontend_base_urls: list[str] = Field(
default_factory=lambda: [
"http://127.0.0.1:5173",
"http://localhost:5173",
"http://127.0.0.1:5174",
"http://localhost:5174",
],
description="Allowed local dev frontend origins; wiki_url uses the request Origin when it matches.",
)
auto_sync: bool = False
sync_interval_seconds: int = Field(default=30, ge=10, le=86400)
sync_page_size: int = Field(default=100, ge=1, le=500)
sync_concurrency: int = Field(default=3, ge=1, le=32)
@@ -174,6 +183,29 @@ class LocalWikiIndexConfig(BaseModel):
raise ValueError("local Wiki index frontend_base_url is required")
return normalized
@field_validator("frontend_base_urls")
@classmethod
def _validate_frontend_base_urls(cls, value: list[str]) -> list[str]:
normalized: list[str] = []
for item in value:
url = normalize_service_url(item)
if url:
normalized.append(url)
return list(dict.fromkeys(normalized))
def resolve_frontend_base_url(self, origin: str | None) -> str:
allowed = set(self.frontend_base_urls)
allowed.add(self.frontend_base_url)
candidate = ""
if origin and str(origin).strip():
try:
candidate = normalize_service_url(origin)
except ValueError:
candidate = ""
if candidate and candidate in allowed:
return candidate
return self.frontend_base_url
@model_validator(mode="before")
@classmethod
def _migrate_legacy_flags(cls, value):