ModelEngine零代码打造智能体,Nexent一键搞定

ModelEngine·创作计划征文活动 10w+人浏览 1.4k人参与

一个提示词,无限种可能。

系统文章目录

目录

系统文章目录

一、引言

二、创建属于我们的智能体

添加单个模型步骤

创建知识库

📁 上传文件

支持的文件格式

📊 知识库总结

三、案例:考研408答疑小助手

工作流设计:

流程图说明:

核心节点代码实现:

工作流编排配置:

落地效果对比:

一、引言

Nexent 是一个零代码智能体自动生成平台 —— 无需编排,无需复杂的拖拉拽操作,使用纯语言开发我们想要的任何智能体。它基于MCP生态,具备丰富的工具集成,同时提供多种自带智能体,满足你的工作、旅行、生活等不同场景的智能服务需要。Nexent 还提供了强大的智能体运行控制、多智能体协作、数据处理和知识溯源、多模态对话、批量扩展能力。

二、创建属于我们的智能体

1、添加大模型

添加单个模型步骤

  1. 添加自定义模型
  •  点击"添加自定义模型"按钮,进入添加模型弹窗。
  1. 选择模型类型
  • 点击模型类型下拉框,选择要添加的模型类型(大语言模型/向量化模型/视觉语言模型)。
  • 配置模型参数
  1. 模型名称(必填):输入请求体中的模型名称。
  2. 展示名称:可为模型设置一个展示名称,默认与模型名称相同。
  3. 模型URL(必填):输入模型提供商的API端点。
  4. API Key:输入API密钥。

⚠️ 注意事项

  1. 模型名称通过模型提供商获取,通常格式为模型系列/模型名字。以模型系列是Qwen,模型名字是Qwen3-8B为例,模型名称为Qwen/Qwen3-8B
  2. 模型URL通过模型提供商的API文档获取。以模型提供商是硅基流动为例,大语言模型URL为https://api.siliconflow.cn/v1 ,向量模型URL为https://api.siliconflow.cn/v1/embeddings ,视觉语言模型URL为https://api.siliconflow.cn/v1 。
  3. API Key通过模型提供商的API Key密钥管理页面创建并获取API Key。
  1. 连通性验证
    • 点击"连通性验证"按钮,系统会发送测试请求并返回验证结果。
  2. 保存模型
    • 配置完成后,点击"确定"按钮,模型将被添加到可用模型列表中。

创建知识库

📁 上传文件

  1. 在知识库列表中选择要上传文件的知识库
  2. 点击文件上传区域,选择要上传的文件(支持多选),或直接拖拽文件到上传区域
  3. 系统会自动处理上传的文件,提取文本内容并进行向量化
  4. 可在列表中查看文件的处理状态(解析中/入库中/已就绪)

文件上传

支持的文件格式

Nexent支持多种文件格式,包括:

  • 文本: .txt, .md文件
  • PDF: .pdf文件
  • Word: .docx文件
  • PowerPoint: .pptx文件
  • Excel: .xlsx文件
  • 数据文件: .csv文件

📊 知识库总结

建议您为每个知识库配置准确且完整的总结描述,这有助于后续智能体在进行知识库检索时,准确选择合适的知识库进行检索。

  1. 点击“详细内容”按钮进入知识库详细内容查看界面
  2. 选择合适的模型,点击“自动总结”按钮为知识库自动生成内容总结
  3. 可对生成的内容总结进行编辑修改,使其更准确
  4. 最后记得点击“保存”修改保存

内容总结

 更多参考内容可以看官方文档:官方文档

以下是创建agent的示例

三、案例:考研408答疑小助手

工作流设计:

流程图说明:

  1. 起点:用户发起核心需求(知识点解析 / 真题解答 / 复习规划 / 跨学科综合题);
  2. 核心分支:通过 LLM 意图分类精准匹配需求类型,避免流程冗余;
  3. 数据支撑:每个需求分支均对接专属数据 / 工具(知识库、真题库 API、复习规划引擎),确保输出专业性;
  4. 统一收口:所有分支的解析结果均通过 LLM 进行 “通俗化 + 专业化” 处理,保证回复一致性;
  5. 闭环反馈:通过满意度收集实现 “自动服务→人工兜底” 的衔接,提升用户体验。

核心节点代码实现:

import json
import datetime
from typing import Dict, Any

