Skip to content
Merged

Develop #2768

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
5a2dee4
♻️ File preview: add page range support
Stockton11 Mar 17, 2026
ffe0ec8
✨ File preview: implement file preview frontend component
Stockton11 Mar 17, 2026
2f128da
unify error handling, secure Markdown headings, and auto-close streams
Stockton11 Mar 17, 2026
78f241e
add missing coverage for file_management
Stockton11 Mar 17, 2026
0d7cc14
add missing coverage for file_management_servive
Stockton11 Mar 17, 2026
0445259
Fix ID mapping, cache connection leaks, and zoom logic issues
Stockton11 Mar 18, 2026
ba25c9f
Unify image preview style and delete redundant i18n key
Stockton11 Mar 19, 2026
2a6ee12
supplement error message
Stockton11 Mar 20, 2026
fe60cd4
handle empty file
Stockton11 Mar 20, 2026
9a4775c
add file existence check
Stockton11 Mar 25, 2026
c3ad83c
add different delimiters in csv
Stockton11 Mar 26, 2026
db75082
modify the scaling logic
Stockton11 Mar 26, 2026
7fd5ade
fix Quality Gate failed
Stockton11 Mar 26, 2026
93a1a67
supplementary fix Quality Gate failed
Stockton11 Mar 26, 2026
2a5ce85
use secure temporary directories for LibreOffice profile
Stockton11 Mar 26, 2026
6e874e2
use secure temporary directories in test_file_management_utils
Stockton11 Mar 26, 2026
84eb074
Merge remote-tracking branch 'origin/develop' into zwb/file_preview
Stockton11 Mar 27, 2026
3e46bbf
Merge remote-tracking branch 'origin/develop' into develop
YehongPan Mar 28, 2026
e3b7afe
import rerank model
wadecrack Mar 11, 2026
5cee86c
delete some unconcerned files
wadecrack Mar 11, 2026
dc6702b
import rerank model for knowledge base,dify,datamate tool
wadecrack Mar 12, 2026
6142a4d
batch create rerank model for the poviders
wadecrack Mar 16, 2026
3bfe921
add test files for changes
wadecrack Mar 16, 2026
801a4a6
add test files for changes
wadecrack Mar 16, 2026
e562693
add test files for changes
wadecrack Mar 16, 2026
dc40614
add test files for changes
wadecrack Mar 17, 2026
9eeb454
add test files for changes
wadecrack Mar 17, 2026
39ad3eb
add test files for changes
wadecrack Mar 17, 2026
93b0936
add test files for changes
wadecrack Mar 17, 2026
ddb2b3e
add test files for changes
wadecrack Mar 17, 2026
139f18b
Add descriptions for the Rerank model to the documentation
wadecrack Mar 18, 2026
d2d2e6a
Enhance search rerank logic with oversearch strategy
wadecrack Mar 19, 2026
fd9470f
improve codecov
wadecrack Mar 19, 2026
b192230
improve codecov
wadecrack Mar 19, 2026
191444a
improve codecov
wadecrack Mar 19, 2026
3319f90
test datamate_search_tool and modeify rerank_oversearch_multipliter=10
wadecrack Mar 26, 2026
eed6cfd
♻️ Enable the interactive creation tab in SkillBuildModal.tsx
Jasonxia007 Mar 30, 2026
262b51a
Merge remote-tracking branch 'origin/develop' into develop
YehongPan Mar 30, 2026
33a70fe
📝 Add Kubernetes installation and upgrade guides.
YehongPan Mar 30, 2026
268708b
📝 Add Kubernetes installation and upgrade guides.
WMC001 Mar 31, 2026
68c1ef4
improve codecov and pass the test
wadecrack Mar 31, 2026
3cb2fec
Merge branch 'develop' into xq/develop_import_reranker_model
wadecrack Mar 31, 2026
b8e0588
✨ Support NL2Skills in frontend modals
Jasonxia007 Apr 1, 2026
0fedeea
✨ Enhance ToolConfigModal and ToolTestPanel with knowledge base selec…
Zhi-a Apr 1, 2026
c3d7bd6
🔧 Refactor ToolConfigModal: Remove unused logic for updating form val…
Zhi-a Apr 1, 2026
d8c0de7
✨ new implement : support Rerank models in model management and agen…
WMC001 Apr 2, 2026
048689d
✨ Enhance ToolConfigModal and ToolTestPanel
Zhi-a Apr 2, 2026
6f28802
Merge pull request #2749 from ModelEngine-Group/pyh/bufix_agent_creat…
WMC001 Apr 2, 2026
5cd16b8
Merge pull request #2745 from ModelEngine-Group/develop_fix_kb_2
WMC001 Apr 3, 2026
1220ebe
Merge remote-tracking branch 'origin/develop' into zwb/file_preview
Stockton11 Apr 3, 2026
6b33ecf
♻️ Greatly improve the generation speed of NL2Skills
Jasonxia007 Apr 3, 2026
4a45ea2
♻️ Clean unnecessary skill logs
Jasonxia007 Apr 3, 2026
f2079cc
Merge pull request #2751 from ModelEngine-Group/xyc/clean-logs
WMC001 Apr 3, 2026
e5dac2e
🐛 Fix agent market disconnected
WMC001 Apr 3, 2026
fe7dd96
🐛 Fix agent market disconnected 2
WMC001 Apr 3, 2026
7ae7ab9
🧪 Fix test file
Jasonxia007 Apr 3, 2026
e3900e6
🧪 Fix test file
Jasonxia007 Apr 3, 2026
166cd87
🧪 Fix test file
Jasonxia007 Apr 7, 2026
e66b0f1
Revert "🧪 Fix test file"
Jasonxia007 Apr 7, 2026
1be80e9
🧪 Fix test file
Jasonxia007 Apr 7, 2026
550b0f2
Merge remote-tracking branch 'origin/develop' into xyc/dev_skills
Jasonxia007 Apr 7, 2026
e395bcd
🐛 Fix agent market disconnected
WMC001 Apr 7, 2026
47dabd5
🧪 Add test files
Jasonxia007 Apr 7, 2026
63a87cb
🧪 Add test files
Jasonxia007 Apr 7, 2026
8e02331
🧪 Add test files
Jasonxia007 Apr 7, 2026
bff706c
🧪 Add test files
Jasonxia007 Apr 7, 2026
8d57a34
Merge pull request #2754 from ModelEngine-Group/xyc/dev_skills
WMC001 Apr 7, 2026
3cc0733
♻️ Fix 3 Regex DoS vulnerability
Jasonxia007 Apr 8, 2026
1262041
Merge remote-tracking branch 'origin/develop' into zwb/file_preview
Stockton11 Apr 8, 2026
8271ee3
✨ One-click API-to-MCP transform #2187
YehongPan Apr 8, 2026
ae350ad
✨ One-click API-to-MCP transform #2187
YehongPan Apr 8, 2026
de460d4
✨ Supports skill deletion
Jasonxia007 Apr 8, 2026
248d17c
Merge pull request #2765 from ModelEngine-Group/pyh/feat_api2mcp_develop
WMC001 Apr 9, 2026
20fbf2a
Merge pull request #2764 from ModelEngine-Group/xyc/dev_skills
WMC001 Apr 9, 2026
d5c3b6d
Merge branch 'develop' into zwb/file_preview
Stockton11 Apr 9, 2026
38160fb
Merge pull request #2709 from ModelEngine-Group/zwb/file_preview
WMC001 Apr 9, 2026
5da43e8
Merge branch 'main' into develop
WMC001 Apr 10, 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
46 changes: 25 additions & 21 deletions backend/agents/create_agent_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
ElasticSearchService,
get_vector_db_core,
get_embedding_model,
get_rerank_model,
)
from services.remote_mcp_service import get_remote_mcp_server_list
from services.memory_config_service import build_memory_context
Expand Down Expand Up @@ -296,8 +297,6 @@ async def create_agent_config(
}
system_prompt = Template(prompt_template["system_prompt"], undefined=StrictUndefined).render(render_kwargs)

