Skip to content

Commit 484c7fe

Browse files
authored
Merge branch 'develop' into patch-1
2 parents 56c1120 + 4c06635 commit 484c7fe

34 files changed

+2349
-177
lines changed

backend/agents/create_agent_info.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from nexent.core.agents.agent_model import AgentRunInfo, ModelConfig, AgentConfig, ToolConfig
1010
from nexent.memory.memory_service import search_memory_in_levels
1111

12+
from services.file_management_service import get_llm_model
1213
from services.vectordatabase_service import (
1314
ElasticSearchService,
1415
get_vector_db_core,
@@ -17,13 +18,15 @@
1718
from services.tenant_config_service import get_selected_knowledge_list
1819
from services.remote_mcp_service import get_remote_mcp_server_list
1920
from services.memory_config_service import build_memory_context
21+
from services.image_service import get_vlm_model
2022
from database.agent_db import search_agent_info_by_agent_id, query_sub_agents_id_list
2123
from database.tool_db import search_tools_for_sub_agent
2224
from database.model_management_db import get_model_records, get_model_by_model_id
25+
from database.client import minio_client
2326
from utils.model_name_utils import add_repo_to_name
2427
from utils.prompt_template_utils import get_agent_prompt_template
2528
from utils.config_utils import tenant_config_manager, get_model_name_from_config
26-
from consts.const import LOCAL_MCP_SERVER, MODEL_CONFIG_MAPPING, LANGUAGE
29+
from consts.const import LOCAL_MCP_SERVER, MODEL_CONFIG_MAPPING, LANGUAGE, DATA_PROCESS_SERVICE
2730

2831
logger = logging.getLogger("create_agent_info")
2932
logger.setLevel(logging.DEBUG)
@@ -236,6 +239,18 @@ async def create_tool_config_list(agent_id, tenant_id, user_id):
236239
"vdb_core": get_vector_db_core(),
237240
"embedding_model": get_embedding_model(tenant_id=tenant_id),
238241
}
242+
elif tool_config.class_name == "AnalyzeTextFileTool":
243+
tool_config.metadata = {
244+
"llm_model": get_llm_model(tenant_id=tenant_id),
245+
"storage_client": minio_client,
246+
"data_process_service_url": DATA_PROCESS_SERVICE
247+
}
248+
elif tool_config.class_name == "AnalyzeImageTool":
249+
tool_config.metadata = {
250+
"vlm_model": get_vlm_model(tenant_id=tenant_id),
251+
"storage_client": minio_client,
252+
}
253+
239254
tool_config_list.append(tool_config)
240255

241256
return tool_config_list

backend/consts/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ class VectorDatabaseType(str, Enum):
279279
os.getenv("LLM_SLOW_TOKEN_RATE_THRESHOLD", "10.0")) # tokens per second
280280

281281
# APP Version
282-
APP_VERSION = "v1.7.6"
282+
APP_VERSION = "v1.7.7"
283283

284284
DEFAULT_ZH_TITLE = "新对话"
285285
DEFAULT_EN_TITLE = "New Conversation"

backend/services/file_management_service.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from fastapi import UploadFile
1111

1212
from agents.preprocess_manager import preprocess_manager
13-
from consts.const import UPLOAD_FOLDER, MAX_CONCURRENT_UPLOADS, DATA_PROCESS_SERVICE, LANGUAGE
13+
from consts.const import UPLOAD_FOLDER, MAX_CONCURRENT_UPLOADS, DATA_PROCESS_SERVICE, LANGUAGE, MODEL_CONFIG_MAPPING
1414
from database.attachment_db import (
1515
upload_fileobj,
1616
get_file_url,
@@ -19,11 +19,15 @@
1919
delete_file,
2020
list_files
2121
)
22-
from utils.attachment_utils import convert_image_to_text, convert_long_text_to_text
2322
from services.vectordatabase_service import ElasticSearchService, get_vector_db_core
23+
from utils.attachment_utils import convert_image_to_text, convert_long_text_to_text
24+
from utils.config_utils import tenant_config_manager, get_model_name_from_config
2425
from utils.prompt_template_utils import get_file_processing_messages_template
2526
from utils.file_management_utils import save_upload_file
2627

