Skip to content

Commit a0aa3d8

Browse files
authored
Merge branch 'AstrBotDevs:master' into master
2 parents e2f8f5e + b32cc8d commit a0aa3d8

8 files changed

Lines changed: 43 additions & 7 deletions

File tree

astrbot/core/config/default.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"websearch_bocha_key": [],
112112
"websearch_brave_key": [],
113113
"websearch_baidu_app_builder_key": "",
114+
"websearch_firecrawl_key": [],
114115
"web_search_link": False,
115116
"display_reasoning_text": False,
116117
"identifier": False,
@@ -312,6 +313,7 @@
312313
"kb_final_top_k": 5, # 知识库检索最终返回结果数量
313314
"kb_agentic_mode": False,
314315
"disable_builtin_commands": False,
316+
"disable_metrics": False,
315317
}
316318

317319

@@ -2945,6 +2947,11 @@
29452947
"callback_api_base": {
29462948
"type": "string",
29472949
},
2950+
"disable_metrics": {
2951+
"description": "禁用匿名使用统计",
2952+
"type": "bool",
2953+
"hint": "禁用后,AstrBot 将不再上传匿名使用统计数据。",
2954+
},
29482955
"log_level": {
29492956
"type": "string",
29502957
"options": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
@@ -3264,6 +3271,7 @@
32643271
"hint": "参考:https://console.bce.baidu.com/iam/#/iam/apikey/list",
32653272
"condition": {
32663273
"provider_settings.websearch_provider": "baidu_ai_search",
3274+
"provider_settings.web_search": True,
32673275
},
32683276
},
32693277
"provider_settings.web_search_link": {

astrbot/core/persona_mgr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ async def update_folder(
239239
self,
240240
folder_id: str,
241241
name: str | None = None,
242-
parent_id: str | None = None,
243-
description: str | None = None,
242+
parent_id: str | None | object = NOT_GIVEN,
243+
description: str | None | object = NOT_GIVEN,
244244
sort_order: int | None = None,
245245
) -> PersonaFolder | None:
246246
"""更新文件夹信息"""

astrbot/core/utils/metrics.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ class Metric:
2323
_lock: asyncio.Lock | None = None
2424
_lock_loop: asyncio.AbstractEventLoop | None = None
2525

26+
@staticmethod
27+
def _is_disabled() -> bool:
28+
"""检查是否禁用指标上传(配置或环境变量)"""
29+
if os.environ.get("ASTRBOT_DISABLE_METRICS", "0") == "1":
30+
return True
31+
try:
32+
from astrbot.core import astrbot_config
33+
34+
return astrbot_config.get("disable_metrics", False)
35+
except (ImportError, AttributeError, KeyError):
36+
return False
37+
2638
@staticmethod
2739
def get_installation_id():
2840
"""获取或创建一个唯一的安装ID"""
@@ -173,7 +185,7 @@ async def flush() -> None:
173185

174186
@staticmethod
175187
async def _post_metrics(metrics_data: dict[str, Any]) -> None:
176-
if os.environ.get("ASTRBOT_DISABLE_METRICS", "0") == "1":
188+
if Metric._is_disabled():
177189
return
178190

179191
base_url = "https://tickstats.soulter.top/api/metric/90a6c2a1"
@@ -204,7 +216,7 @@ async def upload(**kwargs) -> None:
204216
205217
Powered by TickStats.
206218
"""
207-
if os.environ.get("ASTRBOT_DISABLE_METRICS", "0") == "1":
219+
if Metric._is_disabled():
208220
return
209221

210222
await Metric._save_platform_stats(kwargs)

astrbot/dashboard/routes/persona.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from astrbot.core import logger
66
from astrbot.core.core_lifecycle import AstrBotCoreLifecycle
77
from astrbot.core.db import BaseDatabase
8+
from astrbot.core.sentinels import NOT_GIVEN
89

910
from .route import Response, Route, RouteContext
1011

@@ -415,8 +416,10 @@ async def update_folder(self):
415416
data = await request.get_json()
416417
folder_id = data.get("folder_id")
417418
name = data.get("name")
418-
parent_id = data.get("parent_id")
419-
description = data.get("description")
419+
parent_id = data.get("parent_id") if "parent_id" in data else NOT_GIVEN
420+
description = (
421+
data.get("description") if "description" in data else NOT_GIVEN
422+
)
420423
sort_order = data.get("sort_order")
421424

422425
if not folder_id:

dashboard/src/i18n/locales/en-US/features/config-metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,10 @@
10831083
"description": "Externally Accessible Callback API Address",
10841084
"hint": "External services may access AstrBot's backend through callback links generated by AstrBot (such as file download links). Since AstrBot cannot automatically determine the externally accessible host address in the deployment environment, this configuration item is needed to explicitly specify how external services should access AstrBot's address. Examples: [http://localhost:6185](http://localhost:6185), [https://example.com](https://example.com), etc."
10851085
},
1086+
"disable_metrics": {
1087+
"description": "Disable Anonymous Usage Statistics",
1088+
"hint": "When disabled, AstrBot will not upload anonymous usage statistics."
1089+
},
10861090
"dashboard": {
10871091
"ssl": {
10881092
"enable": {

dashboard/src/i18n/locales/ru-RU/features/config-metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,10 @@
10841084
"description": "Внешний адрес для Callback API",
10851085
"hint": "Используется для сервисов, требующих обратных выливов (например, в песочнице)."
10861086
},
1087+
"disable_metrics": {
1088+
"description": "Отключить анонимную статистику",
1089+
"hint": "После отключения AstrBot не будет отправлять анонимные данные об использовании."
1090+
},
10871091
"dashboard": {
10881092
"ssl": {
10891093
"enable": {

dashboard/src/i18n/locales/zh-CN/features/config-metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,10 @@
10851085
"description": "对外可达的回调接口地址",
10861086
"hint": "外部服务可能会通过 AstrBot 生成的回调链接(如文件下载链接)访问 AstrBot 后端。由于 AstrBot 无法自动判断部署环境中对外可达的主机地址(host),因此需要通过此配置项显式指定外部服务如何访问 AstrBot 的地址。如 [http://localhost:6185](http://localhost:6185),[https://example.com](https://example.com) 等。"
10871087
},
1088+
"disable_metrics": {
1089+
"description": "禁用匿名使用统计",
1090+
"hint": "禁用后,AstrBot 将不再上传匿名使用统计数据。"
1091+
},
10881092
"dashboard": {
10891093
"ssl": {
10901094
"enable": {

dashboard/src/views/ConsolePage.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default {
6363
},
6464
data() {
6565
return {
66-
autoScrollEnabled: true,
66+
autoScrollEnabled: localStorage.getItem('console_auto_scroll') !== 'false',
6767
pipDialog: false,
6868
pipInstallPayload: {
6969
package: '',
@@ -75,6 +75,7 @@ export default {
7575
},
7676
watch: {
7777
autoScrollEnabled(val) {
78+
localStorage.setItem('console_auto_scroll', val);
7879
if (this.$refs.consoleDisplayer) {
7980
this.$refs.consoleDisplayer.autoScroll = val;
8081
}

0 commit comments

Comments
 (0)