n8n-nodes-siliconflow-ai 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -11
- package/dist/nodes/SiliconFlow/SiliconFlow.node.d.ts +6 -5
- package/dist/nodes/SiliconFlow/SiliconFlow.node.js +725 -331
- package/dist/nodes/SiliconFlowChatModel/SiliconFlowChatModel.node.d.ts +5 -0
- package/dist/nodes/SiliconFlowChatModel/SiliconFlowChatModel.node.js +291 -0
- package/dist/nodes/SiliconFlowChatModel/siliconflow.svg +12 -0
- package/index.js +12 -0
- package/package.json +28 -5
package/README.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# n8n-nodes-siliconflow-ai
|
|
2
2
|
|
|
3
|
-
一个面向 [n8n](https://n8n.io) 的社区节点,封装 [SiliconFlow(硅基流动)](https://siliconflow.cn) 的 OpenAI 兼容 REST API
|
|
3
|
+
一个面向 [n8n](https://n8n.io) 的社区节点,封装 [SiliconFlow(硅基流动)](https://siliconflow.cn) 的 OpenAI 兼容 REST API。提供**两个节点**:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **SiliconFlow**(动作节点):Chat / Vision / Embeddings / Image Generation / Rerank
|
|
6
|
+
- **SiliconFlow Chat Model**(AI Agent 模型节点):LangChain 兼容,可接入 n8n 的 AI Agent / Tools Agent / AI Chain
|
|
7
|
+
|
|
8
|
+
> 🎯 **核心目的**:解决 [QixYuanmeng/n8n-nodes-siliconflow](https://github.com/QixYuanmeng/n8n-nodes-siliconflow) 在最新 n8n 中因把 `langchain@^0.3.29` 写进 `dependencies` 而与宿主 n8n 自带的 `@langchain/core@1.x` 产生 `ERESOLVE` 冲突、导致安装失败的问题。
|
|
6
9
|
>
|
|
7
|
-
>
|
|
10
|
+
> **依赖策略(关键)**:
|
|
11
|
+
> - 动作节点 `SiliconFlow`:**零运行时三方依赖**,完全使用 n8n 内置 `httpRequestWithAuthentication` 直连 SiliconFlow,永不冲突。
|
|
12
|
+
> - 模型节点 `SiliconFlowChatModel`:`@langchain/openai` / `@langchain/core` 仅声明为**可选 peerDependencies(`"*"`)**,不打包、不安装,运行时直接复用 n8n 自带的 langchain —— 既保留 AI Agent 能力,又彻底消除 `ERESOLVE`。
|
|
8
13
|
|
|
9
14
|
---
|
|
10
15
|
|
|
@@ -63,12 +68,19 @@ USER node
|
|
|
63
68
|
|
|
64
69
|
## ✨ 支持的能力
|
|
65
70
|
|
|
71
|
+
### 节点 1:SiliconFlow(动作节点)
|
|
72
|
+
|
|
66
73
|
| Resource | Operation | 端点 | 说明 |
|
|
67
74
|
|---|---|---|---|
|
|
68
|
-
| Chat
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
75
|
+
| Chat | Complete | `POST /chat/completions` | 兼容 OpenAI 格式的对话,支持 thinking / tools 等参数 |
|
|
76
|
+
| Vision | Analyze | `POST /chat/completions` | 多模态视觉理解(支持二进制/URL/base64 图片) |
|
|
77
|
+
| Embeddings | Create | `POST /embeddings` | 文本向量化 |
|
|
78
|
+
| Image | Generate | `POST /images/generations` | 文生图 |
|
|
79
|
+
| Rerank | Create | `POST /rerank` | 文档重排序(RAG 后处理) |
|
|
80
|
+
|
|
81
|
+
### 节点 2:SiliconFlow Chat Model(AI Agent 模型节点)
|
|
82
|
+
|
|
83
|
+
输出 `AiLanguageModel` 连接,把 **SiliconFlow Chat Model** 节点连到 **AI Agent** / **Tools Agent** / **AI Chain** 即可让 Agent 使用 SiliconFlow 上的模型(含工具调用、推理模型 thinking 等)。底层复用 `@langchain/openai` 的 `ChatOpenAI` 指向 SiliconFlow base URL。
|
|
72
84
|
|
|
73
85
|
---
|
|
74
86
|
|
|
@@ -122,6 +134,18 @@ USER node
|
|
|
122
134
|
|
|
123
135
|
输出 `images[0].url` 即图片 URL(部分模型返回 base64)。
|
|
124
136
|
|
|
137
|
+
### 5. 用 AI Agent 调用 SiliconFlow 模型
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
[AI Agent] ←(Model)— [SiliconFlow Chat Model]
|
|
141
|
+
↓
|
|
142
|
+
[其它 Tool 节点…]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- 把 **SiliconFlow Chat Model** 节点的输出连到 **AI Agent** 的 Model 输入
|
|
146
|
+
- 在 Chat Model 节点选择模型(如 `deepseek-ai/DeepSeek-V3`、`Qwen/Qwen2.5-72B-Instruct`)
|
|
147
|
+
- Agent 即可使用该模型进行工具调用 / 推理
|
|
148
|
+
|
|
125
149
|
---
|
|
126
150
|
|
|
127
151
|
## 🧪 常见模型参考
|
|
@@ -141,10 +165,12 @@ USER node
|
|
|
141
165
|
|
|
142
166
|
| 项 | 原项目 | 本项目 |
|
|
143
167
|
|---|---|---|
|
|
144
|
-
|
|
|
168
|
+
| `langchain` 声明位置 | `dependencies`(被 npm 安装 → 触发 `ERESOLVE`) | **可选 `peerDependencies`(`"*"`)**,不安装,运行时复用 n8n 自带版本 |
|
|
169
|
+
| 动作节点运行时依赖 | `axios` + `zod` | **零**(用 n8n 内置 `httpRequestWithAuthentication`) |
|
|
145
170
|
| 最新 n8n 安装 | ❌ `ERESOLVE` 报错 | ✅ 干净通过 |
|
|
146
|
-
|
|
|
147
|
-
|
|
|
171
|
+
| AI Agent 模型节点 | ✅ 有 | ✅ 保留(同样接入 AI Agent) |
|
|
172
|
+
| 包大小 | 较大(打包 langchain/axios) | 很小(不打包三方运行时依赖) |
|
|
173
|
+
| 维护难度 | 跟随 langchain 升级易冲突 | 复用 n8n 自带 langchain,跟随 SiliconFlow API 变更即可 |
|
|
148
174
|
|
|
149
175
|
---
|
|
150
176
|
|
|
@@ -162,7 +188,7 @@ npm install
|
|
|
162
188
|
npm run build
|
|
163
189
|
|
|
164
190
|
# 监听模式(自动编译)
|
|
165
|
-
npm run
|
|
191
|
+
npm run build:watch
|
|
166
192
|
```
|
|
167
193
|
|
|
168
194
|
修改源码后建议在本地 n8n 验证(见上文「方式 2:本地加载」)。
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
2
|
/**
|
|
3
|
-
* SiliconFlow(硅基流动)AI 节点
|
|
3
|
+
* SiliconFlow(硅基流动)AI 节点
|
|
4
4
|
*
|
|
5
5
|
* 本节点使用 n8n 内置的 helpers.httpRequestWithAuthentication 直接调用 SiliconFlow
|
|
6
|
-
* 的 OpenAI 兼容 REST API,不引入任何 langchain
|
|
7
|
-
*
|
|
6
|
+
* 的 OpenAI 兼容 REST API,不引入任何 langchain / axios 等三方运行时依赖,从而彻底
|
|
7
|
+
* 规避宿主 n8n 环境的 peer dependency(ERESOLVE)冲突。
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* 支持的资源:
|
|
10
10
|
* - Chat Completion (POST /chat/completions)
|
|
11
|
-
* -
|
|
11
|
+
* - Vision (POST /chat/completions,多模态图片理解)
|
|
12
|
+
* - Embeddings (POST /embeddings)
|
|
12
13
|
* - Image Generation (POST /images/generations)
|
|
13
14
|
* - Rerank (POST /rerank)
|
|
14
15
|
*/
|