28+
from nexent import MessageObserver
29+
from nexent.core.models import OpenAILongContextModel
30+
2731
# Create upload directory
2832
upload_dir = Path(UPLOAD_FOLDER)
2933
upload_dir.mkdir(exist_ok=True)
@@ -405,3 +409,16 @@ def get_file_description(files: List[UploadFile]) -> str:
405409
else:
406410
description += f"- File {file.filename or ''}\n"
407411
return description
412+
413+
def get_llm_model(tenant_id: str):
414+
# Get the tenant config
415+
main_model_config = tenant_config_manager.get_model_config(
416+
key=MODEL_CONFIG_MAPPING["llm"], tenant_id=tenant_id)
417+
long_text_to_text_model = OpenAILongContextModel(
418+
observer=MessageObserver(),
419+
model_id=get_model_name_from_config(main_model_config),
420+
api_base=main_model_config.get("base_url"),
421+
api_key=main_model_config.get("api_key"),
422+
max_context_tokens=main_model_config.get("max_tokens")
423+
)
424+
return long_text_to_text_model

backend/services/image_service.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
import aiohttp
55

66
from consts.const import DATA_PROCESS_SERVICE
7+
from consts.const import MODEL_CONFIG_MAPPING
8+
from utils.config_utils import tenant_config_manager, get_model_name_from_config
9+
10+
from nexent import MessageObserver
11+
from nexent.core.models import OpenAIVLModel
712

813
logger = logging.getLogger("image_service")
914

@@ -23,3 +28,19 @@ async def proxy_image_impl(decoded_url: str):
2328

2429
result = await response.json()
2530
return result
31+
32+
def get_vlm_model(tenant_id: str):
33+
# Get the tenant config
34+
vlm_model_config = tenant_config_manager.get_model_config(
35+
key=MODEL_CONFIG_MAPPING["vlm"], tenant_id=tenant_id)
36+
return OpenAIVLModel(
37+
observer=MessageObserver(),
38+
model_id=get_model_name_from_config(
39+
vlm_model_config) if vlm_model_config else "",
40+
api_base=vlm_model_config.get("base_url", ""),
41+
api_key=vlm_model_config.get("api_key", ""),
42+
temperature=0.7,
43+
top_p=0.7,
44+
frequency_penalty=0.5,
45+
max_tokens=512
46+
)

backend/services/tool_configuration_service.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import jsonref
1212
from mcpadapt.smolagents_adapter import _sanitize_function_name
1313

14-
from consts.const import DEFAULT_USER_ID, LOCAL_MCP_SERVER
14+
from consts.const import DEFAULT_USER_ID, LOCAL_MCP_SERVER, DATA_PROCESS_SERVICE
1515
from consts.exceptions import MCPConnectionError, ToolExecutionException, NotFoundException
1616
from consts.model import ToolInstanceInfoRequest, ToolInfo, ToolSourceEnum, ToolValidateRequest
1717
from database.remote_mcp_db import get_mcp_records_by_tenant, get_mcp_server_by_name_and_tenant
@@ -23,8 +23,11 @@
2323
search_last_tool_instance_by_tool_id,
2424
)
2525
from database.user_tenant_db import get_all_tenant_ids
26+
from services.file_management_service import get_llm_model
2627
from services.vectordatabase_service import get_embedding_model, get_vector_db_core
2728
from services.tenant_config_service import get_selected_knowledge_list
29+
from database.client import minio_client
30+
from services.image_service import get_vlm_model
2831

2932
logger = logging.getLogger("tool_configuration_service")
3033