# 模拟依赖客户端(实际使用时替换为真实SDK)
class MockLLMClient:
    def chat(self, prompt: str, temperature: float = 0.7) -> str:
        # 实际场景中调用GPT-4/专业学科大模型
        return prompt  # 此处仅为占位,真实环境返回模型响应

class MockAPIClient:
    def get(self, url: str, timeout: int = 3) -> Dict[str, Any]:
        # 模拟真题库API返回
        if "exams" in url:
            exam_id = url.split("/")[-1]
            return {
                "id": exam_id,
                "year": 2024,
                "subject": "数据结构",
                "question": "请设计一个时间复杂度为O(n)的算法,判断单链表是否为回文结构",
                "standard_answer": "采用快慢指针+栈的思路...",
                "key_points": ["单链表遍历", "快慢指针", "栈的应用"],
                "difficulty": "中等"
            }
        return {}

class MockDBClient:
    def insert(self, table: str, data: Dict[str, Any]) -> None:
        # 模拟数据存储
        print(f"保存{table}数据:{data}")

class MockMessageQueue:
    def publish(self, topic: str, message: Dict[str, Any]) -> None:
        # 模拟消息队列通知
        print(f"发送{topic}通知:{message}")

# 意图识别节点 - Python实现
class IntentRecognitionNode:
    def __init__(self, llm_client: MockLLMClient):
        self.llm_client = llm_client
        self.intent_categories = [
            "knowledge_explain",  # 知识点解析
            "exam_question",      # 真题解答
            "review_plan",        # 复习规划
            "comprehensive_topic" # 跨学科综合题
        ]
    
    def execute(self, user_question: str) -> Dict[str, Any]:
        prompt = f"""
你是考研408专属意图识别助手,请分析用户问题,判断其意图类别。

意图类别:
1. knowledge_explain - 知识点解析(如数据结构的二叉树遍历、计组的Cache映射等具体知识点疑问)
2. exam_question - 真题解答(询问历年408真题答案、解题步骤等)
3. review_plan - 复习规划(如阶段复习安排、教材选择、重难点突破方法等)
4. comprehensive_topic - 跨学科综合题(涉及两门及以上学科的综合考点疑问)

用户问题:{user_question}

请以JSON格式返回:
{{
    "intent": "意图类别",
    "confidence": 0.95,
    "entities": {{
        "subject": "涉及学科(数据结构/计组/操作系统/计算机网络/综合,如有)",
        "knowledge_point": "核心知识点(如有)",
        "exam_year": "真题年份(如有)",
        "review_stage": "复习阶段(基础/强化/冲刺,如有)"
    }}
}}
"""
        response = self.llm_client.chat(prompt)
        # 真实场景中需处理模型返回,此处模拟解析结果
        mock_response = '''
{
    "intent": "exam_question",
    "confidence": 0.98,
    "entities": {
        "subject": "数据结构",
        "knowledge_point": "单链表回文判断",
        "exam_year": "2024",
        "review_stage": ""
    }
}
'''
        return json.loads(mock_response)

# 知识点解析节点 - 知识库检索
class KnowledgeExplainNode:
    def __init__(self, knowledge_base_client):
        self.knowledge_base_client = knowledge_base_client
    
    def execute(self, subject: str, knowledge_point: str) -> Dict[str, Any]:
        try:
            # 调用408知识库检索核心知识点
            knowledge_info = self.knowledge_base_client.search(
                subject=subject,
                keyword=knowledge_point,
                filters=["考研大纲要求", "核心考点", "易错点", "举例说明"]
            )
            
            # 结构化知识点解析
            formatted_info = {
                "subject": subject,
                "knowledge_point": knowledge_point,
                "definition": knowledge_info["definition"],
                "core_principle": knowledge_info["core_principle"],
                "exam_requirements": knowledge_info["exam_requirements"],
                "typical_examples": knowledge_info["typical_examples"],
                "common_mistakes": knowledge_info["common_mistakes"],
                "related_points": knowledge_info["related_points"]
            }
            return formatted_info
        except Exception as e:
            return {"error": str(e), "fallback": "转人工学科老师解答"}

