joel image handler

This commit is contained in:
2026-02-02 12:18:44 +01:00
parent 09143a0638
commit a4300f8eec
14 changed files with 452 additions and 5 deletions

View File

@@ -32,6 +32,8 @@ export interface ToolContext {
authorName: string;
/** Optional: enable GIF search for this context */
gifSearchEnabled?: boolean;
/** Optional: enable image generation for this context */
imageGenEnabled?: boolean;
}
/**
@@ -193,6 +195,42 @@ export const GIF_SEARCH_TOOL: ChatCompletionTool = {
},
};
/**
* Image generation tool - creates images using AI
*/
export const IMAGE_GEN_TOOL: ChatCompletionTool = {
type: "function",
function: {
name: "generate_image",
description: "Generate an image based on a text description. Use this when someone asks you to draw, create, or generate an image/picture. By default, generate SFW images. Only generate NSFW content if the user explicitly requests it using words like 'nsfw', 'nude', 'naked', 'porn', 'hentai', 'xxx', or similar. The generated image URL will be included in your response.",
parameters: {
type: "object",
properties: {
prompt: {
type: "string",
description: "Detailed description of the image to generate. Be specific about subject, pose, environment, lighting, and style. Only include adult content if explicitly requested by the user.",
},
style: {
type: "string",
enum: ["photorealistic", "anime", "hentai", "digital art", "painting", "3d render"],
description: "Art style for the image.",
},
aspect_ratio: {
type: "string",
enum: ["1:1", "16:9", "9:16", "4:3", "3:4"],
description: "Aspect ratio. Use 9:16 or 3:4 for portraits/full body, 16:9 for wide scenes.",
},
quality: {
type: "string",
enum: ["fast", "quality", "anime"],
description: "Model selection. 'fast' = quick generation, 'quality' = higher detail, 'anime' = anime style.",
},
},
required: ["prompt"],
},
},
};
/**
* Get tools based on context settings
* Returns the base tools plus any optional tools that are enabled
@@ -205,6 +243,11 @@ export function getToolsForContext(context: ToolContext): ChatCompletionTool[] {
tools.push(GIF_SEARCH_TOOL);
}
// Add image generation tool if enabled for this guild
if (context.imageGenEnabled) {
tools.push(IMAGE_GEN_TOOL);
}
return tools;
}