Spaces:
Running
Running
NeonBohdan
commited on
Commit
•
af66144
1
Parent(s):
9513cae
Added wrong persona error
Browse files
app.py
CHANGED
@@ -34,7 +34,11 @@ def respond(
|
|
34 |
):
|
35 |
messages = []
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
if system_prompt is not None:
|
39 |
messages.append({"role": "system", "content": system_prompt})
|
40 |
|
|
|
34 |
):
|
35 |
messages = []
|
36 |
|
37 |
+
try:
|
38 |
+
system_prompt = config[model]["personas"][persona]
|
39 |
+
except KeyError:
|
40 |
+
supported_personas = list(config[model]["personas"].keys())
|
41 |
+
raise gr.Error(f"Model '{model}' does not support persona '{persona}', only {supported_personas}")
|
42 |
if system_prompt is not None:
|
43 |
messages.append({"role": "system", "content": system_prompt})
|
44 |
|