@@ -613,6 +616,27 @@ def _validate_local_tool(
613616
'embedding_model': embedding_model,
614617
}
615618
tool_instance = tool_class(**params)
619+
elif tool_name == "analyze_image":
620+
if not tenant_id or not user_id:
621+
raise ToolExecutionException(f"Tenant ID and User ID are required for {tool_name} validation")
622+
image_to_text_model = get_vlm_model(tenant_id=tenant_id)
623+
params = {
624+
**instantiation_params,
625+
'vlm_model': image_to_text_model,
626+
'storage_client': minio_client
627+
}
628+
tool_instance = tool_class(**params)
629+
elif tool_name == "analyze_text_file":
630+
if not tenant_id or not user_id:
631+
raise ToolExecutionException(f"Tenant ID and User ID are required for {tool_name} validation")
632+
long_text_to_text_model = get_llm_model(tenant_id=tenant_id)
633+
params = {
634+
**instantiation_params,
635+
'llm_model': long_text_to_text_model,
636+
'storage_client': minio_client,
637+
"data_process_service_url": DATA_PROCESS_SERVICE
638+
}
639+
tool_instance = tool_class(**params)
616640
else:
617641
tool_instance = tool_class(**instantiation_params)
618642

doc/docs/en/opensource-memorial-wall.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ Each message should include your name/handle and date.
1616
Keep messages respectful and in line with our Code of Conduct.
1717
-->
1818

19-
::: info techbro_kevin - 2025-06-15
20-
first time doing open source, nexent is pretty cool! natural language to create agents, way easier than i thought
19+
::: tip product_guy - 2025-02-07
20+
no more PRDs!! just describe in plain english and devs get it instantly
2121
:::
2222

23-
::: warning Dr. Chen - AI Algorithm Engineer - 2025-06-25
24-
Moving from LangChain to the MCP ecosystem was definitely the right choice. Nexent's MCP tool integration makes our team's workflow much more standardized, especially when handling enterprise applications. The "USB-C of AI" analogy is so apt! Now our agents can seamlessly connect to various external services - no more headaches over different API formats.
23+
::: info techbro_kevin - 2025-06-15
24+
first time doing open source, nexent is pretty cool! natural language to create agents, way easier than i thought
2525
:::
2626

2727
::: tip startup_dev - 2025-06-18
@@ -36,6 +36,10 @@ working on multi-agent stuff, the knowledge tracing feature caught my eye. built
3636
first contribution was fixing a typo lmao... but community is super friendly! now using nexent for personal knowledge management, feels like having a second brain
3737
:::
3838

39+
::: warning Dr. Chen - AI Algorithm Engineer - 2025-06-25
40+
Moving from LangChain to the MCP ecosystem was definitely the right choice. Nexent's MCP tool integration makes our team's workflow much more standardized, especially when handling enterprise applications. The "USB-C of AI" analogy is so apt! Now our agents can seamlessly connect to various external services - no more headaches over different API formats.
41+
:::
42+
3943
::: warning mldev2025 - 2025-06-25
4044
moved from langchain to MCP, good choice. the "USB-C of AI" analogy is spot on
4145
:::
@@ -44,10 +48,6 @@ moved from langchain to MCP, good choice. the "USB-C of AI" analogy is spot on
4448
zero-code actually works! just described what i wanted and boom, got an agent. handles pdfs and everything
4549
:::
4650

47-
::: tip product_guy - 2025-02-07
48-
no more PRDs!! just describe in plain english and devs get it instantly
49-
:::
50-
5151
::: info Tom Park - University of Toronto CS Student - 2025-08-03
5252
International student here! Started contributing to Nexent as part of my open source class assignment, but ended up loving the project. The documentation is so well-written that even non-native English speakers like me can easily understand and contribute. I helped translate some docs and built a study group coordination agent for our international student community. The multimodal support works great for students who prefer different communication styles!
5353
:::
@@ -69,5 +69,5 @@ Nexent represents the future of intelligent agent creation — simple, elegant,
6969
:::
7070

7171
::: info uu - 2024-01-15
72-
华为ICT智能体,感谢nexent平台支持!
72+
Huawei ICT Agent, thanks to the nexent platform for its support!
7373
:::

0 commit comments

Comments
 (0)