Skip to content

Commit c0062e8

Browse files
authored
Merge branch 'develop' into hs/1010_dev
2 parents 0149bcf + ed2ecb6 commit c0062e8

34 files changed

+1853
-336
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
push:
88
branches: [develop]
99
# Only trigger when files in the doc directory change
10-
paths:
10+
paths:
1111
- 'doc/**'
1212

1313
# Allow manual running of this workflow from the Actions tab
@@ -36,39 +36,30 @@ jobs:
3636
- name: Checkout
3737
uses: actions/checkout@v4
3838
with:
39-
fetch-depth: 0 # Not needed if lastUpdated is not enabled
40-
39+
fetch-depth: 0
40+
4141
- name: Setup Node
4242
uses: actions/setup-node@v4
4343
with:
4444
node-version: 20
4545
cache: npm
4646
cache-dependency-path: ./doc/package-lock.json
47-
47+
4848
- name: Setup Pages
4949
uses: actions/configure-pages@v4
50-
50+
5151
- name: Install dependencies
5252
run: npm ci
53-
54-
- name: Temporarily modify base path for GitHub Pages
55-
run: |
56-
# Create a temporary config file, changing base from '/doc/' to '/nexent/' for GitHub Pages
57-
sed 's|base: '"'"'/doc/'"'"'|base: '"'"'/nexent/'"'"'|g' docs/.vitepress/config.mts > docs/.vitepress/config.github.mts
58-
mv docs/.vitepress/config.mts docs/.vitepress/config.original.mts
59-
mv docs/.vitepress/config.github.mts docs/.vitepress/config.mts
60-
53+
6154
- name: Build with VitePress
6255
run: npm run docs:build
63-
64-
- name: Restore original config
65-
run: |
66-
mv docs/.vitepress/config.original.mts docs/.vitepress/config.mts
67-
56+
env:
57+
GITHUB_PAGES: true
58+
6859
- name: Upload artifact
6960
uses: actions/upload-pages-artifact@v3
7061
with:
71-
path: doc/docs/.vitepress/dist
62+
path: ./doc/docs/.vitepress/dist
7263

7364
# Deploy job
7465
deploy:

backend/apps/tool_config_app.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
from fastapi import APIRouter, Header, HTTPException
66
from fastapi.responses import JSONResponse
77

8-
from consts.exceptions import MCPConnectionError
9-
from consts.model import ToolInstanceInfoRequest, ToolInstanceSearchRequest
8+
from consts.exceptions import MCPConnectionError, TimeoutException, NotFoundException
9+
from consts.model import ToolInstanceInfoRequest, ToolInstanceSearchRequest, ToolValidateRequest
1010
from services.tool_configuration_service import (
1111
search_tool_info_impl,
1212
update_tool_info_impl,
1313
update_tool_list,
1414
list_all_tools,
1515
load_last_tool_config_impl,
16+
validate_tool_impl,
1617
)
1718
from utils.auth_utils import get_current_user_id
1819

