Spaces:
Build error
Build error
null and void
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -115,42 +115,6 @@ def chat(model1, model2, user_input, history, inserted_response=""):
|
|
115 |
|
116 |
return history, "Conversation completed."
|
117 |
|
118 |
-
|
119 |
-
models = [model1, model2]
|
120 |
-
current_model_index = 0 if manager.current_model in ["User", "Model 2"] else 1
|
121 |
-
|
122 |
-
while not manager.task_complete: # Continue until task is complete
|
123 |
-
if manager.is_paused:
|
124 |
-
yield history, "Conversation paused."
|
125 |
-
return
|
126 |
-
|
127 |
-
model = models[current_model_index]
|
128 |
-
manager.current_model = model
|
129 |
-
|
130 |
-
if inserted_response and current_model_index == 0:
|
131 |
-
response = inserted_response
|
132 |
-
inserted_response = ""
|
133 |
-
else:
|
134 |
-
prompt = manager.get_conversation_history() + "\n\nPlease continue the conversation. If you believe the task is complete, end your response with 'Task complete?'"
|
135 |
-
response = manager.generate_response(model, prompt)
|
136 |
-
|
137 |
-
manager.add_to_conversation(model, response)
|
138 |
-
history = manager.get_conversation_history()
|
139 |
-
|
140 |
-
for i in range(manager.delay, 0, -1):
|
141 |
-
yield history, f"{model} is writing... {i}"
|
142 |
-
time.sleep(1)
|
143 |
-
|
144 |
-
yield history, ""
|
145 |
-
|
146 |
-
if manager.task_complete:
|
147 |
-
yield history, "Models believe the task is complete. Are you satisfied with the result? (Yes/No)"
|
148 |
-
return
|
149 |
-
|
150 |
-
current_model_index = (current_model_index + 1) % 2
|
151 |
-
|
152 |
-
return history, "Conversation completed."
|
153 |
-
|
154 |
def user_satisfaction(satisfied, history):
|
155 |
if satisfied.lower() == 'yes':
|
156 |
return history, "Task completed successfully."
|
|
|
115 |
|
116 |
return history, "Conversation completed."
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
def user_satisfaction(satisfied, history):
|
119 |
if satisfied.lower() == 'yes':
|
120 |
return history, "Task completed successfully."
|