mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-16 18:25:17 +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
|
|
@ -9,6 +9,7 @@ import crypto from "crypto";
|
|||
// Internal dependencies
|
||||
import { createTools, createRagTool } from "./agent-tools";
|
||||
import { ConnectedEntity, sanitizeTextWithMentions, Workflow, WorkflowAgent, WorkflowPipeline, WorkflowPrompt, WorkflowTool } from "@/app/lib/types/workflow_types";
|
||||
import { getDefaultTools } from "@/app/lib/default_tools";
|
||||
import { CHILD_TRANSFER_RELATED_INSTRUCTIONS, CONVERSATION_TYPE_INSTRUCTIONS, PIPELINE_TYPE_INSTRUCTIONS, RAG_INSTRUCTIONS, TASK_TYPE_INSTRUCTIONS, VARIABLES_CONTEXT_INSTRUCTIONS } from "./agent_instructions";
|
||||
import { PrefixLogger } from "@/app/lib/utils";
|
||||
import { Message, AssistantMessage, AssistantMessageWithToolCalls, ToolMessage } from "@/app/lib/types/types";
|
||||
|
|
@ -361,7 +362,15 @@ function mapConfig(workflow: z.infer<typeof Workflow>): {
|
|||
...acc,
|
||||
[agent.name]: agent
|
||||
}), {});
|
||||
const toolConfig: Record<string, z.infer<typeof WorkflowTool>> = workflow.tools.reduce((acc, tool) => ({
|
||||
// Merge workflow tools with default library tools (unique by name)
|
||||
const mergedTools = (() => {
|
||||
const defaults = getDefaultTools();
|
||||
const map = new Map<string, z.infer<typeof WorkflowTool>>();
|
||||
for (const t of workflow.tools) map.set(t.name, t);
|
||||
for (const t of defaults) if (!map.has(t.name)) map.set(t.name, t as any);
|
||||
return Array.from(map.values());
|
||||
})();
|
||||
const toolConfig: Record<string, z.infer<typeof WorkflowTool>> = mergedTools.reduce((acc, tool) => ({
|
||||
...acc,
|
||||
[tool.name]: tool
|
||||
}), {});
|
||||
|
|
|
|||
|
|
@ -95,29 +95,7 @@ export class CreateProjectUseCase implements ICreateProjectUseCase {
|
|||
}
|
||||
}
|
||||
|
||||
// Conditionally include Gemini Image tool by default if GOOGLE_API_KEY is present
|
||||
const hasGoogleKey = !!process.env.GOOGLE_API_KEY;
|
||||
const hasImageTool = (workflow.tools || []).some(t => t.isGeminiImage || t.name === 'Generate Image');
|
||||
if (hasGoogleKey && !hasImageTool) {
|
||||
const imageTool = {
|
||||
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' as const,
|
||||
properties: {
|
||||
prompt: { type: 'string', description: 'Text prompt describing the image to generate' },
|
||||
modelName: { type: 'string', description: 'Optional Gemini model override' },
|
||||
},
|
||||
required: ['prompt'],
|
||||
additionalProperties: true,
|
||||
},
|
||||
};
|
||||
workflow = {
|
||||
...workflow,
|
||||
tools: [...(workflow.tools || []), imageTool] as any,
|
||||
};
|
||||
}
|
||||
// Do not auto-attach image generation tool; it is available as a default library tool in the editor/runtime
|
||||
|
||||
// create project secret
|
||||
const secret = crypto.randomBytes(32).toString('hex');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue