Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
61e5de1
refactor: migrate RAG knowledge services to a plugin-oriented host se…
huanghuoguoguo Jan 24, 2026
21ea766
feat(rag): phase 2 core refactor with RPC Action handlers
huanghuoguoguo Jan 24, 2026
51fc297
feat: 为 RAG 插件添加知识库创建和删除事件通知,并优化了 RAG 动作的参数传递和枚举使用。
huanghuoguoguo Jan 25, 2026
43cdf8f
feat: 统一知识库管理为RAG引擎,支持动态配置并移除旧的外部知识库组件。
huanghuoguoguo Jan 26, 2026
a9d2f9f
refactor(rag): remove plugin_adapter, inline logic into RuntimeKnowle…
huanghuoguoguo Jan 26, 2026
b5e3fc9
refactor(api): remove ExternalKnowledgeBase infrastructure
huanghuoguoguo Jan 26, 2026
60135b4
refactor(plugin): remove list_knowledge_retrievers from connector
huanghuoguoguo Jan 26, 2026
a934a61
refactor(service): update knowledge service with capability-based checks
huanghuoguoguo Jan 26, 2026
45c15df
feat(web): unify knowledge base UI, remove external KB components
huanghuoguoguo Jan 26, 2026
f24d360
refactor(plugin): code review improvements for RAG handlers
huanghuoguoguo Jan 27, 2026
0053916
merge main
huanghuoguoguo Feb 4, 2026
caceb11
refactor(rag): refactor KB dynamic form and vector manager
huanghuoguoguo Feb 4, 2026
26a6fdc
fix: code review fixes for RAG refactor
huanghuoguoguo Feb 5, 2026
277880f
refactor(rag): consolidate valid_fields into entity constants
huanghuoguoguo Feb 5, 2026
a6bc2eb
refactor: 将知识库获取和RAG引擎信息丰富逻辑移至知识库管理器。
huanghuoguoguo Feb 5, 2026
83f9842
refactor(rag): introduce RAGRuntimeService and clean up plugin handler
huanghuoguoguo Feb 5, 2026
76cf6b4
refactor(rag): standardize logger and fix type hints
huanghuoguoguo Feb 5, 2026
8c139c7
refactor: 将引擎徽章的样式从 Tailwind CSS 类迁移到 CSS 模块。
huanghuoguoguo Feb 5, 2026
00acb4f
fix(web): resolve React rendering errors in plugins page
huanghuoguoguo Feb 5, 2026
e1a59eb
fix(rag): update runtime service and web components
huanghuoguoguo Feb 6, 2026
bcc1ac2
refactor: 优化知识库设置结构并增强前端距离显示健壮性。
huanghuoguoguo Feb 6, 2026
982049c
fix: 处理前端距离显示中的空值。
huanghuoguoguo Feb 6, 2026
3034d9f
fix(rag): document retrieve ui and kbmgr top_k validation
huanghuoguoguo Feb 6, 2026
27c4483
更新 uv.lock 中的 PyPI 镜像源为官方地址。
huanghuoguoguo Feb 6, 2026
5576fd4
fix: address code review issues for RAG engine plugin architecture
huanghuoguoguo Feb 6, 2026
5f6ad86
fix: address code review findings for RAG plugin architecture
huanghuoguoguo Feb 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies = [
"chromadb>=0.4.24",
"qdrant-client (>=1.15.1,<2.0.0)",
"pyseekdb==1.0.0b7",
"langbot-plugin==0.2.5",
"langbot-plugin>=0.2.5",
"asyncpg>=0.30.0",
"line-bot-sdk>=3.19.0",
"tboxsdk>=0.0.10",
Expand Down
13 changes: 11 additions & 2 deletions src/langbot/pkg/api/http/controller/groups/knowledge/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def handle_specific_knowledge_base(knowledge_base_uuid: str) -> quart.Resp
elif quart.request.method == 'PUT':
json_data = await quart.request.json
await self.ap.knowledge_service.update_knowledge_base(knowledge_base_uuid, json_data)
return self.success({})
return self.success(data={'uuid': knowledge_base_uuid})

elif quart.request.method == 'DELETE':
await self.ap.knowledge_service.delete_knowledge_base(knowledge_base_uuid)
Expand Down Expand Up @@ -90,5 +90,14 @@ async def delete_specific_file_in_kb(file_id: str, knowledge_base_uuid: str) ->
async def retrieve_knowledge_base(knowledge_base_uuid: str) -> str:
json_data = await quart.request.json
query = json_data.get('query')
results = await self.ap.knowledge_service.retrieve_knowledge_base(knowledge_base_uuid, query)

if not query or not query.strip():
return self.http_status(400, -1, 'Query is required and cannot be empty')

# Extract retrieval_settings to allow dynamic control over RAG engine behavior (e.g. top_k, filters)
retrieval_settings = json_data.get('retrieval_settings', {})
results = await self.ap.knowledge_service.retrieve_knowledge_base(
knowledge_base_uuid, query, retrieval_settings
)
return self.success(data={'results': results})

37 changes: 37 additions & 0 deletions src/langbot/pkg/api/http/controller/groups/knowledge/engines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import quart
from urllib.parse import unquote
from ... import group


@group.group_class('rag_engines', '/api/v1/knowledge/engines')
class RAGEnginesRouterGroup(group.RouterGroup):
async def initialize(self) -> None:
@self.route('', methods=['GET'], auth_type=group.AuthType.USER_TOKEN_OR_API_KEY)
async def list_rag_engines() -> quart.Response:
"""List all available RAG engines from plugins.

Returns a list of RAG engines with their capabilities and configuration schemas.
This is used by the frontend to render the knowledge base creation wizard.
"""
engines = await self.ap.knowledge_service.list_rag_engines()
return self.success(data={'engines': engines})

@self.route('/<path:plugin_id>/creation-schema', methods=['GET'], auth_type=group.AuthType.USER_TOKEN_OR_API_KEY)
async def get_engine_creation_schema(plugin_id: str) -> quart.Response:
"""Get creation settings schema for a specific RAG engine.

plugin_id is in 'author/name' format, captured via <path:> converter.
"""
plugin_id = unquote(plugin_id)
schema = await self.ap.knowledge_service.get_engine_creation_schema(plugin_id)
return self.success(data={'schema': schema})

@self.route('/<path:plugin_id>/retrieval-schema', methods=['GET'], auth_type=group.AuthType.USER_TOKEN_OR_API_KEY)
async def get_engine_retrieval_schema(plugin_id: str) -> quart.Response:
"""Get retrieval settings schema for a specific RAG engine.

plugin_id is in 'author/name' format, captured via <path:> converter.
"""
plugin_id = unquote(plugin_id)
schema = await self.ap.knowledge_service.get_engine_retrieval_schema(plugin_id)
return self.success(data={'schema': schema})
61 changes: 0 additions & 61 deletions src/langbot/pkg/api/http/controller/groups/knowledge/external.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def _(pipeline_uuid: str) -> str:
return self.http_status(404, -1, 'pipeline not found')

# Only include plugins with pipeline-related components (Command, EventListener, Tool)
# Plugins that only have KnowledgeRetriever components are not suitable for pipeline extensions
# Plugins that only have RAGEngine components are not suitable for pipeline extensions
pipeline_component_kinds = ['Command', 'EventListener', 'Tool']
plugins = await self.ap.plugin_connector.list_plugins(component_kinds=pipeline_component_kinds)
mcp_servers = await self.ap.mcp_service.get_mcp_servers(contain_runtime_info=True)
Expand Down
80 changes: 0 additions & 80 deletions src/langbot/pkg/api/http/service/external_kb.py

This file was deleted.

Loading
Loading