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,37 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {},
|
||||
"extends": [
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"plugins": ["prettier"]
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# pieces-stable-diffusion-webui
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
Integration with [Stable Diffusion web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui)
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-stable-diffusion-webui` to build the library.
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@activepieces/piece-stable-diffusion-webui",
|
||||
"version": "0.0.10"
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "pieces-stable-diffusion-webui",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/stable-diffusion-webui/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/stable-diffusion-webui",
|
||||
"tsConfig": "packages/pieces/community/stable-diffusion-webui/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/stable-diffusion-webui/package.json",
|
||||
"main": "packages/pieces/community/stable-diffusion-webui/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/stable-diffusion-webui/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/stable-diffusion-webui/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build",
|
||||
"prebuild"
|
||||
]
|
||||
},
|
||||
"publish": {
|
||||
"command": "node tools/scripts/publish.mjs pieces-stable-diffusion-webui {args.ver} {args.tag}",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
},
|
||||
"prebuild": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/stable-diffusion-webui",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "Eine Webschnittstelle für Stable Diffusion",
|
||||
"Stable Diffusion web UI API base URL": "Stable Diffusion Web UI API Basis-URL",
|
||||
"Text to Image": "Text zu Bild",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "Modell",
|
||||
"Advanced parameters (key/value)": "Erweiterte Parameter (Schlüssel/Wert)",
|
||||
"Refer to API documentation": "Lesen Sie die API-Dokumentation"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "Una interfaz web para Diferencia Estable",
|
||||
"Stable Diffusion web UI API base URL": "URL base de la API API API de la interfaz web estable",
|
||||
"Text to Image": "Texto a imagen",
|
||||
"Prompt": "Petición",
|
||||
"Model": "Modelo",
|
||||
"Advanced parameters (key/value)": "Parámetros avanzados (clave/valor)",
|
||||
"Refer to API documentation": "Consulte la documentación de la API"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "Une interface web pour une Diffusion Stable",
|
||||
"Stable Diffusion web UI API base URL": "URL de base de l'API web de Diffusion stable",
|
||||
"Text to Image": "Texte à l'image",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "Modélisation",
|
||||
"Advanced parameters (key/value)": "Paramètres avancés (clé/valeur)",
|
||||
"Refer to API documentation": "Reportez-vous à la documentation de l'API"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "安定した拡散のためのウェブインターフェイス",
|
||||
"Stable Diffusion web UI API base URL": "安定した拡散ウェブ UI APIベースURL",
|
||||
"Text to Image": "テキストから画像へ",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "モデル",
|
||||
"Advanced parameters (key/value)": "高度なパラメータ (キー/値)",
|
||||
"Refer to API documentation": "API ドキュメントを参照してください"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "Een webinterface voor Stabiele Diffusie",
|
||||
"Stable Diffusion web UI API base URL": "Stabiele Diffusion web UI API basis-URL",
|
||||
"Text to Image": "Tekst naar afbeelding",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "Model",
|
||||
"Advanced parameters (key/value)": "Geavanceerde parameters (sleutel/waarde)",
|
||||
"Refer to API documentation": "Raadpleeg de API-documentatie"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "Uma interface web para Diffusão Estável",
|
||||
"Stable Diffusion web UI API base URL": "URL base da API da Web UI para Diffusão Estável",
|
||||
"Text to Image": "Texto para Imagem",
|
||||
"Prompt": "Aviso",
|
||||
"Model": "Modelo",
|
||||
"Advanced parameters (key/value)": "Parâmetros avançados (chave/valor)",
|
||||
"Refer to API documentation": "Consulte a documentação da API"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Stable Dffusion web UI": "Контейнерный веб-интерфейс",
|
||||
"A web interface for Stable Diffusion": "Веб-интерфейс для стабильного диффузии",
|
||||
"Stable Diffusion web UI API base URL": "Стабильный URL веб-интерфейса API для диффузии",
|
||||
"Text to Image": "Текст на изображение",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "Модель",
|
||||
"Advanced parameters (key/value)": "Дополнительные параметры (ключ/значение)",
|
||||
"Refer to API documentation": "Обратитесь к документации по API"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "A web interface for Stable Diffusion",
|
||||
"Stable Diffusion web UI API base URL": "Stable Diffusion web UI API base URL",
|
||||
"Text to Image": "Text to Image",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "Model",
|
||||
"Advanced parameters (key/value)": "Advanced parameters (key/value)",
|
||||
"Refer to API documentation": "Refer to API documentation"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Stable Dffusion web UI": "Stable Dffusion web UI",
|
||||
"A web interface for Stable Diffusion": "A web interface for Stable Diffusion",
|
||||
"Stable Diffusion web UI API base URL": "Stable Diffusion web UI API base URL",
|
||||
"Text to Image": "Text to Image",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "Model",
|
||||
"Advanced parameters (key/value)": "Advanced parameters (key/value)",
|
||||
"Refer to API documentation": "Refer to API documentation"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"A web interface for Stable Diffusion": "A web interface for Stable Diffusion",
|
||||
"Stable Diffusion web UI API base URL": "Stable Diffusion web UI API base URL",
|
||||
"Text to Image": "Text to Image",
|
||||
"Prompt": "Prompt",
|
||||
"Model": "Model",
|
||||
"Advanced parameters (key/value)": "Advanced parameters (key/value)",
|
||||
"Refer to API documentation": "Refer to API documentation"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import {
|
||||
createPiece,
|
||||
PieceAuth,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { textToImage } from './lib/actions/text-to-image';
|
||||
|
||||
export const stableDiffusionAuth = PieceAuth.CustomAuth({
|
||||
required: true,
|
||||
props: {
|
||||
baseUrl: Property.ShortText({
|
||||
displayName: 'Stable Diffusion web UI API base URL',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
export type StableDiffusionAuthType = {
|
||||
baseUrl: string;
|
||||
};
|
||||
|
||||
export const stableDiffusion = createPiece({
|
||||
displayName: 'Stable Dffusion web UI',
|
||||
description: 'A web interface for Stable Diffusion',
|
||||
auth: stableDiffusionAuth,
|
||||
minimumSupportedRelease: '0.30.0',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/stable-diffusion-webui.png',
|
||||
authors: ['AdamSelene', 'abuaboud'],
|
||||
actions: [textToImage],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,100 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { randomBytes } from 'node:crypto';
|
||||
import {
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
HttpRequest,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { stableDiffusionAuth, StableDiffusionAuthType } from '../../index';
|
||||
import { kebabCase } from '@activepieces/shared';
|
||||
|
||||
export const textToImage = createAction({
|
||||
name: 'textToImage',
|
||||
displayName: 'Text to Image',
|
||||
description: '',
|
||||
auth: stableDiffusionAuth,
|
||||
props: {
|
||||
prompt: Property.LongText({
|
||||
displayName: 'Prompt',
|
||||
required: true,
|
||||
}),
|
||||
model: Property.Dropdown({
|
||||
displayName: 'Model',
|
||||
auth: stableDiffusionAuth,
|
||||
required: true,
|
||||
refreshers: ['auth'],
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please authenticate first',
|
||||
};
|
||||
}
|
||||
const { baseUrl } = auth.props;
|
||||
const request: HttpRequest = {
|
||||
method: HttpMethod.GET,
|
||||
url: `${baseUrl}/sdapi/v1/sd-models`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
};
|
||||
const response = await httpClient.sendRequest(request);
|
||||
const options = response.body
|
||||
?.map((model: { model_name: string }) => {
|
||||
return {
|
||||
label: model.model_name,
|
||||
value: model.model_name,
|
||||
};
|
||||
})
|
||||
?.sort((a: { label: string }, b: { label: string }) =>
|
||||
a['label'].localeCompare(b['label'])
|
||||
);
|
||||
return {
|
||||
options: options,
|
||||
};
|
||||
},
|
||||
}),
|
||||
advancedParameters: Property.Object({
|
||||
displayName: 'Advanced parameters (key/value)',
|
||||
required: false,
|
||||
description: 'Refer to API documentation',
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue, files }) {
|
||||
const request: HttpRequest = {
|
||||
method: HttpMethod.POST,
|
||||
url: `${auth.props.baseUrl}/sdapi/v1/txt2img`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...propsValue.advancedParameters,
|
||||
prompt: propsValue.prompt,
|
||||
override_settings: {
|
||||
sd_model_checkpoint: propsValue.model,
|
||||
},
|
||||
override_settings_restore_afterwards: true,
|
||||
}),
|
||||
};
|
||||
const response = await httpClient.sendRequest(request);
|
||||
const images = await Promise.all(
|
||||
response.body['images']?.map(async (imageBase64: string) => {
|
||||
const fileName = `${randomBytes(16).toString('hex')}-${kebabCase(
|
||||
propsValue.prompt
|
||||
).slice(0, 42)}.png`;
|
||||
const imageUrl = await files.write({
|
||||
fileName,
|
||||
data: Buffer.from(imageBase64, 'base64'),
|
||||
});
|
||||
return {
|
||||
fileName,
|
||||
url: imageUrl,
|
||||
};
|
||||
})
|
||||
);
|
||||
return {
|
||||
images,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user