Update script_for_automation.py
Browse files- script_for_automation.py +26 -20
script_for_automation.py
CHANGED
|
@@ -389,26 +389,32 @@ def generate_markdown_output(df):
|
|
| 389 |
markdown += f"\n### Recipe ID: {row['Recipe_ID']}\n"
|
| 390 |
differences = row['Differences']
|
| 391 |
|
| 392 |
-
# Loop through
|
| 393 |
-
for
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
|
| 413 |
# 4. Prompts
|
| 414 |
markdown += "\n## Prompts\n"
|
|
|
|
| 389 |
markdown += f"\n### Recipe ID: {row['Recipe_ID']}\n"
|
| 390 |
differences = row['Differences']
|
| 391 |
|
| 392 |
+
# Loop through the differences list
|
| 393 |
+
for diff in differences:
|
| 394 |
+
for key, value in diff.items():
|
| 395 |
+
markdown += f"#### {key.capitalize()}\n"
|
| 396 |
+
|
| 397 |
+
# If the value is a string, output the string
|
| 398 |
+
if isinstance(value, str):
|
| 399 |
+
markdown += f"{value}\n"
|
| 400 |
+
|
| 401 |
+
# If the value is a dictionary, pretty-print the dictionary
|
| 402 |
+
elif isinstance(value, dict):
|
| 403 |
+
markdown += "```\n"
|
| 404 |
+
for sub_key, sub_value in value.items():
|
| 405 |
+
markdown += f"{sub_key}: {sub_value}\n"
|
| 406 |
+
markdown += "```\n"
|
| 407 |
+
|
| 408 |
+
# If the value is a list, output the list items
|
| 409 |
+
elif isinstance(value, list):
|
| 410 |
+
markdown += "```\n"
|
| 411 |
+
for item in value:
|
| 412 |
+
markdown += f"{item}\n"
|
| 413 |
+
markdown += "```\n"
|
| 414 |
+
|
| 415 |
+
# For any other type, just print the value
|
| 416 |
+
else:
|
| 417 |
+
markdown += f"{value}\n"
|
| 418 |
|
| 419 |
# 4. Prompts
|
| 420 |
markdown += "\n## Prompts\n"
|