_print_prompt_with_token_count(system_prompt, agent_id, "BEFORE_INJECTION")

if agent_info.get("model_id") is not None:
model_info = get_model_by_model_id(agent_info.get("model_id"))
model_name = model_info["display_name"] if model_info is not None else "main_model"
Expand Down Expand Up @@ -350,11 +349,32 @@ async def create_tool_config_list(agent_id, tenant_id, user_id, version_no: int
tool_config.metadata = langchain_tool
break

# special logic for knowledge base search tool
# special logic for search tools that may use reranking models
if tool_config.class_name == "KnowledgeBaseSearchTool":
tool_config.metadata = {
rerank = param_dict.get("rerank", False)
rerank_model_name = param_dict.get("rerank_model_name", "")
rerank_model = None
if rerank and rerank_model_name:
rerank_model = get_rerank_model(
tenant_id=tenant_id, model_name=rerank_model_name
)

tool_config.metadata = {
"vdb_core": get_vector_db_core(),
"embedding_model": get_embedding_model(tenant_id=tenant_id),
"rerank_model": rerank_model,
}
elif tool_config.class_name in ["DifySearchTool", "DataMateSearchTool"]:
rerank = param_dict.get("rerank", False)
rerank_model_name = param_dict.get("rerank_model_name", "")
rerank_model = None
if rerank and rerank_model_name:
rerank_model = get_rerank_model(
tenant_id=tenant_id, model_name=rerank_model_name
)

tool_config.metadata = {
"rerank_model": rerank_model,
}
elif tool_config.class_name == "AnalyzeTextFileTool":
tool_config.metadata = {
Expand Down Expand Up @@ -430,25 +450,9 @@ async def prepare_prompt_templates(
prompt_templates = get_agent_prompt_template(is_manager, language)
prompt_templates["system_prompt"] = system_prompt

# Print final prompt with all injections
_print_prompt_with_token_count(prompt_templates["system_prompt"], agent_id, "FINAL_PROMPT")

return prompt_templates


def _print_prompt_with_token_count(prompt: str, agent_id: int = None, stage: str = "PROMPT"):
"""Print prompt content and estimate token count using tiktoken."""
try:
import tiktoken
encoding = tiktoken.get_encoding("cl100k_base")
token_count = len(encoding.encode(prompt))
logger.info(f"[Skill Debug][{stage}] Agent {agent_id} token count: {token_count}")
logger.info(f"[Skill Debug][{stage}] Agent {agent_id} prompt:\n{prompt}")
except Exception as e:
logger.warning(f"[Skill Debug][{stage}] Failed to count tokens: {e}")
logger.info(f"[Skill Debug][{stage}] Agent {agent_id} prompt:\n{prompt}")


async def join_minio_file_description_to_query(minio_files, query):
final_query = query
if minio_files and isinstance(minio_files, list):
Expand Down Expand Up @@ -527,7 +531,7 @@ async def create_agent_run_info(
remote_mcp_list = await get_remote_mcp_server_list(tenant_id=tenant_id, is_need_auth=True)
default_mcp_url = urljoin(LOCAL_MCP_SERVER, "sse")
remote_mcp_list.append({
"remote_mcp_server_name": "nexent",
"remote_mcp_server_name": "outer-apis",
"remote_mcp_server": default_mcp_url,
"status": True,
"authorization_token": None
Expand Down
122 changes: 122 additions & 0 deletions backend/agents/skill_creation_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
"""Skill creation agent module for interactive skill generation."""

import logging
import threading
from typing import List

from nexent.core.agents.agent_model import AgentConfig, AgentRunInfo, ModelConfig, ToolConfig
from nexent.core.agents.run_agent import agent_run_thread
from nexent.core.utils.observer import MessageObserver

logger = logging.getLogger("skill_creation_agent")


def create_skill_creation_agent_config(
system_prompt: str,
model_config_list: List[ModelConfig],
local_skills_dir: str = ""
) -> AgentConfig:
"""
Create agent config for skill creation with builtin tools.

Args:
system_prompt: Custom system prompt to replace smolagent defaults
model_config_list: List of model configurations

Returns:
AgentConfig configured for skill creation
"""
if not model_config_list:
raise ValueError("model_config_list cannot be empty")

first_model = model_config_list[0]

prompt_templates = {
"system_prompt": system_prompt,
"managed_agent": {
"task": "{task}",
"report": "## {name} Report\n\n{final_answer}"
},
"planning": {
"initial_plan": "",
"update_plan_pre_messages": "",
"update_plan_post_messages": ""
},
"final_answer": {
"pre_messages": "",
"post_messages": ""
}
}

return AgentConfig(
name="__skill_creator__",
description="Internal skill creator agent",
prompt_templates=prompt_templates,
tools=[],
max_steps=5,
model_name=first_model.cite_name
)


def run_skill_creation_agent(
query: str,
agent_config: AgentConfig,
model_config_list: List[ModelConfig],
observer: MessageObserver,
stop_event: threading.Event,
) -> None:
"""
Run the skill creator agent synchronously.

Args:
query: User query for the agent
agent_config: Pre-configured agent config
model_config_list: List of model configurations
observer: Message observer for capturing agent output
stop_event: Threading event for cancellation
"""
agent_run_info = AgentRunInfo(
query=query,
model_config_list=model_config_list,
observer=observer,
agent_config=agent_config,
stop_event=stop_event
)

agent_run_thread(agent_run_info)


def create_simple_skill_from_request(
system_prompt: str,
user_prompt: str,
model_config_list: List[ModelConfig],
observer: MessageObserver,
stop_event: threading.Event,
local_skills_dir: str = ""
) -> None:
"""
Run skill creation agent to create a skill interactively.

The agent will write the skill content to tmp.md in local_skills_dir.
Frontend should read tmp.md after agent completes to get the skill content.

Args:
system_prompt: System prompt with skill creation instructions
user_prompt: User's skill description request
model_config_list: List of model configurations
observer: Message observer for capturing agent output
stop_event: Threading event for cancellation
local_skills_dir: Path to local skills directory for file operations
"""
agent_config = create_skill_creation_agent_config(
system_prompt=system_prompt,
model_config_list=model_config_list,
local_skills_dir=local_skills_dir
)

thread_agent = threading.Thread(
target=run_skill_creation_agent,
args=(user_prompt, agent_config, model_config_list, observer, stop_event)
)
thread_agent.start()
thread_agent.join()
Loading
Loading