Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix: 增加bing和DDG配置开关

m0568387000349f63932e3
diff --git a/jiuwenclaw/app_web_handlers.py b/jiuwenclaw/app_web_handlers.py
index dc130f8d35..65e7eb6c1c 100644
--- a/jiuwenclaw/app_web_handlers.py
+++ b/jiuwenclaw/app_web_handlers.py
@@ -173,6 +173,8 @@ _CONFIG_SET_ENV_MAP = {
"perplexity_api_key": "PERPLEXITY_API_KEY",
"github_token": "GITHUB_TOKEN",
"evolution_auto_scan": "EVOLUTION_AUTO_SCAN",
+ "free_search_ddg_enabled": "FREE_SEARCH_DDG_ENABLED",
+ "free_search_bing_enabled": "FREE_SEARCH_BING_ENABLED",
}
# 配置项键名列表,用于日志等说明
CONFIG_KEYS = tuple(_CONFIG_SET_ENV_MAP.keys())
@@ -328,12 +330,18 @@ def _register_web_handlers(bind: WebHandlersBindParams) -> None:
memory_desc = memory_cfg.get("description") or {}
preferred_lang = raw.get("preferred_language", "zh")
payload["memory_forbidden_description"] = memory_desc.get(preferred_lang, memory_desc.get("zh", ""))
+ if not payload.get("free_search_ddg_enabled"):
+ payload["free_search_ddg_enabled"] = "true"
+ if not payload.get("free_search_bing_enabled"):
+ payload["free_search_bing_enabled"] = "true"
except Exception: # noqa: BLE001
payload.setdefault("context_engine_enabled", "false")
payload.setdefault("kv_cache_affinity_enabled", "false")
payload.setdefault("permissions_enabled", "false")
payload.setdefault("memory_forbidden_enabled", "false")
payload.setdefault("memory_forbidden_description", "")
+ payload.setdefault("free_search_ddg_enabled", "true")
+ payload.setdefault("free_search_bing_enabled", "true")
await channel.send_response(ws, req_id, ok=True, payload=payload)
def _persist_env_updates(updates: dict[str, str]) -> None:
diff --git a/jiuwenclaw/web/src/components/ConfigPanel/index.tsx b/jiuwenclaw/web/src/components/ConfigPanel/index.tsx
index 869335b9bf..48b4e156d5 100644
--- a/jiuwenclaw/web/src/components/ConfigPanel/index.tsx
+++ b/jiuwenclaw/web/src/components/ConfigPanel/index.tsx
@@ -33,6 +33,7 @@ const THIRD_PARTY_API_KEYS = new Set([
const REQUIRED_MODEL_FIELDS = ["api_base", "api_key", "model", "model_provider"] as const;
const REQUIRED_MODEL_FIELD_SET = new Set<string>(REQUIRED_MODEL_FIELDS);
const EVOLUTION_KEYS = new Set(["evolution_auto_scan"]);
+const FREE_SEARCH_KEYS = new Set(["free_search_ddg_enabled", "free_search_bing_enabled"]);
const MEMORY_KEYS = new Set(["memory_forbidden_enabled", "memory_forbidden_description"]);
function classifyKey(key: string): string {
@@ -44,6 +45,7 @@ function classifyKey(key: string): string {
if (THIRD_PARTY_API_KEYS.has(key)) return "third_party_api";
if (EMAIL_KEYS.has(key)) return "email";
if (EVOLUTION_KEYS.has(key)) return "evolution";
+ if (FREE_SEARCH_KEYS.has(key)) return "free_search";
if (MEMORY_KEYS.has(key)) return "memory";
if (key === "context_engine_enabled" || key === "kv_cache_affinity_enabled") return "context_engine";
if (key === "permissions_enabled") return "permissions";
@@ -128,6 +130,7 @@ function getGroupToneClass(tag: string): string {
if (tag === "model_vision") return "text-teal-500 bg-teal-500/10 border-teal-500/20";
if (tag === "embed") return "text-cyan-500 bg-cyan-500/10 border-cyan-500/20";
if (tag === "third_party_api") return "text-indigo-500 bg-indigo-500/10 border-indigo-500/20";
+ if (tag === "free_search") return "text-lime-500 bg-lime-500/10 border-lime-500/20";
if (tag === "evolution") return "text-amber-500 bg-amber-500/10 border-amber-500/20";
if (tag === "memory") return "text-purple-500 bg-purple-500/10 border-purple-500/20";
if (tag === "context_engine") return "text-sky-500 bg-sky-500/10 border-sky-500/20";
@@ -150,6 +153,7 @@ function getNestedModelStyle(tag: string): string {
function isBooleanKey(key: string): boolean {
return (
EVOLUTION_KEYS.has(key) ||
+ FREE_SEARCH_KEYS.has(key) ||
key === "context_engine_enabled" ||
key === "kv_cache_affinity_enabled" ||
key === "permissions_enabled" ||
@@ -164,6 +168,8 @@ function parseBoolValue(value: string): boolean {
function getBooleanKeyLabel(key: string, t: (key: string) => string): string {
const labels: Record<string, string> = {
evolution_auto_scan: t('config.booleanLabels.evolutionAutoScan'),
+ free_search_ddg_enabled: t('config.booleanLabels.freeSearchDdg'),
+ free_search_bing_enabled: t('config.booleanLabels.freeSearchBing'),
context_engine_enabled: t('config.booleanLabels.enabled'),
kv_cache_affinity_enabled: t('config.booleanLabels.kvCacheAffinity'),
permissions_enabled: t('config.booleanLabels.enabled'),
@@ -202,12 +208,13 @@ function getGroupMeta(t: (key: string) => string): Record<string, { label: strin
model_vision: { label: t('config.groups.modelVision.label'), order: 3, hint: t('config.groups.modelVision.hint') },
embed: { label: t('config.groups.embed.label'), order: 4, hint: t('config.groups.embed.hint') },
third_party_api: { label: t('config.groups.thirdParty.label'), order: 5, hint: t('config.groups.thirdParty.hint') },
- evolution: { label: t('config.groups.evolution.label'), order: 6, hint: t('config.groups.evolution.hint') },
- context_engine: { label: t('config.groups.contextEngine.label'), order: 7, hint: t('config.groups.contextEngine.hint') },
- permissions: { label: t('config.groups.permissions.label'), order: 8, hint: t('config.groups.permissions.hint') },
- memory: { label: t('config.groups.memory.label'), order: 9, hint: t('config.groups.memory.hint') },
- email: { label: t('config.groups.email.label'), order: 10, hint: t('config.groups.email.hint') },
- other: { label: t('config.groups.other.label'), order: 11, hint: t('config.groups.other.hint') },
+ free_search: { label: t('config.groups.freeSearch.label'), order: 6, hint: t('config.groups.freeSearch.hint') },
+ evolution: { label: t('config.groups.evolution.label'), order: 7, hint: t('config.groups.evolution.hint') },
+ context_engine: { label: t('config.groups.contextEngine.label'), order: 8, hint: t('config.groups.contextEngine.hint') },
+ permissions: { label: t('config.groups.permissions.label'), order: 9, hint: t('config.groups.permissions.hint') },
+ memory: { label: t('config.groups.memory.label'), order: 10, hint: t('config.groups.memory.hint') },
+ email: { label: t('config.groups.email.label'), order: 11, hint: t('config.groups.email.hint') },
+ other: { label: t('config.groups.other.label'), order: 12, hint: t('config.groups.other.hint') },
};
}
diff --git a/jiuwenclaw/web/src/i18n/locales/en.json b/jiuwenclaw/web/src/i18n/locales/en.json
index 151a0c4b1a..004a3ca406 100644
--- a/jiuwenclaw/web/src/i18n/locales/en.json
+++ b/jiuwenclaw/web/src/i18n/locales/en.json
@@ -392,6 +392,7 @@
"model": { "label": "Model Configuration", "hint": "Model service and authentication settings" },
"embed": { "label": "Embed Configuration", "hint": "Embed service and authentication settings" },
"thirdParty": { "label": "Third-Party Services", "hint": "API key settings" },
+ "freeSearch": { "label": "Free Search Engines", "hint": "Enable or disable free search engines" },
"evolution": { "label": "Evolution Settings", "hint": "Online skill evolution settings" },
"contextEngine": { "label": "Context Compression", "hint": "Enable or disable dialogue context compression" },
"permissions": { "label": "Tool Safety Guardrail", "hint": "Enable or disable permission checks for tool calls" },
@@ -401,6 +402,8 @@
},
"booleanLabels": {
"evolutionAutoScan": "Auto-detect evolution signals",
+ "freeSearchDdg": "Enable DuckDuckGo (including DDG via Jina)",
+ "freeSearchBing": "Enable Bing",
"enabled": "Enable",
"kvCacheAffinity": "Compute affinity (KV cache release)"
},
diff --git a/jiuwenclaw/web/src/i18n/locales/zh.json b/jiuwenclaw/web/src/i18n/locales/zh.json
index 6d875307c8..2ab72cc47c 100644
--- a/jiuwenclaw/web/src/i18n/locales/zh.json
+++ b/jiuwenclaw/web/src/i18n/locales/zh.json
@@ -391,6 +391,7 @@
"model": { "label": "模型配置", "hint": "模型服务与鉴权参数" },
"embed": { "label": "Embed配置", "hint": "Embed 服务与鉴权参数" },
"thirdParty": { "label": "第三方服务配置", "hint": "API Key 配置" },
+ "freeSearch": { "label": "免费搜索引擎配置", "hint": "控制免费搜索工具启用的搜索引擎" },
"evolution": { "label": "自演进配置", "hint": "Skills 在线自演进参数" },
"contextEngine": { "label": "上下文压缩", "hint": "控制对话上下文是否启用压缩" },
"permissions": { "label": "工具安全护栏", "hint": "控制工具调用时的权限检查" },
@@ -400,6 +401,8 @@
},
"booleanLabels": {
"evolutionAutoScan": "自动检测可演进信号",
+ "freeSearchDdg": "启用 DuckDuckGo(含 DDG via Jina)",
+ "freeSearchBing": "启用 Bing",
"enabled": "启用",
"kvCacheAffinity": "算力亲和(KV 释放)"
},