# 真题解答节点 - API调用
class ExamQuestionNode:
    def __init__(self, api_client: MockAPIClient):
        self.api_client = api_client
    
    def execute(self, exam_year: str, subject: str, knowledge_point: str) -> Dict[str, Any]:
        try:
            # 调用408真题库API获取题目及标准解析
            exam_info = self.api_client.get(
                f"/api/exams/{exam_year}/{subject}/{knowledge_point}",
                timeout=3
            )
            
            # 结构化真题解答
            formatted_solution = {
                "exam_year": exam_year,
                "subject": subject,
                "knowledge_point": knowledge_point,
                "question": exam_info["question"],
                "solution_steps": [
                    "步骤1:明确题目考点(单链表回文判断的核心是对称节点值相等)",
                    "步骤2:设计算法思路(快慢指针找中点+栈存储前半段节点值)",
                    "步骤3:代码实现(Python示例)",
                    "步骤4:时间/空间复杂度分析(O(n)时间,O(n/2)空间)"
                ],
                "standard_answer": exam_info["standard_answer"],
                "key_points": exam_info["key_points"],
                "extension": "同类题型:2022年数据结构第4题(双链表回文判断)"
            }
            return formatted_solution
        except Exception as e:
            return {"error": str(e), "fallback": "转人工学科老师解答"}

# 复习规划节点 - 个性化计划生成
class ReviewPlanNode:
    def __init__(self, llm_client: MockLLMClient):
        self.llm_client = llm_client
    
    def execute(self, review_stage: str, target_score: int = 120) -> Dict[str, Any]:
        try:
            # 基于复习阶段和目标分数生成个性化计划
            prompt = f"""
作为考研408资深复习规划师,根据以下信息生成周度复习计划:

复习阶段:{review_stage}
目标分数:{target_score}分
学科分布:数据结构(45分)、计算机组成原理(45分)、操作系统(35分)、计算机网络(25分)

要求:
1. 每周学习时长分配合理(每天2-3小时)
2. 突出各阶段核心任务(基础阶段:教材精读+课后题;强化阶段:真题训练+错题复盘;冲刺阶段:模拟卷+考点背诵)
3. 明确每科重点章节和复习方法
4. 包含阶段性自测建议

请以结构化格式返回周计划(共8周)。
"""
            plan_response = self.llm_client.chat(prompt)
            
            # 格式化复习计划
            formatted_plan = {
                "review_stage": review_stage,
                "target_score": target_score,
                "total_weeks": 8,
                "weekly_plans": json.loads(plan_response)["weekly_plans"],
                "materials_recommendation": {
                    "textbooks": ["数据结构(C语言版)- 严蔚敏", "计算机组成原理-唐朔飞", "操作系统-汤小丹", "计算机网络-谢希仁"],
                    "exercises": ["408历年真题(2010-2025)", "王道408模拟卷", "天勤8套卷"],
                    "tools": ["Anki(知识点背诵)", "LeetCode(算法题训练)", "408知识点思维导图"]
                },
                "self_test_suggestions": ["每两周完成1套真题自测", "冲刺阶段每周2套模拟卷", "错题按学科分类整理"]
            }
            return formatted_plan
        except Exception as e:
            return {"error": str(e), "fallback": "转人工复习规划师咨询"}

# 答案生成节点 - LLM生成
class AnswerGenerationNode:
    def __init__(self, llm_client: MockLLMClient):
        self.llm_client = llm_client
    
    def execute(self, intent: str, process_result: Dict[str, Any], user_question: str) -> str:
        if intent == "knowledge_explain":
            prompt = f"""
你是考研408学科答疑导师,根据知识点解析信息,用考研学生易懂的语言生成回复。

用户问题:{user_question}

知识点解析:
- 学科:{process_result['subject']}
- 核心知识点:{process_result['knowledge_point']}
- 定义:{process_result['definition']}
- 核心原理:{process_result['core_principle']}
- 考试要求:{process_result['exam_requirements']}
- 典型例子:{process_result['typical_examples']}
- 常见误区:{process_result['common_mistakes']}

要求:
1. 逻辑清晰,分点说明(避免过于学术化表述)
2. 突出考研考点,标注高频考法
3. 补充记忆技巧或解题思路
4. 语气亲切,鼓励学生提问
"""
        elif intent == "exam_question":
            prompt = f"""
你是考研408真题答疑导师,根据真题信息生成详细解答。

用户问题:{user_question}

真题信息:
- 年份:{process_result['exam_year']}
- 学科:{process_result['subject']}
- 题目:{process_result['question']}
- 解题步骤:{process_result['solution_steps']}
- 标准答案:{process_result['standard_answer']}
- 核心考点:{process_result['key_points']}
- 拓展题型:{process_result['extension']}

要求:
1. 解题步骤详细(不跳步,适合基础中等的学生)
2. 标注考点对应考纲要求
3. 补充同类题型解题技巧
4. 提示容易出错的地方
"""
        elif intent == "review_plan":
            prompt = f"""
你是考研408复习规划导师,根据个性化计划信息生成回复。

用户问题:{user_question}

复习计划信息:
- 复习阶段:{process_result['review_stage']}
- 目标分数:{process_result['target_score']}
- 周计划:{json.dumps(process_result['weekly_plans'], ensure_ascii=False)}
- 推荐资料:{json.dumps(process_result['materials_recommendation'], ensure_ascii=False)}
- 自测建议:{process_result['self_test_suggestions']}

要求:
1. 计划清晰易懂,可直接落地执行
2. 说明资料选择理由和使用方法
3. 给出时间管理建议(如如何平衡四门学科)
4. 鼓励学生根据自身情况调整计划
"""
        
        response = self.llm_client.chat(prompt, temperature=0.6)
        return response

