Skip to content

Commit 84eb074

Browse files
committed
Merge remote-tracking branch 'origin/develop' into zwb/file_preview
2 parents 6e874e2 + 5847a26 commit 84eb074

Some content is hidden

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

50 files changed

+2320
-1160
lines changed

LICENSE

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
# Nexent Open Source License
2-
3-
Nexent is licensed under the MIT License, with the following additional conditions:
4-
5-
Nexent is permitted to be used commercially, including as a backend service for other applications or as an application development platform for enterprises. However, when the following conditions are met, you must contact the producer to obtain a commercial license:
6-
7-
a. Multi-tenant SaaS service: Unless explicitly authorized by Nexent in writing, you may not use the Nexent source code to operate a multi-tenant SaaS service.
8-
b. LOGO and copyright information: In the process of using Nexent's frontend, you may not remove or modify the LOGO or copyright information in the Nexent console or applications. This restriction is inapplicable to uses of Nexent that do not involve its frontend.
9-
10-
Please contact [email protected] by email to inquire about licensing matters.
11-
12-
As a contributor, you should agree that:
13-
14-
a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
15-
b. Your contributed code may be used for commercial purposes, such as Nexent's cloud business.
16-
17-
Apart from the specific conditions mentioned above, all other rights and restrictions follow the MIT License.
18-
Detailed information about the MIT License can be found at: https://opensource.org/licenses/MIT
19-
20-
Copyright © 2025 Huawei Technologies Co., Ltd.
1+
MIT License
2+
3+
Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

backend/apps/vectordatabase_app.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from services.redis_service import get_redis_service
1919
from utils.auth_utils import get_current_user_id
2020
from utils.file_management_utils import get_all_files_status
21-
from database.knowledge_db import get_index_name_by_knowledge_name
21+
from database.knowledge_db import get_index_name_by_knowledge_name, get_knowledge_record
2222

