Spaces:
Sleeping
Sleeping
forgot to store task itself back to db
Browse files
app.py
CHANGED
@@ -37,9 +37,10 @@ def find_smallest_incomplete_task(app_name):
|
|
37 |
return smallest_incomplete_idx
|
38 |
|
39 |
|
40 |
-
def write_task_data(app_name, idx, task_complete, task_completed_step):
|
41 |
doc_ref = db.collection(app_name).document(f"{app_name}_{idx}")
|
42 |
doc_ref.set({
|
|
|
43 |
"task_completed": task_complete,
|
44 |
"task_completed_steps": task_completed_step
|
45 |
})
|
@@ -51,6 +52,7 @@ class AppSimulator:
|
|
51 |
self.openai_api_key = openai_api_key
|
52 |
self.app_name = None
|
53 |
self.smallest_index = None
|
|
|
54 |
|
55 |
def initialize_simulator(self, sitemap_url, progress=gr.Progress(track_tqdm=True)):
|
56 |
"""Initialize the simulator with retries and elapsed time tracking."""
|
@@ -80,6 +82,8 @@ class AppSimulator:
|
|
80 |
solution = incomplete_task["steps"]
|
81 |
user_data = incomplete_task["attributes"]["user_data"]
|
82 |
|
|
|
|
|
83 |
self.simulation = ChatbotSimulation(
|
84 |
app_name=app_name,
|
85 |
site_map=sitemap,
|
@@ -122,7 +126,8 @@ def chat(user_input, history):
|
|
122 |
task_completed_step = int(match.group(1))
|
123 |
app_name = simulator_app.app_name
|
124 |
idx = simulator_app.smallest_index
|
125 |
-
|
|
|
126 |
|
127 |
return response
|
128 |
|
@@ -134,8 +139,9 @@ def give_up():
|
|
134 |
|
135 |
app_name = simulator_app.app_name
|
136 |
idx = simulator_app.smallest_index
|
|
|
137 |
|
138 |
-
write_task_data(app_name, idx, task_completed, task_completed_steps)
|
139 |
|
140 |
return "Task marked as abandoned (Give-Up action)."
|
141 |
|
|
|
37 |
return smallest_incomplete_idx
|
38 |
|
39 |
|
40 |
+
def write_task_data(app_name, idx, task, task_complete, task_completed_step):
|
41 |
doc_ref = db.collection(app_name).document(f"{app_name}_{idx}")
|
42 |
doc_ref.set({
|
43 |
+
"task": task,
|
44 |
"task_completed": task_complete,
|
45 |
"task_completed_steps": task_completed_step
|
46 |
})
|
|
|
52 |
self.openai_api_key = openai_api_key
|
53 |
self.app_name = None
|
54 |
self.smallest_index = None
|
55 |
+
self.task = None
|
56 |
|
57 |
def initialize_simulator(self, sitemap_url, progress=gr.Progress(track_tqdm=True)):
|
58 |
"""Initialize the simulator with retries and elapsed time tracking."""
|
|
|
82 |
solution = incomplete_task["steps"]
|
83 |
user_data = incomplete_task["attributes"]["user_data"]
|
84 |
|
85 |
+
self.task = task
|
86 |
+
|
87 |
self.simulation = ChatbotSimulation(
|
88 |
app_name=app_name,
|
89 |
site_map=sitemap,
|
|
|
126 |
task_completed_step = int(match.group(1))
|
127 |
app_name = simulator_app.app_name
|
128 |
idx = simulator_app.smallest_index
|
129 |
+
task = simulator_app.task
|
130 |
+
write_task_data(app_name, idx, task, task_complete, task_completed_step)
|
131 |
|
132 |
return response
|
133 |
|
|
|
139 |
|
140 |
app_name = simulator_app.app_name
|
141 |
idx = simulator_app.smallest_index
|
142 |
+
task = simulator_app.task
|
143 |
|
144 |
+
write_task_data(app_name, idx, task, task_completed, task_completed_steps)
|
145 |
|
146 |
return "Task marked as abandoned (Give-Up action)."
|
147 |
|