Skip to content

Commit 81006b9

Browse files
author
PRM-KaN
committed
Initial prototype
1 parent dd6cf03 commit 81006b9

21 files changed

+949
-58
lines changed

.idx/icon.png

26.7 KB
Loading

.modified

Whitespace-only changes.

docs/blueprint.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# **App Name**: Artisan AI
2+
3+
## Core Features:
4+
5+
- Prompt Refinement: User can submit prompts for refinement; the system will provide suggestions.
6+
- Image Generation: Generate an image based on a prompt using DALL-E or similar AI. The AI tool will optionally consider trending art styles from online platforms to produce outputs tailored to current tastes.
7+
- Image Display: Display the generated image in a visually appealing format with realistic elements and cinematic text (gradients, shadows). Includes subtle 3D effects and smooth animations. Optimized for performance, minimizing external integrations and APIs, using only free and open-source solutions.
8+
- Style Customization: Allow users to select a specific art style or artist for image generation.
9+
- User Feedback: Enable users to rate and provide feedback on generated images.
10+
- Social Sharing: Enable sharing generated art on social media platforms.
11+
- Autogen window: The tool creates an image generation window based on a text description provided by the user, or generated by artificial intelligence; it returns three images of the same character derived from the description, or from an attached photograph.
12+
- n8n Integration: Integrate n8n for workflow automation, allowing users to create custom workflows for image generation and processing.
13+
- Skywork AI Functionality: Implement functionality similar to Skywork AI, offering features like AI-powered image editing and enhancement.
14+
- Mistral AI Integration: Integrate the Mistral AI model for image generation and related tasks.
15+
- Emergent SH Functionality: Incorporate functionality related to Emergent SH, potentially for AI-driven content creation or analysis.
16+
- Enhanced Security: Prioritize application and API key security. Implement robust cybersecurity measures to protect user data and prevent unauthorized access. The interface remains multi-functional yet avoids being unwieldy.
17+
- Gemini API Integration: Integrate with the Gemini API for large language model capabilities.
18+
19+
## Style Guidelines:
20+
21+
- Background color: Black
22+
- Primary color: Amber
23+
- Secondary color: Fiery orange
24+
- Tertiary color: Bronze
25+
- Highlight color: Burgundy
26+
- Text color: White
27+
- Accent color: Gold

