mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-28 09:56:23 +02:00
moved generate_image from being attached to the workflow
This commit is contained in:
parent
893ad87268
commit
48c32d37dc
8 changed files with 199 additions and 134 deletions
34
apps/rowboat/app/lib/default_tools.ts
Normal file
34
apps/rowboat/app/lib/default_tools.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
// Returns the list of built-in tools that should appear by default
|
||||
// in the workflow editor and be usable at runtime without attaching
|
||||
// them to the workflow. These are displayed as read-only library tools.
|
||||
// Note: avoid importing WorkflowTool here to prevent circular deps.
|
||||
// Return a structurally compatible object instead.
|
||||
export function getDefaultTools(): Array<any> {
|
||||
// Always expose built-in library tools in the editor so users can
|
||||
// discover them. Runtime invocation will still validate required
|
||||
// environment variables and return an error if missing.
|
||||
|
||||
return [
|
||||
{
|
||||
name: 'Generate Image',
|
||||
description:
|
||||
'Generate an image using Google Gemini given a text prompt. Returns base64-encoded image data and any text parts.',
|
||||
isGeminiImage: true,
|
||||
isLibrary: true,
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
prompt: {
|
||||
type: 'string',
|
||||
description: 'Text prompt describing the image to generate',
|
||||
},
|
||||
modelName: { type: 'string', description: 'Optional Gemini model override' },
|
||||
},
|
||||
required: ['prompt'],
|
||||
additionalProperties: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@ import { z } from 'zod';
|
|||
|
||||
// Provide a minimal default template to satisfy legacy code paths that
|
||||
// still reference `templates.default`. Real templates are DB-backed.
|
||||
const includeGeminiImageTool = !!process.env.GOOGLE_API_KEY;
|
||||
|
||||
const defaultTemplate: z.infer<typeof WorkflowTemplate> = {
|
||||
name: 'Blank Template',
|
||||
|
|
@ -11,22 +10,7 @@ const defaultTemplate: z.infer<typeof WorkflowTemplate> = {
|
|||
startAgent: "",
|
||||
agents: [],
|
||||
prompts: [],
|
||||
tools: includeGeminiImageTool ? [
|
||||
{
|
||||
name: "Generate Image",
|
||||
description: "Generate an image using Google Gemini given a text prompt. Returns base64-encoded image data and any text parts.",
|
||||
isGeminiImage: true,
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
prompt: { type: 'string', description: 'Text prompt describing the image to generate' },
|
||||
modelName: { type: 'string', description: 'Optional Gemini model override' },
|
||||
},
|
||||
required: ['prompt'],
|
||||
additionalProperties: true,
|
||||
},
|
||||
},
|
||||
] : [],
|
||||
tools: [],
|
||||
pipelines: [],
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { z } from "zod";
|
||||
import { getDefaultTools } from "@/app/lib/default_tools";
|
||||
export const WorkflowAgent = z.object({
|
||||
name: z.string(),
|
||||
order: z.number().int().optional(),
|
||||
|
|
@ -165,7 +166,10 @@ export function sanitizeTextWithMentions(
|
|||
const agent = workflow.agents.find(a => a.name === entity.name);
|
||||
return agent && agent.type !== 'pipeline';
|
||||
} else if (entity.type === 'tool') {
|
||||
return workflow.tools.some(t => t.name === entity.name);
|
||||
// Allow referencing workflow tools or default library tools
|
||||
const inWorkflow = workflow.tools.some(t => t.name === entity.name);
|
||||
const inDefaults = getDefaultTools().some(t => t.name === entity.name);
|
||||
return inWorkflow || inDefaults;
|
||||
} else if (entity.type === 'prompt') {
|
||||
return workflow.prompts.some(p => p.name === entity.name);
|
||||
} else if (entity.type === 'pipeline') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue