Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.7 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { zooAuth } from '../../auth'
import { httpClient, HttpMethod } from '@activepieces/pieces-common';

export const giveModelFeedbackAction = createAction({
  name: 'give_model_feedback',
  classification: 'WRITE',
  displayName: 'Give Model Feedback',
  description: 'Provide feedback on a generated 3D model',
  audience: 'both',
  aiMetadata: { description: 'Record feedback on a text-to-CAD model identified by its model ID, choosing thumbs_up, thumbs_down, accepted, or rejected. Use to rate a generation; this mutates the model\'s stored feedback, so repeated calls overwrite or re-submit the rating rather than being a no-op.', idempotent: false },
  auth: zooAuth,
  // category: 'Machine Learning (ML)',
  props: {
    modelId: Property.ShortText({
      displayName: 'Model ID',
      required: true,
      description: 'The ID of the model to give feedback on',
    }),
    feedback: Property.StaticDropdown({
      displayName: 'Feedback Type',
      required: true,
      options: {
        options: [
          { label: 'Thumbs Up', value: 'thumbs_up' },
          { label: 'Thumbs Down', value: 'thumbs_down' },
          { label: 'Accepted', value: 'accepted' },
          { label: 'Rejected', value: 'rejected' },
        ],
      },
    }),
  },
  async run({ auth, propsValue }) {
    const response = await httpClient.sendRequest({
      method: HttpMethod.POST,
      url: `https://api.zoo.dev/user/text-to-cad/${propsValue.modelId}`,
      headers: {
        Authorization: `Bearer ${auth.secret_text}`,
      },
      body: {
        feedback: propsValue.feedback,
      },
    });
    return response.body;
  },
});