@greatapps/greatagents-ui 0.3.19 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2033,9 +2033,15 @@ function buildPreview(promptText, objectives, agentTools, allTools) {
2033
2033
  }
2034
2034
  }
2035
2035
  const toolBindings = enabledAgentTools.map((at) => ({ at, tool: toolMap.get(at.id_tool) })).filter((x) => !!x.tool);
2036
- if (toolBindings.length > 0) {
2036
+ const seenToolIds = /* @__PURE__ */ new Set();
2037
+ const dedupedBindings = toolBindings.filter(({ at }) => {
2038
+ if (seenToolIds.has(at.id_tool)) return false;
2039
+ seenToolIds.add(at.id_tool);
2040
+ return true;
2041
+ });
2042
+ if (dedupedBindings.length > 0) {
2037
2043
  preview += "\n\n[TOOLS]";
2038
- for (const { at, tool } of toolBindings) {
2044
+ for (const { at, tool } of dedupedBindings) {
2039
2045
  if (at.custom_instructions) {
2040
2046
  preview += `
2041
2047
 
@@ -3007,17 +3013,19 @@ var INTEGRATION_FUNCTIONS = {
3007
3013
  { slug: "delete_google_calendar_event", label: "Remover Evento", description: "Cancelar/remover evento", defaultInstructions: "Remover evento do Google Calendar" }
3008
3014
  ]
3009
3015
  };
3010
- function buildCustomInstructions(integrationSlug, selectedFunctions, functionInstructions) {
3016
+ function buildCustomInstructions(integrationSlug, integrationName, selectedFunctions, functionInstructions) {
3011
3017
  const fns = INTEGRATION_FUNCTIONS[integrationSlug];
3012
3018
  if (!fns) return "";
3013
3019
  const activeFns = fns.filter((f) => selectedFunctions.has(f.slug));
3014
3020
  if (activeFns.length === 0) return "";
3015
- const lines = activeFns.map((f) => {
3021
+ const lines = [];
3022
+ lines.push(`## ${integrationName} (${integrationSlug})`);
3023
+ for (const f of activeFns) {
3016
3024
  const instruction = functionInstructions[f.slug] || f.defaultInstructions;
3017
- return `- ${f.slug}: ${instruction}`;
3018
- });
3019
- return `Fun\xE7\xF5es dispon\xEDveis (${integrationSlug}):
3020
- ${lines.join("\n")}`;
3025
+ lines.push(`### ${f.slug}`);
3026
+ lines.push(instruction);
3027
+ }
3028
+ return lines.join("\n");
3021
3029
  }
3022
3030
  function IntegrationsTab({
3023
3031
  config,
@@ -3165,7 +3173,7 @@ function IntegrationsTab({
3165
3173
  if (!toolId) continue;
3166
3174
  }
3167
3175
  }
3168
- const customInstructions = buildCustomInstructions(slug, local.selectedFunctions, local.functionInstructions);
3176
+ const customInstructions = buildCustomInstructions(slug, card.definition.name, local.selectedFunctions, local.functionInstructions);
3169
3177
  await addAgentTool.mutateAsync({
3170
3178
  idAgent: agentId,
3171
3179
  body: { id_tool: toolId, enabled: true, ...customInstructions ? { custom_instructions: customInstructions } : {} }
@@ -3183,7 +3191,7 @@ function IntegrationsTab({
3183
3191
  if (toolId) {
3184
3192
  const agentTool = agentTools.find((at) => at.id_tool === toolId);
3185
3193
  if (agentTool) {
3186
- const customInstructions = buildCustomInstructions(slug, local.selectedFunctions, local.functionInstructions);
3194
+ const customInstructions = buildCustomInstructions(slug, card.definition.name, local.selectedFunctions, local.functionInstructions);
3187
3195
  await updateAgentTool.mutateAsync({
3188
3196
  idAgent: agentId,
3189
3197
  id: agentTool.id,