Skip to content

Commit 1334572

Browse files
add example mermaid.js flow and move explanation reasoning to medium
1 parent 4a87757 commit 1334572

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

backend/app/prompts.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@
141141
- If you believe the component references a specific file, include the file path.
142142
- Make sure to include the full path to the directory or file exactly as specified in the component mapping.
143143
- It is very important that you do this for as many files as possible. The more the better.
144-
- IMPORTANT: these are for click events only, these paths should not be included in the diagram's node's names.
144+
145+
- IMPORTANT: THESE PATHS ARE FOR CLICK EVENTS ONLY, these paths should not be included in the diagram's node's names. Only for the click events. Paths should not be seen by the user.
145146
146147
Your output should be valid Mermaid.js code that can be rendered into a diagram.
147148
@@ -152,10 +153,43 @@
152153
153154
Ensure that your diagram adheres strictly to the given explanation, without adding or omitting any significant components or relationships.
154155
156+
As a very general direction, the provided example below is a good flow for your code:
157+
158+
```mermaid
159+
flowchart TD
160+
%% or graph TD, your choice
161+
162+
%% Global entities
163+
A("Entity A"):::external
164+
%% more...
165+
166+
%% Subgraphs and modules
167+
subgraph "Layer A"
168+
A1("Module A"):::example
169+
%% more modules...
170+
%% inner subgraphs if needed...
171+
end
172+
173+
%% more subgraphs, modules, etc...
174+
175+
%% Connections
176+
A -->|"relationship"| B
177+
%% and a lot more...
178+
179+
%% Click Events
180+
click A1 "example/example.js"
181+
%% and a lot more...
182+
183+
%% Styles
184+
classDef frontend %%...
185+
%% and a lot more...
186+
```
187+
155188
EXTREMELY Important notes on syntax!!! (PAY ATTENTION TO THIS):
156189
- Make sure to add colour to the diagram!!! This is extremely critical.
157190
- In Mermaid.js syntax, we cannot include special characters for nodes without being inside quotes! For example: `EX[/api/process (Backend)]:::api` and `API -->|calls Process()| Backend` are two examples of syntax errors. They should be `EX["/api/process (Backend)"]:::api` and `API -->|"calls Process()"| Backend` respectively. Notice the quotes. This is extremely important. Make sure to include quotes for any string that contains special characters.
158191
- In Mermaid.js syntax, you cannot apply a class style directly within a subgraph declaration. For example: `subgraph "Frontend Layer":::frontend` is a syntax error. However, you can apply them to nodes within the subgraph. For example: `Example["Example Node"]:::frontend` is valid, and `class Example1,Example2 frontend` is valid.
192+
- In Mermaid.js syntax, there cannot be spaces in the relationship label names. For example: `A -->| "example relationship" | B` is a syntax error. It should be `A -->|"example relationship"| B`
159193
"""
160194
# ^^^ note: ive generated a few diagrams now and claude still writes incorrect mermaid code sometimes. in the future, refer to those generated diagrams and add important instructions to the prompt above to avoid those mistakes. examples are best.
161195

backend/app/routers/generate.py

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ async def generate(request: Request, body: ApiRequest):
134134
"instructions": body.instructions,
135135
},
136136
api_key=body.api_key,
137+
reasoning_effort="medium",
137138
)
138139

139140
# Check for BAD_INSTRUCTIONS response

0 commit comments

Comments
 (0)