joel image handler
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user