Spaces:
Running
Running
kanhatakeyama
commited on
Commit
•
7835cb1
1
Parent(s):
64ef132
Update app.py
Browse files
app.py
CHANGED
@@ -48,12 +48,14 @@ def save_or_update_conversation(conversation_id, history,
|
|
48 |
data = [json.loads(line) for line in f if line.strip()]
|
49 |
|
50 |
# Find if an entry with the same id and message_index exists
|
51 |
-
entry_index = next((i for i, entry in enumerate(data) if entry['id'] == conversation_id and entry['message_index'] == message_index), None)
|
52 |
|
53 |
-
if entry_index is not None:
|
54 |
-
|
55 |
data[entry_index]['label'] = liked
|
56 |
-
else:
|
|
|
|
|
57 |
# Append new entry
|
58 |
data.append({
|
59 |
"id": conversation_id,
|
|
|
48 |
data = [json.loads(line) for line in f if line.strip()]
|
49 |
|
50 |
# Find if an entry with the same id and message_index exists
|
51 |
+
#entry_index = next((i for i, entry in enumerate(data) if entry['id'] == conversation_id and entry['message_index'] == message_index), None)
|
52 |
|
53 |
+
#if entry_index is not None:
|
54 |
+
## # Update existing entry
|
55 |
data[entry_index]['label'] = liked
|
56 |
+
#else:
|
57 |
+
#always append
|
58 |
+
if True:
|
59 |
# Append new entry
|
60 |
data.append({
|
61 |
"id": conversation_id,
|