src/ai/dev.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
// Flows will be imported for their side effects in this file.
1+
import { config } from 'dotenv';
2+
config();
3+
4+
import '@/ai/flows/generate-image-from-prompt.ts';
5+
import '@/ai/flows/prompt-refinement-suggestions.ts';
6+
import '@/ai/flows/generate-variations-from-description.ts';
7+
import '@/ai/flows/style-customization-assistance.ts';
8+
import '@/ai/flows/generate-variations-from-photo.ts';
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
'use server';
2+
3+
/**
4+
* @fileOverview Generates an image from a text prompt using a GenAI model.
5+
*
6+
* - generateImageFromPrompt - A function that handles the image generation process.
7+
* - GenerateImageFromPromptInput - The input type for the generateImageFromPrompt function.
8+
* - GenerateImageFromPromptOutput - The return type for the generateImageFromPrompt function.
9+
*/
10+
11+
import {ai} from '@/ai/genkit';
12+
import {z} from 'genkit';
13+
14+
const GenerateImageFromPromptInputSchema = z.object({
15+
prompt: z.string().describe('The prompt to use for image generation.'),
16+
});
17+
export type GenerateImageFromPromptInput = z.infer<typeof GenerateImageFromPromptInputSchema>;
18+
19+
const GenerateImageFromPromptOutputSchema = z.object({
20+
imageUrl: z.string().describe('The URL of the generated image.'),
21+
});
22+
export type GenerateImageFromPromptOutput = z.infer<typeof GenerateImageFromPromptOutputSchema>;
23+
24+
export async function generateImageFromPrompt(input: GenerateImageFromPromptInput): Promise<GenerateImageFromPromptOutput> {
25+
return generateImageFromPromptFlow(input);
26+
}
27+
28+
const generateImagePrompt = ai.definePrompt({
29+
name: 'generateImagePrompt',
30+
input: {schema: GenerateImageFromPromptInputSchema},
31+
output: {schema: GenerateImageFromPromptOutputSchema},
32+
prompt: `Generate an image based on the following prompt: {{{prompt}}}. Return the URL of the image.`,
33+
});
34+
35+
const generateImageFromPromptFlow = ai.defineFlow(
36+
{
37+
name: 'generateImageFromPromptFlow',
38+
inputSchema: GenerateImageFromPromptInputSchema,
39+
outputSchema: GenerateImageFromPromptOutputSchema,
40+
},
41+
async input => {
42+
const {media} = await ai.generate({
43+
model: 'googleai/imagen-4.0-fast-generate-001',
44+
prompt: input.prompt,
45+
});
46+
47+
return {imageUrl: media.url!};
48+
}
49+
);
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'use server';
2+
/**
3+
* @fileOverview Generates three distinct but related images based on a text description.
4+
*
5+
* - generateVariationsFromDescription - A function that generates three images from a text description.
6+
* - GenerateVariationsFromDescriptionInput - The input type for the generateVariationsFromDescription function.
7+
* - GenerateVariationsFromDescriptionOutput - The return type for the generateVariationsFromDescription function.
8+
*/
9+
10+
import {ai} from '@/ai/genkit';
11+
import {z} from 'genkit';
12+
13+
const GenerateVariationsFromDescriptionInputSchema = z.object({
14+
description: z.string().describe('The text description to generate images from.'),
15+
});
16+
export type GenerateVariationsFromDescriptionInput = z.infer<typeof GenerateVariationsFromDescriptionInputSchema>;
17+
18+
const GenerateVariationsFromDescriptionOutputSchema = z.object({
19+
imageUrls: z.array(z.string()).length(3).describe('An array containing three image data URIs.'),
20+
});
21+
export type GenerateVariationsFromDescriptionOutput = z.infer<typeof GenerateVariationsFromDescriptionOutputSchema>;
22+
23+
export async function generateVariationsFromDescription(
24+
input: GenerateVariationsFromDescriptionInput
25+
): Promise<GenerateVariationsFromDescriptionOutput> {
26+
return generateVariationsFromDescriptionFlow(input);
27+
}
28+
29+
const generateVariationsFromDescriptionFlow = ai.defineFlow(
30+
{
31+
name: 'generateVariationsFromDescriptionFlow',
32+
inputSchema: GenerateVariationsFromDescriptionInputSchema,
33+
outputSchema: GenerateVariationsFromDescriptionOutputSchema,
34+
},
35+
async input => {
36+
const imageUrls: string[] = [];
37+
for (let i = 0; i < 3; i++) {
38+
const {media} = await ai.generate({
39+
model: 'googleai/imagen-4.0-fast-generate-001',
40+
prompt: input.description,
41+
});
42+
if (media) {
43+
imageUrls.push(media.url);
44+
} else {
45+
throw new Error(`Failed to generate image ${i + 1}`);
46+
}
47+
}
48+
return {imageUrls};
49+
}
50+
);
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
'use server';
2+
/**
3+
* @fileOverview Generates three distinct image variations from a user-provided photo.
4+
*
5+
* - generateVariationsFromPhoto - A function that takes a photo and generates three image variations.
6+
* - GenerateVariationsFromPhotoInput - The input type for the generateVariationsFromPhoto function.
7+
* - GenerateVariationsFromPhotoOutput - The return type for the generateVariationsFromPhoto function.
8+
*/
9+
10+
import {ai} from '@/ai/genkit';
11+
import {z} from 'genkit';
12+
13+
const GenerateVariationsFromPhotoInputSchema = z.object({
14+
photoDataUri: z
15+
.string()
16+
.describe(
17+
'A photo to generate variations from, as a data URI that must include a MIME type and use Base64 encoding. Expected format: \'data:<mimetype>;base64,<encoded_data>\'.'
18+
),
19+
});
20+
export type GenerateVariationsFromPhotoInput = z.infer<typeof GenerateVariationsFromPhotoInputSchema>;
21+
22+
const GenerateVariationsFromPhotoOutputSchema = z.object({
23+
image1DataUri: z.string().describe('The first generated image variation as a data URI.'),
24+
image2DataUri: z.string().describe('The second generated image variation as a data URI.'),
25+
image3DataUri: z.string().describe('The third generated image variation as a data URI.'),
26+
});
27+
export type GenerateVariationsFromPhotoOutput = z.infer<typeof GenerateVariationsFromPhotoOutputSchema>;
28+
29+
export async function generateVariationsFromPhoto(
30+
input: GenerateVariationsFromPhotoInput
31+
): Promise<GenerateVariationsFromPhotoOutput> {
32+
return generateVariationsFromPhotoFlow(input);
33+
}
34+
35+
const generateVariationsFromPhotoFlow = ai.defineFlow(
36+
{
37+
name: 'generateVariationsFromPhotoFlow',
38+
inputSchema: GenerateVariationsFromPhotoInputSchema,
39+
outputSchema: GenerateVariationsFromPhotoOutputSchema,
40+
},
41+
async input => {
42+
const {photoDataUri} = input;
43+
44+
// Generate three image variations using the Gemini 2.5 Flash Image model
45+
const [image1, image2, image3] = await Promise.all([
46+
ai.generate({
47+
model: 'googleai/gemini-2.5-flash-image-preview',
48+
prompt: [
49+
{media: {url: photoDataUri}},
50+
{text: 'Generate a similar image with a slightly different style.'},
51+
],
52+
config: {
53+
responseModalities: ['TEXT', 'IMAGE'],
54+
},
55+
}),
56+
ai.generate({
57+
model: 'googleai/gemini-2.5-flash-image-preview',
58+
prompt: [
59+
{media: {url: photoDataUri}},
60+
{text: 'Generate a similar image with a different color palette.'},
61+
],
62+
config: {
63+
responseModalities: ['TEXT', 'IMAGE'],
64+
},
65+
}),
66+
ai.generate({
67+
model: 'googleai/gemini-2.5-flash-image-preview',
68+
prompt: [
69+
{media: {url: photoDataUri}},
70+
{text: 'Generate a similar image with a different background.'},
71+
],
72+
config: {
73+
responseModalities: ['TEXT', 'IMAGE'],
74+
},
75+
}),
76+
]);
77+
78+
return {
79+
image1DataUri: image1.media!.url,
80+
image2DataUri: image2.media!.url,
81+
image3DataUri: image3.media!.url,
82+
};
83+
}
84+
);

