RuleGo RuleGo
🏠首页
  • 快速入门
  • 规则链
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 可视化
  • RuleGo-Server
  • AOP
  • 触发器
  • 高级主题
  • 性能
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 流式计算
  • 组件市场
  • 概述
  • 快速入门
  • 路由
  • DSL
  • API
  • Options
  • 组件
🔥编辑器 (opens new window)
  • 可视化编辑器 (opens new window)
  • RuleGo-Server (opens new window)
  • 🌊StreamSQL
  • 🤖智能体框架
  • ❓问答

    • FAQ
💖支持
👥加入社区
  • Github (opens new window)
  • Gitee (opens new window)
  • GitCode (opens new window)
  • 更新日志 (opens new window)
  • English
  • 简体中文
🏠首页
  • 快速入门
  • 规则链
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 可视化
  • RuleGo-Server
  • AOP
  • 触发器
  • 高级主题
  • 性能
  • 标准组件
  • 扩展组件
  • 自定义组件
  • 流式计算
  • 组件市场
  • 概述
  • 快速入门
  • 路由
  • DSL
  • API
  • Options
  • 组件
🔥编辑器 (opens new window)
  • 可视化编辑器 (opens new window)
  • RuleGo-Server (opens new window)
  • 🌊StreamSQL
  • 🤖智能体框架
  • ❓问答

    • FAQ
💖支持
👥加入社区
  • Github (opens new window)
  • Gitee (opens new window)
  • GitCode (opens new window)
  • 更新日志 (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • 快速入门

  • 规则链

  • 标准组件

  • 扩展组件

    • 扩展组件概述
    • 过滤器

    • 动作

    • 转换器

    • 外部的

    • ai

      • 智能体

      • 组件

        • 智能体
        • LLM
        • 图像生成
        • 意图识别
          • 配置
            • Intent 结构
          • 执行结果
          • 配置示例
          • 应用示例
        • 本地意图识别
        • MCP 客户端
        • MCP 服务端
    • CI

    • IoT

    • 流式计算

    • 文件

  • 自定义组件

  • 组件市场

  • 可视化

  • AOP

  • 触发器

  • 高级主题

  • RuleGo-Server

  • 问题

目录

意图识别

ai/intent 组件:v0.36.0+ 使用 LLM 对用户输入进行意图分类,并将识别结果作为 Relation Type 路由到匹配的下游节点,实现基于 AI 的智能路由。

对延迟和成本敏感的场景,可以使用 本地意图识别 替代。

# 配置

字段 类型 说明 默认值
url string OpenAI API 兼容的请求地址 https://ai.gitee.com/v1
key string API Key
model string 模型名称 Qwen2.5-72B-Instruct
input string 用户输入表达式,支持 ${msg.key} 和 ${metadata.key}。为空时使用 msg.GetData()
intents []Intent 预定义意图列表(至少定义一个)
defaultIntent string 默认意图(无法识别时使用) default
systemPrompt string 自定义系统提示词,支持 ${include()} 引用文件。为空时使用内置默认提示词
temperature float32 模型温度参数 0.1
maxTokens int 最大输出长度,0 表示使用模型默认值 0

# Intent 结构

字段 类型 说明
name string 意图名称(作为 Relation Type 路由)
description string 意图描述(帮助 LLM 区分不同意图)

# 执行结果

  • 识别结果写入 msg.Metadata["intent"],不修改 msg.Data(原始消息透传下游)
  • 通过 TellNext(msg, intentName) 路由到匹配的连接类型
  • 识别结果不在预定义列表中时,使用 defaultIntent

# 配置示例

{
  "id": "node_intent",
  "type": "ai/intent",
  "name": "意图分类",
  "configuration": {
    "url": "https://ai.gitee.com/v1",
    "key": "sk-xxx",
    "model": "Qwen2.5-72B-Instruct",
    "temperature": 0.1,
    "intents": [
      {"name": "query", "description": "用户查询信息或提问"},
      {"name": "action", "description": "用户请求执行某个操作"},
      {"name": "complaint", "description": "用户投诉或表达不满"},
      {"name": "greeting", "description": "用户问候或打招呼"}
    ],
    "defaultIntent": "unknown"
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 应用示例

智能客服路由:

{
  "ruleChain": {"id": "smart-router", "name": "智能路由", "root": true},
  "metadata": {
    "firstNodeIndex": 0,
    "nodes": [
      {
        "id": "node_intent", "type": "ai/intent", "name": "意图识别",
        "configuration": {
          "url": "https://ai.gitee.com/v1", "key": "sk-xxx",
          "model": "Qwen2.5-72B-Instruct", "temperature": 0.1,
          "intents": [
            {"name": "query", "description": "查询信息"},
            {"name": "action", "description": "执行操作"},
            {"name": "complaint", "description": "投诉反馈"}
          ],
          "defaultIntent": "unknown"
        }
      },
      {"id": "node_query", "type": "ai/llm", "name": "回答查询",
        "configuration": {"url": "...", "key": "...", "model": "...", "systemPrompt": "回答用户问题"}},
      {"id": "node_action", "type": "restApiCall", "name": "执行操作",
        "configuration": {"url": "http://api/action", "requestMethod": "POST"}},
      {"id": "node_complaint", "type": "restApiCall", "name": "转人工",
        "configuration": {"url": "http://api/ticket", "requestMethod": "POST"}}
    ],
    "connections": [
      {"fromId": "node_intent", "toId": "node_query", "type": "query"},
      {"fromId": "node_intent", "toId": "node_action", "type": "action"},
      {"fromId": "node_intent", "toId": "node_complaint", "type": "complaint"}
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
在 GitHub 上编辑此页 (opens new window)
上次更新: 2026/05/28, 01:50:04
图像生成
本地意图识别

← 图像生成 本地意图识别→

Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式