A progressive Node.js framework for building efficient and scalable server-side applications.
Welcome to our application for creating and editing text and images using AI. Generate informative blog posts effortlessly and edit content seamlessly with our intuitive interface. Unlock endless creative possibilities with our tool!.
$ npm install --force
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Information on Uploading Files for AI
When you need to upload files from which the AI will take information, you must upload each file to the @Controller('upload')
. The file names can be:
infoContent
(field "Upload own content" according to the design mockup)sampleText
(field "Sample text" according to the design mockup)sampleKeywords
(field "Sample placeholder Keyword PDF.PDF" according to the design)
This endpoint handles file uploads, specifically PDF files.
-
Operation: uploadFile
-
Description: Upload files
-
Request Body:
- Type: object
- Properties:
infoContent
: PDF file containing information content.sampleText
: PDF file with sample text.sampleKeywords
: PDF file containing sample keywords.
-
Example Request:
{
"infoContent": (PDF file),
"sampleText": (PDF file),
"sampleKeywords": (PDF file)
}
- Responses:
- 200: File uploaded successfully.
- Type:
object
- Example:
{ "message": "File uploaded successfully" }
- Type:
- 200: File uploaded successfully.
- Generate Blog Post via WebSocket:
When you need to upload files from which the AI will take information, you must upload each file to the @Controller('upload')
. The file names can be:
-
infoContent
(field "Upload own content" according to the design mockup) -
sampleText
(field "Sample text" according to the design mockup) -
sampleKeywords
(field "Sample placeholder Keyword PDF.PDF" according to the design)- Connect to the WebSocket server. You can use a WebSocket client library like
socket.io-client
. - Emit a request to generate an article:
const socket = io('http://localhost:3331'); socket.emit('generateArticle', { description: 'Your article description here', articleLength: 5, layoutStructure: 'Your layout structure here', callToAction: 'Your call to action here', toneOfVoice: string, languageComplexity: "Simple", vocabularyLevel: "Beginner", formalityLevel: "Casual", tempOfVoice: "Passive", keywords: ["Keyword Written 1", "Keyword Written 2"], sampleText: "sample of the blog post", // optional headings: { introduction: 'Introduction heading here', mainBody: 'Main body heading here', conclusion: 'Conclusion heading here', }, // optional subheadings: ['Subheading 1', 'Subheading 2'], // optional link: 'http://example.com', // optional });.
- Connect to the WebSocket server. You can use a WebSocket client library like
- Listen for the stream of article parts:
socket.on('articlePartGenerated', (chunk) => {
// Append the received chunk to your content area
console.log(ckunk); // part of post (few symbols)
});
- Generate Image Endpoint:
This endpoint generates an AI-created image based on the provided description.
- Operation:
generateImage
- Description: Create AI post photo
- Request Body:
- Type:
BasicGenerateImageDto
- Example:
{ "description": "A beautiful sunset over the mountains" }
- Type:
- Responses:
- 201: The image created
- Type:
ImageCreatedDto
- Example:
{ "url": "http://example.com/image.png" }
- Type:
- 201: The image created
- Save Blog Post Endpoint:
This endpoint saves the AI-generated image and text to the database.
- Operation:
save
- Description: Create AI post in database
- Request Body:
- Type:
BasicCreatePostDto
- Example:
{ "description": "A beautiful sunset over the mountains", "postText": "The sun set in a blaze of orange and red...", "imageUrl": "http://example.com/image.png" }
- Type:
- Responses:
- 201: The created record
- Type:
ResponsePostDto
- Example:
{ "id": "12345", "description": "A beautiful sunset over the mountains", "postText": "The sun set in a blaze of orange and red...", "imageUrl": "http://example.com/image.png", "createdAt": "2024-06-24T12:34:56Z" }
- Type:
- 201: The created record
-
Edit Blog Post:
- After receiving the complete blog post, you can implement an editor on the client side to make necessary changes.
- After editing, you can send the updated post to your backend for saving.
This endpoint updates an existing blog post.
- Operation:
updatePost
- Description: Update post
- Request Body:
- Type:
UpdatePostDto
- Example:
{ "id": "12345", "description": "An updated description", "postText": "Updated text of the blog post..." }
- Type:
- Responses:
- 200: The updated record
- Type:
ResponsePostDto
- Example:
{ "id": "12345", "description": "An updated description", "postText": "Updated text of the blog post...", "imageUrl": "http://example.com/image.png", "updatedAt": "2024-06-24T12:34:56Z" }
- Type:
- 200: The updated record
- Open your web browser and navigate to http://localhost:3331/api.