2323
router = APIRouter(prefix="/indices")
2424
service = ElasticSearchService()
@@ -54,7 +54,7 @@ def create_new_index(
5454
embedding_dim: Optional[int] = Query(
5555
None, description="Dimension of the embedding vectors"),
5656
request: Dict[str, Any] = Body(
57-
None, description="Request body with optional fields (ingroup_permission, group_ids)"),
57+
None, description="Request body with optional fields (ingroup_permission, group_ids, embedding_model_name)"),
5858
vdb_core: VectorDatabaseCore = Depends(get_vector_db_core),
5959
authorization: Optional[str] = Header(None)
6060
):
@@ -65,9 +65,11 @@ def create_new_index(
6565
# Extract optional fields from request body
6666
ingroup_permission = None
6767
group_ids = None
68+
embedding_model_name = None
6869
if request:
6970
ingroup_permission = request.get("ingroup_permission")
7071
group_ids = request.get("group_ids")
72+
embedding_model_name = request.get("embedding_model_name")
7173

7274
# Treat path parameter as user-facing knowledge base name for new creations
7375
return ElasticSearchService.create_knowledge_base(
@@ -78,6 +80,7 @@ def create_new_index(
7880
tenant_id=tenant_id,
7981
ingroup_permission=ingroup_permission,
8082
group_ids=group_ids,
83+
embedding_model_name=embedding_model_name,
8184
)
8285
except Exception as e:
8386
raise HTTPException(
@@ -195,7 +198,16 @@ def create_index_documents(
195198
"""
196199
try:
197200
user_id, tenant_id = get_current_user_id(authorization)
198-
embedding_model = get_embedding_model(tenant_id)
201+
202+
# Get the knowledge base record to retrieve the saved embedding model
203+
knowledge_record = get_knowledge_record({'index_name': index_name})
204+
saved_embedding_model_name = None
205+
if knowledge_record:
206+
saved_embedding_model_name = knowledge_record.get('embedding_model_name')
207+
208+
# Use the saved model from knowledge base, fallback to tenant default if not set
209+
embedding_model = get_embedding_model(tenant_id, saved_embedding_model_name)
210+
199211
return ElasticSearchService.index_documents(
200212
embedding_model=embedding_model,
201213
index_name=index_name,

backend/services/model_management_service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ async def list_provider_models_for_tenant(tenant_id: str, provider: str, model_t
199199
model_list = get_models_by_tenant_factory_type(
200200
tenant_id, provider, model_type)
201201
for model in model_list:
202-
model["id"] = model["model_repo"] + "/" + model["model_name"]
202+
# Use add_repo_to_name for consistent format with /model/list API
203+
model["id"] = add_repo_to_name(
204+
model_repo=model["model_repo"],
205+
model_name=model["model_name"],
206+
)
203207

204208
logging.debug(f"Provider model {provider} created successfully")
205209
return model_list

backend/services/vectordatabase_service.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ def create_knowledge_base(
395395
tenant_id: Optional[str],
396396
ingroup_permission: Optional[str] = None,
397397
group_ids: Optional[List[int]] = None,
398+
embedding_model_name: Optional[str] = None,
398399
):
399400
"""
400401
Create a new knowledge base with a user-facing name and an internal Elasticsearch index name.
@@ -404,19 +405,37 @@ def create_knowledge_base(
404405
- Generate index_name as ``knowledge_id + '-' + uuid`` (digits and lowercase letters only).
405406
- Use generated index_name as the Elasticsearch index name.
406407
408+
Args:
409+
knowledge_name: User-facing knowledge base name
410+
embedding_dim: Dimension of the embedding vectors (optional)
411+
vdb_core: VectorDatabaseCore instance
412+
user_id: User ID who creates the knowledge base
413+
tenant_id: Tenant ID
414+
ingroup_permission: Permission level (optional)
415+
group_ids: List of group IDs (optional)
416+
embedding_model_name: Specific embedding model name to use (optional).
417+
If provided, will use this model instead of tenant default.
418+
407419
For backward compatibility, legacy callers can still use create_index() directly
408420
with an explicit index_name.
409421
"""
410422
try:
411-
embedding_model = get_embedding_model(tenant_id)
423+
# Get embedding model - use user-selected model if provided, otherwise use tenant default
424+
embedding_model = get_embedding_model(tenant_id, embedding_model_name)
425+
426+
# Determine the embedding model name to save: use user-provided name if available,
427+
# otherwise use the model's display name
428+
saved_embedding_model_name = embedding_model_name
429+
if not saved_embedding_model_name and embedding_model:
430+
saved_embedding_model_name = embedding_model.model
412431

413432
# Create knowledge record first to obtain knowledge_id and generated index_name
414433
knowledge_data = {
415434
"knowledge_name": knowledge_name,
416435
"knowledge_describe": "",
417436
"user_id": user_id,
418437
"tenant_id": tenant_id,
419-
"embedding_model_name": embedding_model.model if embedding_model else None,
438+
"embedding_model_name": saved_embedding_model_name,
420439
}
421440

422441
# Add group permission and group IDs if provided

doc/docs/.vitepress/config.mts

Lines changed: 78 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
// https://vitepress.dev/reference/site-config
1+
// https://vitepress.dev/reference/site-config
22
import { defineConfig } from "vitepress";
33

44
export default defineConfig({
55
// Set base path for GitHub Pages deployment
6-
base: (globalThis as any).process?.env?.GITHUB_PAGES ? '/nexent/' : '/',
6+
base: (globalThis as any).process?.env?.GITHUB_PAGES ? "/nexent/" : "/",
77
title: "Nexent Doc",
88
description:
99
"A zero-code platform for auto-generating agents no orchestration, no complex drag-and-drop required.",
1010

1111
// Add favicon to head
12-
head: [["link", { rel: "icon", href: (globalThis as any).process?.env?.GITHUB_PAGES ? "/nexent/favicon.ico" : "/doc/favicon.ico" }]],
12+
head: [
13+
[
14+
"link",
15+
{
16+
rel: "icon",
17+
href: (globalThis as any).process?.env?.GITHUB_PAGES
18+
? "/nexent/favicon.ico"
19+
: "/doc/favicon.ico",
20+
},
21+
],
22+
],
1323

1424
// Ignore localhost links as they are meant for local deployment access
1525
ignoreDeadLinks: [
@@ -99,16 +109,40 @@ export default defineConfig({
99109
text: "Memory Management",
100110
link: "/en/user-guide/memory-management",
101111
},
102-
{ text: "User Management", link: "/en/user-guide/user-management" },
112+
{
113+
text: "User Management",
114+
link: "/en/user-guide/user-management",
115+
},
116+
{
117+
text: "Third-party Platform Integrations",
118+
items: [
119+
{ text: "ModelEngine", link: "/en/user-guide/modelengine" },
120+
],
121+
},
103122
{
104123
text: "Local Tools",
105124
items: [
106125
{ text: "Overview", link: "/en/user-guide/local-tools/" },
107-
{ text: "File Tools", link: "/en/user-guide/local-tools/file-tools" },
108-
{ text: "Email Tools", link: "/en/user-guide/local-tools/email-tools" },
109-
{ text: "Search Tools", link: "/en/user-guide/local-tools/search-tools" },
110-
{ text: "Multimodal Tools", link: "/en/user-guide/local-tools/multimodal-tools" },
111-
{ text: "Terminal Tool", link: "/en/user-guide/local-tools/terminal-tool" },
126+
{
127+
text: "File Tools",
128+
link: "/en/user-guide/local-tools/file-tools",
129+
},
130+
{
131+
text: "Email Tools",
132+
link: "/en/user-guide/local-tools/email-tools",
133+
},
134+
{
135+
text: "Search Tools",
136+
link: "/en/user-guide/local-tools/search-tools",
137+
},
138+
{
139+
text: "Multimodal Tools",
140+
link: "/en/user-guide/local-tools/multimodal-tools",
141+
},
142+
{
143+
text: "Terminal Tool",
144+
link: "/en/user-guide/local-tools/terminal-tool",
145+
},
112146
],
113147
},
114148
],
@@ -134,9 +168,7 @@ export default defineConfig({
134168
},
135169
{
136170
text: "Frontend Development",
137-
items: [
138-
{ text: "Overview", link: "/en/frontend/overview" },
139-
],
171+
items: [{ text: "Overview", link: "/en/frontend/overview" }],
140172
},
141173
{
142174
text: "Backend Development",
@@ -184,7 +216,10 @@ export default defineConfig({
184216
text: "MCP Ecosystem",
185217
items: [
186218
{ text: "Overview", link: "/en/mcp-ecosystem/overview" },
187-
{ text: "MCP Recommendations", link: "/en/mcp-ecosystem/mcp-recommendations" },
219+
{
220+
text: "MCP Recommendations",
221+
link: "/en/mcp-ecosystem/mcp-recommendations",
222+
},
188223
{ text: "Use Cases", link: "/en/mcp-ecosystem/use-cases" },
189224
],
190225
},
@@ -289,11 +324,32 @@ export default defineConfig({
289324
text: "本地工具",
290325
items: [
291326
{ text: "概览", link: "/zh/user-guide/local-tools/" },
292-
{ text: "文件工具", link: "/zh/user-guide/local-tools/file-tools" },
293-
{ text: "邮件工具", link: "/zh/user-guide/local-tools/email-tools" },
294-
{ text: "搜索工具", link: "/zh/user-guide/local-tools/search-tools" },
295-
{ text: "多模态工具", link: "/zh/user-guide/local-tools/multimodal-tools" },
296-
{ text: "终端工具", link: "/zh/user-guide/local-tools/terminal-tool" },
327+
{
328+
text: "文件工具",
329+
link: "/zh/user-guide/local-tools/file-tools",
330+
},
331+
{
332+
text: "邮件工具",
333+
link: "/zh/user-guide/local-tools/email-tools",
334+
},
335+
{
336+
text: "搜索工具",
337+
link: "/zh/user-guide/local-tools/search-tools",
338+
},
339+
{
340+
text: "多模态工具",
341+
link: "/zh/user-guide/local-tools/multimodal-tools",
342+
},
343+
{
344+
text: "终端工具",
345+
link: "/zh/user-guide/local-tools/terminal-tool",
346+
},
347+
],
348+
},
349+
{
350+
text: "对接第三方平台",
351+
items: [
352+
{ text: "ModelEngine", link: "/zh/user-guide/modelengine" },
297353
],
298354
},
299355
],
@@ -359,7 +415,10 @@ export default defineConfig({
359415
text: "MCP 生态系统",
360416
items: [
361417
{ text: "概览", link: "/zh/mcp-ecosystem/overview" },
362-
{ text: "MCP 推荐", link: "/zh/mcp-ecosystem/mcp-recommendations" },
418+
{
419+
text: "MCP 推荐",
420+
link: "/zh/mcp-ecosystem/mcp-recommendations",
421+
},
363422
{ text: "用例场景", link: "/zh/mcp-ecosystem/use-cases" },
364423
],
365424
},

0 commit comments

Comments
 (0)