Skip to content

Commit 43156d6

Browse files
committed
Merge branch 'origin/dev' into dev
Resolved merge conflicts in: - func_tool_manager.py: kept origin version (full implementation) - astr_main_agent*.py: kept HEAD version (complete refactor) - cron_tools.py: kept HEAD version (with get_all_tools) - config/default.py: kept HEAD version (DEFAULT_WEB_SEARCH_PROVIDER) - dashboard/*.vue: kept HEAD version - web_searcher engines: kept HEAD version - Added new tools: knowledge_base_tools, message_tools, registry, web_search_tools
2 parents 7d22cfb + 38b1b4d commit 43156d6

45 files changed

Lines changed: 2430 additions & 66 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docker-image.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ jobs:
7070
uses: docker/setup-buildx-action@v4.0.0
7171

7272
- name: Log in to DockerHub
73-
uses: docker/login-action@v4.0.0
73+
uses: docker/login-action@v4.1.0
7474
with:
7575
username: ${{ secrets.DOCKER_HUB_USERNAME }}
7676
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
7777

7878
- name: Login to GitHub Container Registry
7979
if: env.HAS_GHCR_TOKEN == 'true'
80-
uses: docker/login-action@v4.0.0
80+
uses: docker/login-action@v4.1.0
8181
with:
8282
registry: ghcr.io
8383
username: ${{ env.GHCR_OWNER }}
@@ -169,14 +169,14 @@ jobs:
169169
uses: docker/setup-buildx-action@v4.0.0
170170

171171
- name: Log in to DockerHub
172-
uses: docker/login-action@v4.0.0
172+
uses: docker/login-action@v4.1.0
173173
with:
174174
username: ${{ secrets.DOCKER_HUB_USERNAME }}
175175
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
176176

177177
- name: Login to GitHub Container Registry
178178
if: env.HAS_GHCR_TOKEN == 'true'
179-
uses: docker/login-action@v4.0.0
179+
uses: docker/login-action@v4.1.0
180180
with:
181181
registry: ghcr.io
182182
username: ${{ env.GHCR_OWNER }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Connect AstrBot to your favorite chat platform.
157157
| LINE | Official |
158158
| Satori | Official |
159159
| Misskey | Official |
160+
| Mattermost | Official |
160161
| WhatsApp (Coming Soon) | Official |
161162
| [Matrix](https://github.com/stevessr/astrbot_plugin_matrix_adapter) | Community |
162163
| [KOOK](https://github.com/wuyan1003/astrbot_plugin_kook_adapter) | Community |

astrbot/builtin_stars/web_searcher/metadata.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

astrbot/core/astr_agent_hooks.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,13 @@ async def on_tool_end(
135135
platform_name = run_context.context.event.get_platform_name()
136136
if (
137137
platform_name == "webchat"
138-
and tool.name in ["web_search_tavily", "web_search_bocha"]
138+
and tool.name
139+
in [
140+
"web_search_baidu",
141+
"web_search_tavily",
142+
"web_search_bocha",
143+
"web_search_brave",
144+
]
139145
and len(run_context.messages) > 0
140146
and tool_result
141147
and len(tool_result.content)

astrbot/core/backup/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from astrbot.core.db.po import (
99
Attachment,
10+
ChatUIProject,
1011
CommandConfig,
1112
CommandConflict,
1213
ConversationV2,
@@ -16,6 +17,7 @@
1617
PlatformSession,
1718
PlatformStat,
1819
Preference,
20+
SessionProjectRelation,
1921
)
2022
from astrbot.core.knowledge_base.models import (
2123
KBDocument,
@@ -44,6 +46,8 @@
4446
"preferences": Preference,
4547
"platform_message_history": PlatformMessageHistory,
4648
"platform_sessions": PlatformSession,
49+
"chatui_projects": ChatUIProject,
50+
"session_project_relations": SessionProjectRelation,
4751
"attachments": Attachment,
4852
"command_configs": CommandConfig,
4953
"command_conflicts": CommandConflict,

astrbot/core/knowledge_base/kb_db_sqlite.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from contextlib import asynccontextmanager
22
from pathlib import Path
3+
from typing import TYPE_CHECKING
34

45
from sqlalchemy import delete, func, select, text, update
56
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
67
from sqlmodel import col, desc
78

89
from astrbot.core import logger
9-
from astrbot.core.db.vec_db.faiss_impl import FaissVecDB
1010
from astrbot.core.knowledge_base.models import (
1111
BaseKBModel,
1212
KBDocument,
@@ -15,6 +15,9 @@
1515
)
1616
from astrbot.core.utils.astrbot_path import get_astrbot_knowledge_base_path
1717

18+
if TYPE_CHECKING:
19+
from astrbot.core.db.vec_db.faiss_impl import FaissVecDB
20+
1821

1922
class KBSQLiteDatabase:
2023
def __init__(self, db_path: str | None = None) -> None:
@@ -295,7 +298,7 @@ async def get_documents_with_metadata_batch(
295298

296299
return metadata_map
297300

298-
async def delete_document_by_id(self, doc_id: str, vec_db: FaissVecDB) -> None:
301+
async def delete_document_by_id(self, doc_id: str, vec_db: "FaissVecDB") -> None:
299302
"""删除单个文档及其相关数据"""
300303
# 在知识库表中删除
301304
async with self.get_db() as session, session.begin():
@@ -323,7 +326,7 @@ async def get_media_by_id(self, media_id: str) -> KBMedia | None:
323326
result = await session.execute(stmt)
324327
return result.scalar_one_or_none()
325328

326-
async def update_kb_stats(self, kb_id: str, vec_db: FaissVecDB) -> None:
329+
async def update_kb_stats(self, kb_id: str, vec_db: "FaissVecDB") -> None:
327330
"""更新知识库统计信息"""
328331
chunk_cnt = await vec_db.count_documents()
329332

astrbot/core/knowledge_base/retrieval/sparse_retriever.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
import json
77
import os
88
from dataclasses import dataclass
9+
from typing import TYPE_CHECKING
910

1011
import jieba
1112
from rank_bm25 import BM25Okapi
1213

13-
from astrbot.core.db.vec_db.faiss_impl import FaissVecDB
1414
from astrbot.core.knowledge_base.kb_db_sqlite import KBSQLiteDatabase
1515

16+
if TYPE_CHECKING:
17+
from astrbot.core.db.vec_db.faiss_impl import FaissVecDB
18+
1619

1720
@dataclass
1821
class SparseResult:
@@ -73,7 +76,7 @@ async def retrieve(
7376
top_k_sparse = 0
7477
chunks = []
7578
for kb_id in kb_ids:
76-
vec_db: FaissVecDB = kb_options.get(kb_id, {}).get("vec_db")
79+
vec_db: FaissVecDB | None = kb_options.get(kb_id, {}).get("vec_db")
7780
if not vec_db:
7881
continue
7982
result = await vec_db.document_storage.get_documents(

astrbot/core/platform/manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ async def load_platform(self, platform_config: dict) -> None:
212212
from .sources.kook.kook_adapter import ( # noqa: F401
213213
KookPlatformAdapter,
214214
)
215+
case "mattermost":
216+
from .sources.mattermost.mattermost_adapter import (
217+
MattermostPlatformAdapter, # noqa: F401
218+
)
215219
except (ImportError, ModuleNotFoundError) as e:
216220
logger.error(
217221
f"加载平台适配器 {platform_config['type']} 失败,原因:{e}。请检查依赖库是否安装。提示:可以在 管理面板->平台日志->安装Pip库 中安装依赖库。",

astrbot/core/platform/sources/mattermost/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)