Spaces:
Sleeping
Sleeping
Update prompts.py
Browse files- prompts.py +13 -8
prompts.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import yaml
|
| 2 |
|
| 3 |
def load_prompts():
|
| 4 |
files = ["config/prompts.yaml", "config/contentprompts.yml"]
|
|
@@ -9,10 +9,15 @@ def load_prompts():
|
|
| 9 |
if isinstance(data, dict):
|
| 10 |
merged.update(data)
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import yaml
|
| 2 |
|
| 3 |
def load_prompts():
|
| 4 |
files = ["config/prompts.yaml", "config/contentprompts.yml"]
|
|
|
|
| 9 |
if isinstance(data, dict):
|
| 10 |
merged.update(data)
|
| 11 |
|
| 12 |
+
def _to_str(v):
|
| 13 |
+
if v is None:
|
| 14 |
+
return "" # avoid literal "None"
|
| 15 |
+
if isinstance(v, str):
|
| 16 |
+
return v
|
| 17 |
+
if isinstance(v, dict) and "content" in v:
|
| 18 |
+
return str(v["content"]) # flatten chat-style entries
|
| 19 |
+
if isinstance(v, (list, tuple)):
|
| 20 |
+
return "\n".join(map(str, v)) # readable multiline
|
| 21 |
+
return str(v)
|
| 22 |
+
|
| 23 |
+
return {str(k): _to_str(v) for k, v in merged.items()}
|