src/ai/flows/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export * from './generate-image-from-prompt';
2+
export * from './prompt-refinement-suggestions';
3+
export * from './generate-variations-from-description';
4+
export * from './style-customization-assistance';
5+
export * from './generate-variations-from-photo';
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use server';
2+
3+
/**
4+
* @fileOverview Provides prompt refinement suggestions to the user.
5+
*
6+
* - getPromptRefinementSuggestions - A function that takes a prompt and returns refinement suggestions.
7+
* - PromptRefinementInput - The input type for the getPromptRefinementSuggestions function.
8+
* - PromptRefinementOutput - The return type for the getPromptRefinementSuggestions function.
9+
*/
10+
11+
import {ai} from '@/ai/genkit';
12+
import {z} from 'genkit';
13+
14+
const PromptRefinementInputSchema = z.object({
15+
prompt: z.string().describe('The original prompt provided by the user.'),
16+
});
17+
export type PromptRefinementInput = z.infer<typeof PromptRefinementInputSchema>;
18+
19+
const PromptRefinementOutputSchema = z.object({
20+
suggestions: z.array(z.string()).describe('An array of suggested prompt refinements.'),
21+
});
22+
export type PromptRefinementOutput = z.infer<typeof PromptRefinementOutputSchema>;
23+
24+
export async function getPromptRefinementSuggestions(
25+
input: PromptRefinementInput
26+
): Promise<PromptRefinementOutput> {
27+
return promptRefinementFlow(input);
28+
}
29+
30+
const prompt = ai.definePrompt({
31+
name: 'promptRefinementPrompt',
32+
input: {schema: PromptRefinementInputSchema},
33+
output: {schema: PromptRefinementOutputSchema},
34+
prompt: `You are an expert prompt engineer. Given the following prompt, provide three alternative prompts that are more specific and likely to generate a better image.\n\nOriginal Prompt: {{{prompt}}}\n\nRefinement Suggestions:`,
35+
});
36+
37+
const promptRefinementFlow = ai.defineFlow(
38+
{
39+
name: 'promptRefinementFlow',
40+
inputSchema: PromptRefinementInputSchema,
41+
outputSchema: PromptRefinementOutputSchema,
42+
},
43+
async input => {
44+
const {output} = await prompt(input);
45+
return output!;
46+
}
47+
);
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
'use server';
2+
3+
/**
4+
* @fileOverview Provides art style and artist suggestions for image customization.
5+
*
6+
* - getStyleSuggestions - A function to get art style suggestions.
7+
* - StyleSuggestionsInput - The input type for the getStyleSuggestions function.
8+
* - StyleSuggestionsOutput - The return type for the getStyleSuggestions function.
9+
*/
10+
11+
import {ai} from '@/ai/genkit';
12+
import {z} from 'genkit';
13+
14+
const StyleSuggestionsInputSchema = z.object({
15+
prompt: z.string().describe('The user input prompt.'),
16+
});
17+
export type StyleSuggestionsInput = z.infer<typeof StyleSuggestionsInputSchema>;
18+
19+
const StyleSuggestionsOutputSchema = z.object({
20+
suggestions: z.array(
21+
z.object({
22+
style: z.string().describe('Suggested art style.'),
23+
artist: z.string().describe('Suggested artist.'),
24+
description: z.string().describe('A short description of the style.'),
25+
})
26+
).describe('A list of art style and artist suggestions.'),
27+
});
28+
export type StyleSuggestionsOutput = z.infer<typeof StyleSuggestionsOutputSchema>;
29+
30+
export async function getStyleSuggestions(input: StyleSuggestionsInput): Promise<StyleSuggestionsOutput> {
31+
return styleSuggestionsFlow(input);
32+
}
33+
34+
const styleSuggestionsPrompt = ai.definePrompt({
35+
name: 'styleSuggestionsPrompt',
36+
input: {schema: StyleSuggestionsInputSchema},
37+
output: {schema: StyleSuggestionsOutputSchema},
38+
prompt: `You are an art style suggestion assistant. Provide a list of art styles and artists that would be appropriate for the prompt.
39+
40+
Prompt: {{{prompt}}}
41+
42+
Return the suggestions as a list of styles, artists and short descriptions.
43+
44+
Example:
45+
[{
46+
"style": "Steampunk",
47+
"artist": "Phil Foglio",
48+
"description": "Victorian science fantasy"
49+
}]
50+
`,
51+
});
52+
53+
const styleSuggestionsFlow = ai.defineFlow(
54+
{
55+
name: 'styleSuggestionsFlow',
56+
inputSchema: StyleSuggestionsInputSchema,
57+
outputSchema: StyleSuggestionsOutputSchema,
58+
},
59+
async input => {
60+
const {output} = await styleSuggestionsPrompt(input);
61+
return output!;
62+
}
63+
);

0 commit comments

Comments
 (0)