Update process_data.py
Browse files- process_data.py +9 -15
process_data.py
CHANGED
|
@@ -250,15 +250,6 @@ def parse_survey_stack_parameters(data):
|
|
| 250 |
processed_data = {}
|
| 251 |
|
| 252 |
processed_data["model_version"] = data[0]['data']['modelversion']['value'][0]
|
| 253 |
-
|
| 254 |
-
print("DATA")
|
| 255 |
-
print(data)
|
| 256 |
-
|
| 257 |
-
print("DATA 0 data")
|
| 258 |
-
print(data[0]['data'])
|
| 259 |
-
|
| 260 |
-
print("DATA 0 data preprompt")
|
| 261 |
-
print(data[0]['data']['preprompt'])
|
| 262 |
|
| 263 |
#if data['group_2']['preprompt']['value'][0] == 'continue_preprompts':
|
| 264 |
# processed_data["pre_prompt"] = True
|
|
@@ -284,17 +275,20 @@ def parse_survey_stack_parameters(data):
|
|
| 284 |
# processed_data["combined_pre_prompt"] = None
|
| 285 |
|
| 286 |
try:
|
| 287 |
-
|
|
|
|
|
|
|
|
|
|
| 288 |
processed_data["pre_prompt"] = True
|
| 289 |
|
| 290 |
# Accessing context and other prompts, with defaults in case they are None
|
| 291 |
-
processed_data["context_pre_prompt"] =
|
| 292 |
-
processed_data["summary_pre_prompt"] =
|
| 293 |
-
processed_data["conversation_pre_prompt"] =
|
| 294 |
-
processed_data["example_pre_prompt"] =
|
| 295 |
|
| 296 |
# Check if chaining is set to "yes" or "no"
|
| 297 |
-
chaining_value =
|
| 298 |
|
| 299 |
if chaining_value == "no":
|
| 300 |
# Combine prompts if chaining is "no"
|
|
|
|
| 250 |
processed_data = {}
|
| 251 |
|
| 252 |
processed_data["model_version"] = data[0]['data']['modelversion']['value'][0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
#if data['group_2']['preprompt']['value'][0] == 'continue_preprompts':
|
| 255 |
# processed_data["pre_prompt"] = True
|
|
|
|
| 275 |
# processed_data["combined_pre_prompt"] = None
|
| 276 |
|
| 277 |
try:
|
| 278 |
+
parameters_json = json.loads(data)
|
| 279 |
+
pre_promp_parameters = parameters_json['data']['group_2']
|
| 280 |
+
|
| 281 |
+
if pre_promp_parameters['preprompt']['value'][0] == 'continue_preprompts':
|
| 282 |
processed_data["pre_prompt"] = True
|
| 283 |
|
| 284 |
# Accessing context and other prompts, with defaults in case they are None
|
| 285 |
+
processed_data["context_pre_prompt"] = pre_promp_parameters.get('contextpreprompt', {}).get('value', None)
|
| 286 |
+
processed_data["summary_pre_prompt"] = pre_promp_parameters.get('summarypreprompt', {}).get('value', None)
|
| 287 |
+
processed_data["conversation_pre_prompt"] = pre_promp_parameters.get('conversationpreprompt', {}).get('value', None)
|
| 288 |
+
processed_data["example_pre_prompt"] = pre_promp_parameters.get('examplepreprompt', {}).get('value', None)
|
| 289 |
|
| 290 |
# Check if chaining is set to "yes" or "no"
|
| 291 |
+
chaining_value = pre_promp_parameters.get('prepromptchaining', {}).get('value', [None])[0]
|
| 292 |
|
| 293 |
if chaining_value == "no":
|
| 294 |
# Combine prompts if chaining is "no"
|