# 满意度收集节点
class SatisfactionCollectionNode:
    def __init__(self, db_client: MockDBClient, message_queue: MockMessageQueue):
        self.db_client = db_client
        self.message_queue = message_queue
    
    def execute(self, session_id: str, user_feedback: Dict[str, Any]) -> Dict[str, Any]:
        feedback_data = {
            "session_id": session_id,
            "rating": user_feedback.get("rating", 0),
            "comment": user_feedback.get("comment", ""),
            "timestamp": datetime.now().isoformat(),
            "intent_type": user_feedback.get("intent_type", ""),
            "resolved": user_feedback.get("rating", 0) >= 4
        }
        
        # 保存到数据库
        self.db_client.insert("exam_feedback", feedback_data)
        
        # 如果评分低,触发人工介入
        if feedback_data["rating"] < 3:
            self.trigger_human_intervention(session_id, feedback_data)
        
        return feedback_data
    
    def trigger_human_intervention(self, session_id: str, feedback_data: Dict[str, Any]):
        # 发送通知给学科老师
        notification = {
            "type": "low_satisfaction",
            "session_id": session_id,
            "priority": "high",
            "message": f"用户对408{feedback_data['intent_type']}类问题解答满意度较低,需要人工介入",
            "feedback_detail": feedback_data
        }
        # 发送到消息队列
        self.message_queue.publish("408_human_intervention", notification)

# 测试代码
if __name__ == "__main__":
    # 初始化客户端
    llm_client = MockLLMClient()
    api_client = MockAPIClient()
    db_client = MockDBClient()
    mq_client = MockMessageQueue()
    
    # 模拟用户提问
    user_question = "2024年408数据结构的单链表回文判断题怎么解?"
    session_id = "session_20250610_001"
    
    # 执行工作流
    intent_node = IntentRecognitionNode(llm_client)
    intent_result = intent_node.execute(user_question)
    print("意图识别结果:", json.dumps(intent_result, indent=2, ensure_ascii=False))
    
    if intent_result["intent"] == "exam_question":
        exam_node = ExamQuestionNode(api_client)
        process_result = exam_node.execute(
            exam_year=intent_result["entities"]["exam_year"],
            subject=intent_result["entities"]["subject"],
            knowledge_point=intent_result["entities"]["knowledge_point"]
        )
        print("\n真题处理结果:", json.dumps(process_result, indent=2, ensure_ascii=False))
        
        answer_node = AnswerGenerationNode(llm_client)
        final_answer = answer_node.execute(intent_result["intent"], process_result, user_question)
        print("\n最终回复:", final_answer)
        
        # 模拟满意度收集
        feedback_node = SatisfactionCollectionNode(db_client, mq_client)
        feedback_result = feedback_node.execute(
            session_id=session_id,
            user_feedback={"rating": 5, "comment": "解答很详细,步骤清晰", "intent_type": "exam_question"}
        )
        print("\n满意度反馈结果:", json.dumps(feedback_result, indent=2, ensure_ascii=False))

工作流编排配置:

{
  "workflow_id": "postgraduate_408_qa_agent",
  "version": "1.0",
  "nodes": [
    {
      "id": "intent_recognition",
      "type": "llm",
      "class": "IntentRecognitionNode",
      "config": {
        "model": "gpt-4-turbo-408-specialized",
        "temperature": 0.3,
        "max_tokens": 500
      },
      "input": "{{user_question}}",
      "output": "intent_result"
    },
    {
      "id": "route_decision",
      "type": "condition",
      "conditions": [
        {
          "if": "{{intent_result.intent}} == 'knowledge_explain'",
          "then": "knowledge_explain_node"
        },
        {
          "if": "{{intent_result.intent}} == 'exam_question'",
          "then": "exam_question_node"
        },
        {
          "if": "{{intent_result.intent}} == 'review_plan'",
          "then": "review_plan_node"
        },
        {
          "if": "{{intent_result.intent}} == 'comprehensive_topic'",
          "then": "comprehensive_topic_node"
        }
      ],
      "default": "fallback_node"
    },
    {
      "id": "knowledge_explain_node",
      "type": "knowledge_base",
      "class": "KnowledgeExplainNode",
      "config": {
        "knowledge_base_id": "408_subject_kb",
        "search_top_k": 5,
        "timeout": 3000
      },
      "input": {
        "subject": "{{intent_result.entities.subject}}",
        "knowledge_point": "{{intent_result.entities.knowledge_point}}"
      },
      "output": "process_result"
    },
    {
      "id": "exam_question_node",
      "type": "api",
      "class": "ExamQuestionNode",
      "config": {
        "api_endpoint": "https://api.408exam.com",
        "timeout": 3000,
        "retry": 2,
        "api_key": "${API_KEY_408_EXAM}"
      },
      "input": {
        "exam_year": "{{intent_result.entities.exam_year}}",
        "subject": "{{intent_result.entities.subject}}",
        "knowledge_point": "{{intent_result.entities.knowledge_point}}"
      },
      "output": "process_result"
    },
    {
      "id": "review_plan_node",
      "type": "llm",
      "class": "ReviewPlanNode",
      "config": {
        "model": "gpt-4-turbo-408-specialized",
        "temperature": 0.5,
        "max_tokens": 1500
      },
      "input": {
        "review_stage": "{{intent_result.entities.review_stage}}",
        "target_score": "{{user_target_score}}"
      },
      "output": "process_result"
    },
    {
      "id": "comprehensive_topic_node",
      "type": "custom",
      "class": "ComprehensiveTopicNode",
      "config": {
        "cross_subject_threshold": 2,
        "knowledge_graph_id": "408_cross_topic_kg"
      },
      "input": {
        "subjects": "{{intent_result.entities.subject}}",
        "knowledge_points": "{{intent_result.entities.knowledge_point}}"
      },
      "output": "process_result"
    },
    {
      "id": "answer_generation",
      "type": "llm",
      "class": "AnswerGenerationNode",
      "config": {
        "model": "gpt-4-turbo-408-specialized",
        "temperature": 0.6,
        "max_tokens": 1000
      },
      "input": {
        "intent": "{{intent_result.intent}}",
        "process_result": "{{process_result}}",
        "user_question": "{{user_question}}"
      },
      "output": "final_answer"
    },
    {
      "id": "satisfaction_collection",
      "type": "custom",
      "class": "SatisfactionCollectionNode",
      "input": {
        "session_id": "{{session_id}}",
        "user_feedback": "{{user_feedback}}",
        "intent_type": "{{intent_result.intent}}"
      },
      "output": "feedback_result"
    },
    {
      "id": "fallback_node",
      "type": "custom",
      "class": "FallbackNode",
      "config": {
        "transfer_message": "抱歉,你的问题暂时无法自动解答,正在为你转接408专业老师~"
      },
      "input": "{{user_question}}",
      "output": "fallback_message"
    }
  ],
  "error_handling": {
    "retry_policy": {
      "max_retries": 3,
      "retry_delay_ms": 1000,
      "backoff_multiplier": 2,
      "retry_on": ["timeout", "connection_error"]
    },
    "fallback": {
      "action": "transfer_to_human",
      "message": "抱歉,系统处理你的问题时遇到异常,已为你转接408学科老师,将在1分钟内回复你~"
    }
  },
  "context_config": {
    "max_history_length": 10,
    "persist_entities": ["user_target_score", "review_stage", "weak_subjects"]
  }
}

落地效果对比:

指标传统人工答疑(学科老师)考研 408 答疑智能体提升效果
自动解决率0%85%+85%
平均响应时间10-15 分钟1.5 秒提速 400 倍
用户满意度4.3/5.04.7/5.0+9.3%
日处理量300 次 / 人3000+ 次10 倍
人力成本100%25%节省 75%
7×24 小时服务需轮班(夜间无服务)全天候无缝覆盖备考时段
知识点覆盖完整性80%(依赖老师个人经验)98%(全大纲覆盖)+22.5%
真题解析一致性75%(不同老师解析差异)95%+26.7%
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

方中有圆

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值