Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
# Comet API Piece for Activepieces
|
||||
|
||||
This is a Comet API integration for Activepieces that allows users to access multiple AI models through a unified interface.
|
||||
|
||||
## Features
|
||||
|
||||
- ✅ Support for multiple AI models (GPT, Claude, Gemini, DeepSeek, etc.)
|
||||
- ✅ Dynamic model list loading
|
||||
- ✅ Complete parameter configuration (temperature, max_tokens, top_p)
|
||||
- ✅ Detailed error handling
|
||||
- ✅ Custom API call support
|
||||
- ✅ API key validation
|
||||
|
||||
## Supported Models
|
||||
|
||||
### GPT Series
|
||||
- gpt-5-chat-latest
|
||||
- chatgpt-4o-latest
|
||||
- gpt-4o-mini
|
||||
- gpt-5-mini
|
||||
- gpt-5-nano
|
||||
|
||||
### Claude Series
|
||||
- claude-opus-4-1-20250805
|
||||
- claude-sonnet-4-20250514
|
||||
- claude-3-7-sonnet-latest
|
||||
- claude-3-5-haiku-latest
|
||||
|
||||
### Gemini Series
|
||||
- gemini-2.5-pro
|
||||
- gemini-2.5-flash
|
||||
- gemini-2.0-flash
|
||||
|
||||
### Other Models
|
||||
- DeepSeek series (deepseek-v3.1, deepseek-v3, deepseek-r1-0528)
|
||||
- Grok series (grok-4-0709, grok-3, grok-3-mini)
|
||||
- Qwen series (qwen3-30b-a3b, qwen3-coder-plus-2025-07-22)
|
||||
|
||||
## Usage
|
||||
|
||||
### 1. Get API Key
|
||||
1. Visit: https://www.cometapi.com/
|
||||
2. Register an account and login
|
||||
3. Go to API settings page to get your API key
|
||||
|
||||
### 2. Configure in Activepieces
|
||||
1. Create a new flow in Activepieces
|
||||
2. Add the "Comet API" piece
|
||||
3. Configure your API key
|
||||
4. Select the AI model to use
|
||||
5. Enter your prompt
|
||||
|
||||
### 3. Available Actions
|
||||
|
||||
#### Ask Comet API
|
||||
Send prompts to any AI model supported by Comet API.
|
||||
|
||||
**Parameters:**
|
||||
- **Model**: The AI model to use
|
||||
- **Prompt**: The prompt text to send to the AI
|
||||
- **System Message** (optional): System message to set AI behavior
|
||||
- **Temperature** (optional): Controls randomness (0-2)
|
||||
- **Max Tokens** (optional): Maximum tokens to generate
|
||||
- **Top P** (optional): Nucleus sampling parameter (0-1)
|
||||
|
||||
#### Custom API Call
|
||||
Directly call any endpoint of the Comet API.
|
||||
|
||||
## Build
|
||||
|
||||
Run `nx build pieces-cometapi` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-cometapi",
|
||||
"version": "0.0.2",
|
||||
"type": "commonjs",
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "pieces-cometapi",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/cometapi/src",
|
||||
"projectType": "library",
|
||||
"release": {
|
||||
"version": {
|
||||
"manifestRootsToUpdate": [
|
||||
"dist/{projectRoot}"
|
||||
],
|
||||
"currentVersionResolver": "git-tag",
|
||||
"fallbackCurrentVersionResolver": "disk"
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/cometapi",
|
||||
"tsConfig": "packages/pieces/community/cometapi/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/cometapi/package.json",
|
||||
"main": "packages/pieces/community/cometapi/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/cometapi/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/cometapi/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build",
|
||||
"prebuild"
|
||||
]
|
||||
},
|
||||
"nx-release-publish": {
|
||||
"options": {
|
||||
"packageRoot": "dist/{projectRoot}"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
},
|
||||
"prebuild": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/cometapi",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "Zugriff auf mehrere KI-Modelle über CometAPI - einheitliche Schnittstelle für GPT, Claude, Gemini und mehr.",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nFolgen Sie diesen Anweisungen, um Ihren CometAPI Schlüssel zu erhalten:\n\n1. Besuchen Sie das CometAPI Dashboard: https://api.cometapi. om/console/token\n2. Gehen Sie zur API-Einstellungsseite um Ihren Schlüssel zu erhalten.\n3. Kopieren Sie den Schlüssel und fügen Sie ihn unten ein.\n",
|
||||
"Ask CometAPI": "CometAPI fragen",
|
||||
"Custom API Call": "Eigener API-Aufruf",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "Sendet eine Aufforderung an jedes von CometAPI unterstützte KI-Modell.",
|
||||
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
|
||||
"Model": "Modell",
|
||||
"Prompt": "Prompt",
|
||||
"System Message": "Systemnachricht",
|
||||
"Temperature": "Temperatur",
|
||||
"Max Tokens": "Max. Token",
|
||||
"Top P": "Oben P",
|
||||
"Method": "Methode",
|
||||
"Headers": "Kopfzeilen",
|
||||
"Query Parameters": "Abfrageparameter",
|
||||
"Body": "Körper",
|
||||
"Response is Binary ?": "Antwort ist binär?",
|
||||
"No Error on Failure": "Kein Fehler bei Fehler",
|
||||
"Timeout (in seconds)": "Timeout (in Sekunden)",
|
||||
"The prompt to send to the AI model.": "Die Eingabeaufforderung, die an das AI-Modell gesendet werden soll.",
|
||||
"Optional system message to set the behavior of the AI.": "Optionale Systemmeldung, um das Verhalten der KI festzulegen.",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "Steuert die Zufallsregelung (0-2). Niedrigere Werte machen die Ausgabe fokussierter.",
|
||||
"Maximum number of tokens to generate.": "Maximale Anzahl zu generierender Token.",
|
||||
"Controls diversity via nucleus sampling (0-1).": "Kontrolliert die Vielfalt durch Nucleus Sampling (0-1).",
|
||||
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
|
||||
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
|
||||
"GET": "ERHALTEN",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "LÖSCHEN",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "Acceda a múltiples modelos de IA a través de CometAPI - interfaz unificada para GPT, Claude, Gemini y más.",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nSiga estas instrucciones para obtener su clave CometAPI:\n\n1. Visite el panel de control de CometAPI: https://api.cometapi. om/console/token\n2. Ve a la página de configuración de la API para obtener tu clave.\n3. Copia la clave y pégala debajo.\n",
|
||||
"Ask CometAPI": "Preguntar CometAPI",
|
||||
"Custom API Call": "Llamada API personalizada",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "Envía un mensaje a cualquier modelo de IA soportado por CometAPI.",
|
||||
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
|
||||
"Model": "Modelo",
|
||||
"Prompt": "Petición",
|
||||
"System Message": "Mensaje del sistema",
|
||||
"Temperature": "Temperatura",
|
||||
"Max Tokens": "Tokens máximos",
|
||||
"Top P": "Top P",
|
||||
"Method": "Método",
|
||||
"Headers": "Encabezados",
|
||||
"Query Parameters": "Parámetros de consulta",
|
||||
"Body": "Cuerpo",
|
||||
"Response is Binary ?": "¿Respuesta es binaria?",
|
||||
"No Error on Failure": "No hay ningún error en fallo",
|
||||
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
|
||||
"The prompt to send to the AI model.": "El aviso para enviar al modelo de IA.",
|
||||
"Optional system message to set the behavior of the AI.": "Mensaje opcional del sistema para establecer el comportamiento de la IA.",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "Controla la aleatoria (0-2). Valores más bajos hacen que la salida esté más enfocada.",
|
||||
"Maximum number of tokens to generate.": "Número máximo de tokens a generar.",
|
||||
"Controls diversity via nucleus sampling (0-1).": "Controla la diversidad mediante muestreo de núcleos (0-1).",
|
||||
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
|
||||
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
|
||||
"GET": "RECOGER",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "BORRAR",
|
||||
"HEAD": "LIMPIO"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "Accédez à plusieurs modèles AI via CometAPI - interface unifiée pour GPT, Claude, Gemini, et plus.",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n",
|
||||
"Ask CometAPI": "Demander à CometAPI",
|
||||
"Custom API Call": "Appel d'API personnalisé",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "Envoie une invite à n'importe quel modèle AI supporté par CometAPI.",
|
||||
"Make a custom API call to a specific endpoint": "Passer un appel API personnalisé à un endpoint spécifique",
|
||||
"Model": "Modélisation",
|
||||
"Prompt": "Prompt",
|
||||
"System Message": "Message système",
|
||||
"Temperature": "Température",
|
||||
"Max Tokens": "Tokens max",
|
||||
"Top P": "Top P",
|
||||
"Method": "Méthode",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Paramètres de requête",
|
||||
"Body": "Body",
|
||||
"Response is Binary ?": "La réponse est Binaire ?",
|
||||
"No Error on Failure": "Aucune erreur en cas d'échec",
|
||||
"Timeout (in seconds)": "Délai d'expiration (en secondes)",
|
||||
"The prompt to send to the AI model.": "L'invite à envoyer au modèle IA.",
|
||||
"Optional system message to set the behavior of the AI.": "Message système optionnel pour définir le comportement de l'IA.",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "Contrôle aléatoirement (0-2). Les valeurs inférieures rendent la sortie plus ciblée.",
|
||||
"Maximum number of tokens to generate.": "Nombre maximum de jetons à générer.",
|
||||
"Controls diversity via nucleus sampling (0-1).": "Contrôle la diversité via l'échantillonnage du noyau (0-1).",
|
||||
"Authorization headers are injected automatically from your connection.": "Les Headers d'autorisation sont injectés automatiquement à partir de votre connexion.",
|
||||
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "CometAPI(GPT、Claude、Geminiなどの統合インターフェイス)から複数のAIモデルにアクセスできます。",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n",
|
||||
"Ask CometAPI": "CometAPIに聞く",
|
||||
"Custom API Call": "カスタムAPI通話",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "CometAPIでサポートされているAIモデルにプロンプトを送信します。",
|
||||
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
|
||||
"Model": "モデル",
|
||||
"Prompt": "Prompt",
|
||||
"System Message": "システムメッセージ",
|
||||
"Temperature": "温度",
|
||||
"Max Tokens": "最大トークン",
|
||||
"Top P": "トップ P",
|
||||
"Method": "方法",
|
||||
"Headers": "ヘッダー",
|
||||
"Query Parameters": "クエリパラメータ",
|
||||
"Body": "本文",
|
||||
"Response is Binary ?": "応答はバイナリですか?",
|
||||
"No Error on Failure": "失敗時にエラーはありません",
|
||||
"Timeout (in seconds)": "タイムアウト(秒)",
|
||||
"The prompt to send to the AI model.": "AIモデルに送信するプロンプト。",
|
||||
"Optional system message to set the behavior of the AI.": "AIの動作を設定するオプションのシステムメッセージ。",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "ランダム性(0-2)をコントロールします。低い値により出力がフォーカスされます。",
|
||||
"Maximum number of tokens to generate.": "生成するトークンの最大数。",
|
||||
"Controls diversity via nucleus sampling (0-1).": "核サンプリング(0-1)による多様性を制御します。",
|
||||
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
|
||||
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
|
||||
"GET": "取得",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "削除",
|
||||
"HEAD": "頭"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "Krijg toegang tot meerdere AI modellen via CometAPI - gecombineerde interface voor GPT, Claude, Gemini en meer.",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nVolg deze instructies om uw CometAPI Key te verkrijgen:\n\n1. Bezoek het CometAPI Dashboard: https://api.cometapi. om/console/token\n2. Ga naar de API instellingen pagina om je sleutel op te halen.\n3. Kopieer de sleutel en plak deze hieronder.\n",
|
||||
"Ask CometAPI": "Vraag CometAPI",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "Stuurt een prompte naar elk AI model ondersteund door CometAPI.",
|
||||
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
|
||||
"Model": "Model",
|
||||
"Prompt": "Prompt",
|
||||
"System Message": "Systeem bericht",
|
||||
"Temperature": "Temperatuur",
|
||||
"Max Tokens": "Max Tokens",
|
||||
"Top P": "Boven P",
|
||||
"Method": "Methode",
|
||||
"Headers": "Kopteksten",
|
||||
"Query Parameters": "Query parameters",
|
||||
"Body": "Lichaam",
|
||||
"Response is Binary ?": "Antwoord is binair?",
|
||||
"No Error on Failure": "Geen fout bij fout",
|
||||
"Timeout (in seconds)": "Time-out (in seconden)",
|
||||
"The prompt to send to the AI model.": "De prompt om naar het AI-model te sturen.",
|
||||
"Optional system message to set the behavior of the AI.": "Optioneel systeembericht om het gedrag van de AI in te stellen.",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "Bepaalt willekeurigheid (0-2). Lagere waarden maken de uitvoer meer gefocust.",
|
||||
"Maximum number of tokens to generate.": "Maximum aantal tokens om te genereren.",
|
||||
"Controls diversity via nucleus sampling (0-1).": "Controleert de diversiteit via nucleus sampling (0-1).",
|
||||
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
|
||||
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
|
||||
"GET": "KRIJG",
|
||||
"POST": "POSTE",
|
||||
"PATCH": "BEKIJK",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "VERWIJDEREN",
|
||||
"HEAD": "HOOFD"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "Acesse vários modelos IA através da CometAPI - Interface unificada para GPT, Claude, Gemini e muito mais.",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nSiga estas instruções para obter sua chave CometAPI:\n\n1. Visite o painel CometAPI: https://api.cometapi. om/console/token\n2. Vá para a página de configurações de API para obter a sua chave.\n3. Copie a chave e cole-o abaixo.\n",
|
||||
"Ask CometAPI": "Pergunte CometAPI",
|
||||
"Custom API Call": "Chamada de API personalizada",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "Envia um prompt para qualquer modelo de IA suportado pela CometAPI.",
|
||||
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
|
||||
"Model": "Modelo",
|
||||
"Prompt": "Aviso",
|
||||
"System Message": "Sistema de mensagem",
|
||||
"Temperature": "Temperatura",
|
||||
"Max Tokens": "Max Tokens",
|
||||
"Top P": "Superior P",
|
||||
"Method": "Método",
|
||||
"Headers": "Cabeçalhos",
|
||||
"Query Parameters": "Parâmetros da consulta",
|
||||
"Body": "Conteúdo",
|
||||
"Response is Binary ?": "A resposta é binária ?",
|
||||
"No Error on Failure": "Nenhum erro no Failure",
|
||||
"Timeout (in seconds)": "Tempo limite (em segundos)",
|
||||
"The prompt to send to the AI model.": "O prompt para enviar ao modelo de IA",
|
||||
"Optional system message to set the behavior of the AI.": "Mensagem opcional do sistema para definir o comportamento da IA.",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "Controla a aleatoriedade (0-2). Valores mais baixos tornam a saída mais focada.",
|
||||
"Maximum number of tokens to generate.": "Número máximo de tokens a serem gerados.",
|
||||
"Controls diversity via nucleus sampling (0-1).": "Controla a diversidade através de amostragem nuclear (0-1).",
|
||||
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
|
||||
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
|
||||
"GET": "OBTER",
|
||||
"POST": "POSTAR",
|
||||
"PATCH": "COMPRAR",
|
||||
"PUT": "COLOCAR",
|
||||
"DELETE": "EXCLUIR",
|
||||
"HEAD": "CABEÇA"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n",
|
||||
"Ask CometAPI": "Ask CometAPI",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "Sends a prompt to any AI model supported by CometAPI.",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Model": "Model",
|
||||
"Prompt": "Prompt",
|
||||
"System Message": "System Message",
|
||||
"Temperature": "Temperature",
|
||||
"Max Tokens": "Max Tokens",
|
||||
"Top P": "Top P",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"The prompt to send to the AI model.": "The prompt to send to the AI model.",
|
||||
"Optional system message to set the behavior of the AI.": "Optional system message to set the behavior of the AI.",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "Controls randomness (0-2). Lower values make output more focused.",
|
||||
"Maximum number of tokens to generate.": "Maximum number of tokens to generate.",
|
||||
"Controls diversity via nucleus sampling (0-1).": "Controls diversity via nucleus sampling (0-1).",
|
||||
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.": "Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.",
|
||||
"\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n": "\nFollow these instructions to get your CometAPI Key:\n\n1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token\n2. Go to the API settings page to get your key.\n3. Copy the key and paste it below.\n",
|
||||
"Ask CometAPI": "Ask CometAPI",
|
||||
"Custom API Call": "自定义 API 呼叫",
|
||||
"Sends a prompt to any AI model supported by CometAPI.": "Sends a prompt to any AI model supported by CometAPI.",
|
||||
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
|
||||
"Model": "Model",
|
||||
"Prompt": "Prompt",
|
||||
"System Message": "System Message",
|
||||
"Temperature": "Temperature",
|
||||
"Max Tokens": "Max Tokens",
|
||||
"Top P": "Top P",
|
||||
"Method": "方法",
|
||||
"Headers": "信头",
|
||||
"Query Parameters": "查询参数",
|
||||
"Body": "正文内容",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "失败时没有错误",
|
||||
"Timeout (in seconds)": "超时(秒)",
|
||||
"The prompt to send to the AI model.": "The prompt to send to the AI model.",
|
||||
"Optional system message to set the behavior of the AI.": "Optional system message to set the behavior of the AI.",
|
||||
"Controls randomness (0-2). Lower values make output more focused.": "Controls randomness (0-2). Lower values make output more focused.",
|
||||
"Maximum number of tokens to generate.": "Maximum number of tokens to generate.",
|
||||
"Controls diversity via nucleus sampling (0-1).": "Controls diversity via nucleus sampling (0-1).",
|
||||
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"GET": "获取",
|
||||
"POST": "帖子",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "弹出",
|
||||
"DELETE": "删除",
|
||||
"HEAD": "黑色"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
import { BASE_URL, cometApiAuth } from './lib/common/auth';
|
||||
import { askCometApiAction } from './lib/actions/ask-cometapi';
|
||||
|
||||
export const cometapi = createPiece({
|
||||
displayName: 'CometAPI',
|
||||
description:
|
||||
'Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.',
|
||||
auth: cometApiAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/cometapi.png',
|
||||
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
||||
authors: ['TensorNull'],
|
||||
actions: [
|
||||
askCometApiAction,
|
||||
createCustomApiCallAction({
|
||||
baseUrl: () => BASE_URL,
|
||||
auth: cometApiAuth,
|
||||
authMapping: async (auth) => {
|
||||
return {
|
||||
Authorization: `Bearer ${auth.secret_text}`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,174 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import {
|
||||
AuthenticationType,
|
||||
HttpMethod,
|
||||
HttpRequest,
|
||||
httpClient,
|
||||
propsValidation,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { cometApiAuth } from '../common/auth';
|
||||
import { z } from 'zod';
|
||||
import { modelIdDropdown } from '../common/props';
|
||||
|
||||
interface CometApiChatResponse {
|
||||
id: string;
|
||||
object: string;
|
||||
created: number;
|
||||
model: string;
|
||||
choices: {
|
||||
index: number;
|
||||
message: {
|
||||
role: string;
|
||||
content: string;
|
||||
};
|
||||
finish_reason: string;
|
||||
}[];
|
||||
usage: {
|
||||
prompt_tokens: number;
|
||||
completion_tokens: number;
|
||||
total_tokens: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface ChatMessage {
|
||||
role: 'system' | 'user' | 'assistant';
|
||||
content: string;
|
||||
}
|
||||
|
||||
export const askCometApiAction = createAction({
|
||||
name: 'ask-cometapi',
|
||||
displayName: 'Ask CometAPI',
|
||||
description: 'Sends a prompt to any AI model supported by CometAPI.',
|
||||
auth: cometApiAuth,
|
||||
props: {
|
||||
model: modelIdDropdown,
|
||||
prompt: Property.LongText({
|
||||
displayName: 'Prompt',
|
||||
required: true,
|
||||
description: 'The prompt to send to the AI model.',
|
||||
}),
|
||||
systemMessage: Property.LongText({
|
||||
displayName: 'System Message',
|
||||
required: false,
|
||||
description: 'Optional system message to set the behavior of the AI.',
|
||||
}),
|
||||
temperature: Property.Number({
|
||||
displayName: 'Temperature',
|
||||
required: false,
|
||||
description:
|
||||
'Controls randomness (0-2). Lower values make output more focused.',
|
||||
defaultValue: 1.0,
|
||||
}),
|
||||
maxTokens: Property.Number({
|
||||
displayName: 'Max Tokens',
|
||||
required: false,
|
||||
description: 'Maximum number of tokens to generate.',
|
||||
defaultValue: 1000,
|
||||
}),
|
||||
topP: Property.Number({
|
||||
displayName: 'Top P',
|
||||
required: false,
|
||||
description: 'Controls diversity via nucleus sampling (0-1).',
|
||||
defaultValue: 1.0,
|
||||
}),
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
// Validate input parameters
|
||||
await propsValidation.validateZod(context.propsValue, {
|
||||
temperature: z.number().min(0).max(2).optional(),
|
||||
topP: z.number().min(0).max(1).optional(),
|
||||
maxTokens: z.number().positive().optional(),
|
||||
});
|
||||
|
||||
const { model, prompt, systemMessage, temperature, maxTokens, topP } =
|
||||
context.propsValue;
|
||||
|
||||
// Build messages array
|
||||
const messages: ChatMessage[] = [];
|
||||
|
||||
if (systemMessage) {
|
||||
messages.push({
|
||||
role: 'system',
|
||||
content: systemMessage,
|
||||
});
|
||||
}
|
||||
|
||||
messages.push({
|
||||
role: 'user',
|
||||
content: prompt,
|
||||
});
|
||||
|
||||
// Build request body
|
||||
const requestBody: Record<string, unknown> = {
|
||||
model: model,
|
||||
messages: messages,
|
||||
};
|
||||
|
||||
// Add optional parameters
|
||||
if (temperature !== undefined) requestBody['temperature'] = temperature;
|
||||
if (maxTokens !== undefined) requestBody['max_tokens'] = maxTokens;
|
||||
if (topP !== undefined) requestBody['top_p'] = topP;
|
||||
|
||||
// Build request
|
||||
const request: HttpRequest = {
|
||||
url: 'https://api.cometapi.com/v1/chat/completions',
|
||||
method: HttpMethod.POST,
|
||||
body: requestBody,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await httpClient.sendRequest<CometApiChatResponse>(
|
||||
request
|
||||
);
|
||||
|
||||
const responseContent = response.body.choices[0]?.message?.content;
|
||||
if (!responseContent) {
|
||||
throw new Error('No response content received from API');
|
||||
}
|
||||
|
||||
return {
|
||||
response: responseContent.trim(),
|
||||
model: response.body.model,
|
||||
usage: response.body.usage,
|
||||
};
|
||||
} catch (error: unknown) {
|
||||
// Detailed error handling
|
||||
const errorObj = error as {
|
||||
response?: { status?: number; body?: { error?: { message?: string } } };
|
||||
message?: string;
|
||||
};
|
||||
|
||||
if (errorObj.response?.status === 401) {
|
||||
throw new Error('Authentication failed: Please check your API key.');
|
||||
}
|
||||
|
||||
if (errorObj.response?.status === 429) {
|
||||
throw new Error('Rate limit exceeded: Please try again later.');
|
||||
}
|
||||
|
||||
if (errorObj.response?.status === 400) {
|
||||
const errorMessage =
|
||||
errorObj.response?.body?.error?.message || 'Bad request parameters';
|
||||
throw new Error(`Request parameter error: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (errorObj.response?.status === 404) {
|
||||
throw new Error(`Model not found: ${model}`);
|
||||
}
|
||||
|
||||
if (errorObj.response?.status && errorObj.response.status >= 500) {
|
||||
throw new Error('Server error: Please try again later.');
|
||||
}
|
||||
|
||||
throw new Error(`Request failed: ${errorObj.message || 'Unknown error'}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
|
||||
const markdownDescription = `
|
||||
Follow these instructions to get your CometAPI Key:
|
||||
|
||||
1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token
|
||||
2. Go to the API settings page to get your key.
|
||||
3. Copy the key and paste it below.
|
||||
`;
|
||||
|
||||
export const BASE_URL = 'https://api.cometapi.com/v1';
|
||||
|
||||
export const cometApiAuth = PieceAuth.SecretText({
|
||||
description: markdownDescription,
|
||||
displayName: 'API Key',
|
||||
required: true,
|
||||
validate: async ({ auth }) => {
|
||||
try {
|
||||
await httpClient.sendRequest({
|
||||
url: BASE_URL + '/models',
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth,
|
||||
},
|
||||
method: HttpMethod.GET,
|
||||
});
|
||||
|
||||
return { valid: true };
|
||||
} catch {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API Key.',
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { Property } from '@activepieces/pieces-framework';
|
||||
import { BASE_URL } from './auth';
|
||||
import { cometApiAuth } from './auth';
|
||||
|
||||
export const modelIdDropdown = Property.Dropdown({
|
||||
displayName: 'Model',
|
||||
auth: cometApiAuth,
|
||||
refreshers: [],
|
||||
required: true,
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
placeholder: 'Please connect your account first.',
|
||||
disabled: true,
|
||||
options: [],
|
||||
};
|
||||
}
|
||||
|
||||
const response = await httpClient.sendRequest<{
|
||||
data: Array<{ id: string; owned_by: string }>;
|
||||
}>({
|
||||
url: BASE_URL + '/models',
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth.secret_text,
|
||||
},
|
||||
method: HttpMethod.GET,
|
||||
});
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: response.body.data.map((model) => ({
|
||||
label: `${model.id} (${model.owned_by})`,
|
||||
value: model.id,
|
||||
})),
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"importHelpers": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noPropertyAccessFromIndexSignature": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user