feat(tools): refactor migrate OpenClaw from custom tool to builtin tool
Create OpenClawTool class inheriting BuiltinTool with dedicated config Remove all x-openclaw special handling from CustomTool (~270 lines) Add multi-operation support (print_task, device_query, image_understand, general) Change ensure_builtin_tools_initialized to incremental mode for auto-provisioning Fix OperationTool and LangchainAdapter to support OpenClaw operation routing
This commit is contained in:
@@ -161,6 +161,17 @@ class BuiltinToolRepository:
|
||||
BuiltinToolConfig.id == tool_id
|
||||
).first()
|
||||
|
||||
@staticmethod
|
||||
def get_existing_tool_classes(db: Session, tenant_id: uuid.UUID) -> set:
|
||||
"""获取该租户已有的内置工具 tool_class 集合"""
|
||||
rows = db.query(BuiltinToolConfig.tool_class).join(
|
||||
ToolConfig, BuiltinToolConfig.id == ToolConfig.id
|
||||
).filter(
|
||||
ToolConfig.tenant_id == tenant_id,
|
||||
ToolConfig.tool_type == ToolType.BUILTIN.value
|
||||
).all()
|
||||
return {row[0] for row in rows}
|
||||
|
||||
|
||||
class CustomToolRepository:
|
||||
"""自定义工具仓储类"""
|
||||
|
||||
Reference in New Issue
Block a user