@@ -81,6 +82,7 @@ async def scan_and_update_tool(
8182
raise HTTPException(
8283
status_code=HTTPStatus.INTERNAL_SERVER_ERROR, detail="Failed to update tool")
8384

85+
8486
@router.get("/load_config/{tool_id}")
8587
async def load_last_tool_config(tool_id: int, authorization: Optional[str] = Header(None)):
8688
try:
@@ -97,4 +99,38 @@ async def load_last_tool_config(tool_id: int, authorization: Optional[str] = Hea
9799
except Exception as e:
98100
logger.error(f"Failed to load tool config: {e}")
99101
raise HTTPException(
100-
status_code=HTTPStatus.INTERNAL_SERVER_ERROR, detail="Failed to load tool config")
102+
status_code=HTTPStatus.INTERNAL_SERVER_ERROR, detail="Failed to load tool config")
103+
104+
105+
@router.post("/validate")
106+
async def validate_tool(
107+
request: ToolValidateRequest,
108+
authorization: Optional[str] = Header(None)
109+
):
110+
"""Validate specific tool based on source type"""
111+
try:
112+
_, tenant_id = get_current_user_id(authorization)
113+
result = await validate_tool_impl(request, tenant_id)
114+
115+
return JSONResponse(
116+
status_code=HTTPStatus.OK,
117+
content=result
118+
)
119+
except MCPConnectionError as e:
120+
logger.error(f"MCP connection failed: {e}")
121+
raise HTTPException(
122+
status_code=HTTPStatus.SERVICE_UNAVAILABLE,
123+
detail=str(e)
124+
)
125+
except NotFoundException as e:
126+
logger.error(f"Tool not found: {e}")
127+
raise HTTPException(
128+
status_code=HTTPStatus.NOT_FOUND,
129+
detail=str(e)
130+
)
131+
except Exception as e:
132+
logger.error(f"Failed to validate tool: {e}")
133+
raise HTTPException(
134+
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
135+
detail=f"Failed to validate tool: {str(e)}"
136+
)

backend/consts/const.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
# Deployment Version Configuration
6767
DEPLOYMENT_VERSION = os.getenv("DEPLOYMENT_VERSION", "speed")
6868
IS_SPEED_MODE = DEPLOYMENT_VERSION == "speed"
69-
DEFAULT_APP_DESCRIPTION_ZH = "Nexent 是一个开源智能体SDK和平台,能够将单一提示词转化为完整的多模态服务 —— 无需编排,无需复杂拖拉拽。基于 MCP 工具生态系统构建,Nexent 提供灵活的模型集成、可扩展的数据处理和强大的知识库管理。我们的目标很简单:将数据、模型和工具整合到一个智能中心中,让任何人都能轻松地将 Nexent 集成到项目中,使日常工作流程更智能、更互联。"
70-
DEFAULT_APP_DESCRIPTION_EN = "Nexent is an open-source agent SDK and platform, which can convert a single prompt into a complete multi-modal service - without orchestration, without complex drag-and-drop. Built on the MCP tool ecosystem, Nexent provides flexible model integration, scalable data processing, and powerful knowledge base management. Our goal is simple: to integrate data, models, and tools into a central intelligence hub, allowing anyone to easily integrate Nexent into their projects, making daily workflows smarter and more interconnected."
69+
DEFAULT_APP_DESCRIPTION_ZH = "Nexent 是一个开源智能体平台,基于 MCP 工具生态系统,提供灵活的多模态问答、检索、数据分析、处理等能力。"
70+
DEFAULT_APP_DESCRIPTION_EN = "Nexent is an open-source agent platform built on the MCP tool ecosystem, providing flexible multi-modal Q&A, retrieval, data analysis, and processing capabilities."
7171
DEFAULT_APP_NAME_ZH = "Nexent 智能体"
7272
DEFAULT_APP_NAME_EN = "Nexent Agent"
7373

backend/consts/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,9 @@ class TTSConnectionException(Exception):
8585

8686
class VoiceConfigException(Exception):
8787
"""Raised when voice configuration is invalid."""
88+
pass
89+
90+
91+
class ToolExecutionException(Exception):
92+
"""Raised when mcp tool execution failed."""
8893
pass

backend/consts/model.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ class ToolInfo(BaseModel):
244244
output_type: str
245245
class_name: str
246246
usage: Optional[str]
247+
origin_name: Optional[str] = None
247248

248249

249250
# used in Knowledge Summary request
@@ -340,3 +341,14 @@ class TTSResponse(BaseModel):
340341
"""Response model for TTS conversion"""
341342
status: str = Field(..., description="Status of the TTS conversion")
342343
message: Optional[str] = Field(None, description="Additional message")
344+
345+
346+
class ToolValidateRequest(BaseModel):
347+
"""Request model for tool validation"""
348+
name: str = Field(..., description="Tool name to validate")
349+
source: str = Field(..., description="Tool source (local, mcp, langchain)")
350+
usage: Optional[str] = Field(None, description="Tool usage information")
351+
inputs: Optional[Dict[str, Any]] = Field(
352+
None, description="Tool inputs")
353+
params: Optional[Dict[str, Any]] = Field(
354+
None, description="Tool configuration parameters")

backend/database/db_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class ToolInfo(TableBase):
167167

168168
tool_id = Column(Integer, primary_key=True, nullable=False, doc="ID")
169169
name = Column(String(100), doc="Unique key name")
170+
origin_name = Column(String(100), doc="Original name")
170171
class_name = Column(
171172
String(100), doc="Tool class name, used when the tool is instantiated")
172173
description = Column(String(2048), doc="Prompt tool description")

backend/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ dependencies = [
1414
"pyyaml>=6.0.2",
1515
"redis>=5.0.0",
1616
"fastmcp==2.12.0",
17+
1718
"langchain>=0.3.26",
1819
"scikit-learn>=1.3.0"
19-
]
20+
21+
2022

2123
[project.optional-dependencies]
2224
data-process = [

0 commit comments

Comments
 (0)