LLM
ai/llm
组件:ai 文本生成组件,根据大模型用户输入的消息、上下文或者图片的理解生成内容。
支持所有兼容OpenAI API协议的大模型平台,如:
Gitee AI
- 注册地址:Gitee AI 控制台 (opens new window)
- 接口地址:
https://ai.gitee.com/v1
- 支持模型:如DeepSeek-R1、DeepSeek-R1-Distill-Qwen-32B、 Qwen2-VL-72B等。
百度千帆大模型平台
- 注册地址:百度云控制台 (opens new window)
- 接口地址:
https://qianfan.baidubce.com/v2
- 支持模型:如Ernie系列。
智谱清言
- 注册地址:智谱清言API Key管理 (opens new window)
- 接口地址:
https://open.bigmodel.cn/api/paas/v4
- 支持模型:基于GLM的对话模型。
科大讯飞星火大模型
- 注册地址:科大讯飞控制台 (opens new window)
- 接口地址:
https://spark-api-open.xf-yun.com/v1
- 支持模型:星火系列。
百川大模型
- 注册地址:百川AI平台 (opens new window)
- 接口地址:
https://api.baichuan-ai.com/v1
- 支持模型:百川系列。
月之暗面大模型
- 注册地址:月之暗面平台 (opens new window)
- 接口地址:
https://api.moonshot.cn/v1
- 支持模型:Kimi。
腾讯混元大模型
- 注册地址:腾讯云控制台 (opens new window)
- 接口地址:
https://api.hunyuan.cloud.tencent.com/v1
- 支持模型:混元。
商汤日日新大模型
- 注册地址:商汤AI Studio (opens new window)
- 接口地址:
https://api.sensenova.cn/compatible-mode/v1
- 支持模型:日日新。
UCloud Modelverse
- 注册地址:UCloud控制台 (opens new window)
- 接口地址:
https://deepseek.modelverse.cn/v0.1
- 支持模型:如DeepSeek-Reasoner。
阿里云百炼
- 注册地址:阿里云百炼控制台 (opens new window)
- 接口地址:
https://dashscope-intl.aliyuncs.com/compatible-mode/v1
- 支持模型:如text-embedding-v3。
魔搭社区
- 注册地址:魔搭社区 (opens new window)
- 接口地址:
https://api-inference.modelscope.cn/v1
- 支持模型:魔搭社区模型。
OpenAI 配置
- 注册地址:platform.openai.com (opens new window)
- 接口地址:
https://api.openai.com/v1
- 支持模型:
gpt-3.5-turbo
,gpt-4
,dall-e-3
等
# 配置
字段 | 类型 | 说明 | 默认值 |
---|---|---|---|
url | string | 请求地址 | https://ai.gitee.com/v1/ |
key | string | API Key | |
model | string | 模型名称 示例:gpt-3.5-turbo DeepSeek-R1 | |
systemPrompt | string | 系统提示,用于预先定义模型的基础行为框架和响应风格。可以使用${} 占位符变量 | |
messages | []ChatMessage | 上下文/用户消息列表(每个消息含 role/user 和 content) | |
images | []string | 允许模型输入图片,并根据图像内容的理解回答用户问题 | |
params | Params | 大模型参数 |
# 大模型参数(Params)结构
字段 | 类型 | 说明 | 默认值 |
---|---|---|---|
temperature | float32 | 采样温度控制输出的随机性。范围 [0.0, 2.0],值越高越随机 | 0.0 |
topP | float32 | 采样方法范围 [0.0,1.0],从概率最高的前p%候选词中选取 tokens | 0.0 |
presencePenalty | float32 | 对已有标记的惩罚值,范围 [0.0,1.0] | 0.0 |
frequencyPenalty | float32 | 对重复标记的惩罚值,范围 [0.0,1.0] | 0.0 |
maxTokens | int | 最大输出长度 | |
stop | []string | 模型停止输出的标记 | |
responseFormat | string | 输出格式:text/json_object/json_schema | text |
jsonSchema | string | JSON Schema | |
keepThink | bool | 是否保留思考过程(仅text格式生效) | false |
# ChatMessage 结构
字段 | 类型 | 说明 |
---|---|---|
role | string | 消息角色:user 或 assistant |
content | string | 消息内容。可使用${} 占位符变量 |
# 执行结果
执行结果替换到msg.Data,流转到下一个节点。输出格式根据params.responseFormat
决定。
# 配置示例
{
"id": "node_2",
"additionalInfo": {
"layoutX": 580,
"layoutY": 270
},
"type": "ai/llm",
"name": "请求大模型,解析票据",
"debugMode": true,
"configuration": {
"key": "${vars.token}",
"messages": [
{
"content": "我的token是:aaabbccc",
"role": "user"
},
{
"content": "帮我订5张《哪吒2》电影票",
"role": "user"
}
],
"model": "Qwen2-7B-Instruct",
"params": {
"jsonSchema": "{\n\t\t\t\"type\": \"object\",\n\t\t\t\"properties\": {\n\t\t\t\t\"name\": {\n\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t},\n\t\t\t\t\"num\": {\n\t\t\t\t\t\"type\": \"integer\"\n\t\t\t\t},\n\t\t\t\t\"token\": {\n\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"required\": [\"name\", \"num\", \"token\"]\n\t\t}",
"maxTokens": 0,
"responseFormat": "json_schema",
"stop": null,
"temperature": 0.6,
"topP": 0.75
},
"systemPrompt": "你是一个订票助手,解析用户购票请求,输出Json格式,包含字段:token,name,num",
"url": "https://ai.gitee.com/v1"
}
}
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
33
34
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
33
34
# 应用示例
解析用户购票请求,解析出票据信息,输出Json格式,包含字段:token,name,num
{
"ruleChain": {
"id": "bM0H3pgicu_Y",
"name": "大模型智能体测试",
"debugMode": false,
"root": true,
"disabled": false,
"configuration": {
"vars": {
"token": "xx"
}
},
"additionalInfo": {
"createTime": "2025/02/13 10:55:48",
"description": "",
"layoutX": "280",
"layoutY": "280",
"updateTime": "2025/02/13 16:53:30",
"username": "admin"
}
},
"metadata": {
"endpoints": [],
"nodes": [
{
"id": "node_2",
"additionalInfo": {
"layoutX": 580,
"layoutY": 270
},
"type": "ai/llm",
"name": "请求大模型,解析票据",
"debugMode": true,
"configuration": {
"key": "${vars.token}",
"messages": [
{
"content": "我的token是:aaabbccc",
"role": "user"
},
{
"content": "帮我订5张《哪吒2》电影票",
"role": "user"
}
],
"model": "Qwen2-7B-Instruct",
"params": {
"jsonSchema": "{\n\t\t\t\"type\": \"object\",\n\t\t\t\"properties\": {\n\t\t\t\t\"name\": {\n\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t},\n\t\t\t\t\"num\": {\n\t\t\t\t\t\"type\": \"integer\"\n\t\t\t\t},\n\t\t\t\t\"token\": {\n\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"required\": [\"name\", \"num\", \"token\"]\n\t\t}",
"maxTokens": 0,
"responseFormat": "json_schema",
"stop": null,
"temperature": 0.6,
"topP": 0.75
},
"systemPrompt": "你是一个订票助手,解析用户购票请求,输出Json格式,包含字段:token,name,num",
"url": "https://ai.gitee.com/v1"
}
},
{
"id": "node_5",
"additionalInfo": {
"layoutX": 840,
"layoutY": 300
},
"type": "jsTransform",
"name": "请求订票API",
"debugMode": true,
"configuration": {
"jsScript": "return {'msg':msg,'metadata':metadata,'msgType':msgType};"
}
}
],
"connections": [
{
"fromId": "node_2",
"toId": "node_5",
"type": "Success"
}
]
}
}
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
识别图片
{
"ruleChain": {
"id": "hUx-pk6OsMjo",
"name": "大模型图片内容识别",
"debugMode": false,
"root": true,
"disabled": false,
"configuration": {
"vars": {
"token": "xxx"
}
},
"additionalInfo": {
"createTime": "2025/02/13 18:50:18",
"description": "",
"height": 40,
"layoutX": "160",
"layoutY": "250",
"title": "开始",
"updateTime": "2025/02/14 21:33:50",
"username": "admin",
"width": 240
}
},
"metadata": {
"endpoints": [],
"nodes": [
{
"id": "node_2",
"additionalInfo": {
"background": "",
"description": "",
"height": 88,
"icon": "",
"layoutX": 460,
"layoutY": 250,
"width": 240
},
"type": "ai/llm",
"name": "识别图片内容",
"debugMode": false,
"configuration": {
"description": "",
"images": [
"https://rulego.cc/img/architecture_zh.png"
],
"key": "${vars.token}",
"messages": [
{
"content": "解析图片内容",
"role": "user"
}
],
"model": "Qwen2-VL-72B",
"params": {
"frequencyPenalty": 0,
"jsonSchema": "",
"keepThink": false,
"maxTokens": 0,
"presencePenalty": 0,
"responseFormat": "",
"stop": null,
"temperature": 0.6,
"topP": 0.75
},
"systemPrompt": "",
"title": "识别图片内容",
"url": "https://ai.gitee.com/v1"
}
},
{
"id": "node_10",
"type": "log",
"name": "日志",
"configuration": {
"jsScript": "return 'Incoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);"
},
"debugMode": false,
"additionalInfo": {
"layoutX": 700,
"layoutY": 270
}
}
],
"connections": [
{
"fromId": "node_2",
"toId": "node_10",
"type": "Success"
}
]
}
}
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
在 GitHub 上编辑此页 (opens new window)
上次更新: 2025/02/17, 13:45:22