d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
114 lines
3.1 KiB
TypeScript
114 lines
3.1 KiB
TypeScript
import type {
|
|
GammaGenerateFromTemplateParams,
|
|
GammaGenerateFromTemplateResponse,
|
|
} from '@/tools/gamma/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const generateFromTemplateTool: ToolConfig<
|
|
GammaGenerateFromTemplateParams,
|
|
GammaGenerateFromTemplateResponse
|
|
> = {
|
|
id: 'gamma_generate_from_template',
|
|
name: 'Gamma Generate from Template',
|
|
description: 'Generate a new Gamma by adapting an existing template with a prompt.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Gamma API key',
|
|
},
|
|
gammaId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'The ID of the template gamma to adapt',
|
|
},
|
|
prompt: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Instructions for how to adapt the template (1-100,000 tokens)',
|
|
},
|
|
themeId: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Custom Gamma workspace theme ID to apply',
|
|
},
|
|
exportAs: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Automatically export the generated gamma as pdf or pptx',
|
|
},
|
|
folderIds: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Comma-separated folder IDs to store the generated gamma in',
|
|
},
|
|
imageModel: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'AI image generation model to use when imageSource is aiGenerated',
|
|
},
|
|
imageStyle: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'Style directive for AI-generated images, e.g. "watercolor", "photorealistic" (max 500 chars)',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: 'https://public-api.gamma.app/v1.0/generations/from-template',
|
|
method: 'POST',
|
|
headers: (params) => ({
|
|
'Content-Type': 'application/json',
|
|
'X-API-KEY': params.apiKey,
|
|
}),
|
|
body: (params) => {
|
|
const body: Record<string, unknown> = {
|
|
gammaId: params.gammaId,
|
|
prompt: params.prompt,
|
|
}
|
|
|
|
if (params.themeId) body.themeId = params.themeId
|
|
if (params.exportAs) body.exportAs = params.exportAs
|
|
if (params.folderIds) {
|
|
body.folderIds = params.folderIds.split(',').map((id: string) => id.trim())
|
|
}
|
|
|
|
const imageOptions: Record<string, unknown> = {}
|
|
if (params.imageModel) imageOptions.model = params.imageModel
|
|
if (params.imageStyle) imageOptions.style = params.imageStyle
|
|
if (Object.keys(imageOptions).length > 0) body.imageOptions = imageOptions
|
|
|
|
return body
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
generationId: data.generationId ?? '',
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
generationId: {
|
|
type: 'string',
|
|
description: 'The ID of the generation job. Use with Check Status to poll for completion.',
|
|
},
|
|
},
|
|
}
|