Skip to content

Commit 9fbd0dc

Browse files
authored
Merge pull request #3178 from Dokploy/3081-ai-assistant-generates-irrelevant-variant-titles-eg-coolify-that-do-not-match-the-generated-compose-file
refactor(ai): enhance suggestion logic for deployment variants and op…
2 parents 4489240 + 9e405c0 commit 9fbd0dc

1 file changed

Lines changed: 45 additions & 7 deletions

File tree

  • packages/server/src/services

packages/server/src/services/ai.ts

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,28 @@ export const suggestVariants = async ({
104104
),
105105
}),
106106
prompt: `
107-
Act as advanced DevOps engineer and generate a list of open source projects what can cover users needs(up to 3 items).
107+
Act as advanced DevOps engineer and analyze the user's request to determine the appropriate suggestions (up to 3 items).
108+
109+
CRITICAL - Read the user's request carefully and follow the appropriate strategy:
110+
111+
Strategy A - If the user specifies a PARTICULAR APPLICATION/SERVICE (e.g., "deploy Chatwoot", "install sendingtk/chatwoot:develop", "setup Bitwarden"):
112+
- Generate different deployment VARIANTS of that SAME application
113+
- Each variant should be a different configuration (minimal, full stack, with different databases, development vs production, etc.)
114+
- Example: For "Chatwoot" → "Chatwoot with PostgreSQL", "Chatwoot Development", "Chatwoot Full Stack"
115+
- The name MUST include the specific application name the user mentioned
116+
117+
Strategy B - If the user describes a GENERAL NEED or USE CASE (e.g., "personal blog", "project management tool", "chat application"):
118+
- Suggest different open source projects that fulfill that need
119+
- Each suggestion should be a different tool/platform that solves the same problem
120+
- Example: For "personal blog" → "WordPress", "Ghost", "Hugo with Nginx"
121+
- The name should be the actual project name
108122
109123
Return your response as a JSON object with the following structure:
110124
{
111125
"suggestions": [
112126
{
113-
"id": "project-slug",
114-
"name": "Project Name",
127+
"id": "project-or-variant-slug",
128+
"name": "Project Name or Variant Name",
115129
"shortDescription": "Brief one-line description",
116130
"description": "Detailed description"
117131
}
@@ -120,10 +134,14 @@ export const suggestVariants = async ({
120134
121135
Important rules for the response:
122136
1. Use slug format for the id field (lowercase, hyphenated)
123-
2. The description field should ONLY contain a plain text description of the project, its features, and use cases
124-
3. Do NOT include any code snippets, configuration examples, or installation instructions in the description
125-
4. The shortDescription should be a single-line summary focusing on the main technologies
126-
5. All projects should be installable in docker and have docker compose support
137+
2. Determine which strategy to use based on whether the user specified a particular application or described a general need
138+
3. For Strategy A (specific app): The name must include the app name and describe the variant configuration
139+
4. For Strategy B (general need): The name should be the actual project/tool name that fulfills the need
140+
5. The description field should ONLY contain a plain text description of the project or variant, its features, and use cases
141+
6. Do NOT include any code snippets, configuration examples, or installation instructions in the description
142+
7. The shortDescription should be a single-line summary focusing on key technologies or differentiators
143+
8. All suggestions should be installable in docker and have docker compose support
144+
9. Provide variety in your suggestions - different complexity levels, tech stacks, or approaches
127145
128146
User wants to create a new project with the following details:
129147
@@ -186,6 +204,24 @@ export const suggestVariants = async ({
186204
6. If a service depends on a database or other service, INCLUDE that service in the docker-compose
187205
7. Make sure all required services are defined in the docker-compose
188206
207+
Docker Image Rules (CRITICAL):
208+
1. ALWAYS use 'image:' field, NEVER use 'build:' field
209+
2. NEVER use 'build: .' or any build directive - we don't have local Dockerfiles
210+
3. Use images from Docker Hub or other public registries (e.g., docker.io, ghcr.io, quay.io)
211+
4. For dependencies (databases, redis, etc.), use official images (e.g., postgres:16, redis:7, etc.)
212+
5. Always specify image tags - avoid using 'latest' tag, use specific versions when possible
213+
6. Examples of correct image usage:
214+
- image: sendingtk/chatwoot:develop
215+
- image: postgres:16-alpine
216+
- image: redis:7-alpine
217+
- image: chatwoot/chatwoot:latest
218+
7. Examples of INCORRECT usage (DO NOT USE):
219+
- build: .
220+
- build: ./app
221+
- build:
222+
context: .
223+
dockerfile: Dockerfile
224+
189225
Volume Mounting and Configuration Rules:
190226
1. DO NOT create configuration files unless the service CANNOT work without them
191227
2. Most services can work with just environment variables - USE THEM FIRST
@@ -214,6 +250,8 @@ export const suggestVariants = async ({
214250
- serviceName: the name of the service in the docker-compose
215251
2. Make sure the service is properly configured to work with the specified port
216252
253+
User's original request: ${input}
254+
217255
Project details:
218256
${suggestion?.description}
219257
`,

0 commit comments

Comments
 (0)