Actions21
Overview
This node implements a conversational text completion feature for the 阿里通义 (Ali Tongyi) resource, specifically supporting the "对话补全" (dialogue completion) operation. It allows users to send a series of messages with roles (user, assistant, system) to an AI model or intelligent agent and receive a generated response that continues or completes the conversation.
Common scenarios include:
- Building chatbots that simulate human-like conversations.
- Automating customer support interactions.
- Creating virtual assistants that respond contextually based on prior messages.
- Generating dialogue content for applications such as games or interactive stories.
For example, a user can provide a sequence of messages representing a conversation history, and the node will generate the next assistant reply, optionally simplifying the output or using specific voice options for text-to-speech synthesis.
Properties
| Name | Meaning |
|---|---|
| 模型 (assistantId) | The model or intelligent agent identifier to use for generating responses. Can be any string; if unknown, any value can be used. |
| 消息 (messages) | A collection of message objects forming the conversation history. Each message includes: - 文本 (content): The message text to send. - 角色 (role): The role shaping the model's response behavior, options are 用户 (user), 助手 (assistant), 系统 (system). |
| 简化输出 (simplify) | Boolean flag indicating whether to return a simplified version of the response instead of raw data. Defaults to true. |
| 语音列表 (voice) | Selection of voice for text-to-speech output. Supports official voices from a predefined list or custom cloned voices. Required when text-to-speech is enabled. |
Output
The node outputs JSON data containing the AI-generated response completing the dialogue based on the input messages. If text-to-speech is enabled, it may also output audio data corresponding to the selected voice.
json: Contains the structured response from the AI model, typically including the generated message text and possibly metadata.- Binary data (if applicable): Represents synthesized speech audio matching the generated text, using the chosen voice.
Dependencies
- Requires access to the 阿里通义 API or service endpoint capable of processing conversational completions.
- Uses an internal router module (
./actions/router) to handle the execution logic. - For voice selection, supports querying a list of official and cloned voices via a search method (
ttsListSearch). - May require appropriate API credentials or authentication tokens configured in n8n to authorize requests.
Troubleshooting
- Missing or invalid model identifier: Providing an incorrect or empty model ID might cause the API to reject the request or produce unexpected results. Verify the model name or use a known valid identifier.
- Improper message formatting: Messages must include both content and role fields. Omitting these or using unsupported roles could lead to errors or poor responses.
- Text-to-speech issues: If TTS is enabled but no valid voice is selected, the node may fail to generate audio output. Ensure a voice is chosen from the official list or a valid cloned voice string is provided.
- API connectivity problems: Network issues or invalid credentials can cause failures. Check API keys and network access.
- Simplify option confusion: When
simplifyis true, the output is a condensed version which might omit some details present in the raw response. Set to false if full data is needed.
Links and References
- Ali Tongyi Official Documentation (Chinese)
- n8n Documentation on Custom Nodes
- Text-to-Speech Voice List (as per node's internal voice search method)
This summary is based solely on static analysis of the provided source code and property definitions without runtime execution.