Skip to content

Commit 3bbf566

Browse files
committed
feat(ui): add approve and reject patch actions with feedback
1 parent 1fbaa74 commit 3bbf566

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

codetide/agents/tide/ui/app.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,29 @@ async def on_inspect_context(action :cl.Action):
265265

266266
await inspect_msg.send()
267267

268+
@cl.action_callback("approve_patch")
269+
async def on_approve_patch(action :cl.Action):
270+
agent_tide_ui: AgentTideUi = cl.user_session.get("AgentTideUi")
271+
await action.remove()
272+
if action.payload.get("lgtm"):
273+
agent_tide_ui.agent_tide.approve()
274+
275+
@cl.action_callback("reject_patch")
276+
async def on_reject_patch(action :cl.Action):
277+
agent_tide_ui: AgentTideUi = cl.user_session.get("AgentTideUi")
278+
chat_history = cl.user_session.get("chat_history")
279+
280+
await action.remove()
281+
response = await cl.AskUserMessage(
282+
content="""Please provide specific feedback explaining why the patch was rejected. Include what's wrong, which parts are problematic, and what needs to change. Avoid vague responses like "doesn't work" - instead be specific like "missing error handling for FileNotFoundError" or "function should return boolean, not None." Your detailed feedback helps generate a better solution.""",
283+
timeout=3600
284+
).send()
285+
286+
feedback = response.get("output")
287+
agent_tide_ui.agent_tide.reject(feedback)
288+
chat_history.append({"role": "user", "content": feedback})
289+
await agent_loop(agent_tide_ui=agent_tide_ui)
290+
268291
@cl.on_message
269292
async def agent_loop(message: Optional[cl.Message]=None, codeIdentifiers: Optional[list] = None, agent_tide_ui :Optional[AgentTideUi]=None):
270293

@@ -493,6 +516,12 @@ def main():
493516

494517
if __name__ == "__main__":
495518
main()
519+
520+
# if __name__ == "__main__":
521+
# import asyncio
522+
# os.environ["AGENT_TIDE_CONFIG_PATH"] = DEFAULT_AGENT_TIDE_LLM_CONFIG_PATH
523+
# asyncio.run(init_db(f"{os.environ['CHAINLIT_APP_ROOT']}/database.db"))
524+
# serve()
496525
# TODO fix the no time being inserted to msg bug in data-persistance
497526
# TODO there's a bug that changes are not being persistied in untracked files that are deleted so will need to update codetide to track that
498527
# TODO add chainlit commands for writing tests, updating readme, writing commit message and planning

0 commit comments

Comments
 (0)