mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-05 02:25:27 +00:00
fix : browser stuck due to history problem
This commit is contained in:
parent
7f3682e884
commit
5ac7df1854
6
api.py
6
api.py
@ -137,7 +137,7 @@ async def get_latest_answer():
|
||||
"answer": interaction.current_agent.last_answer,
|
||||
"agent_name": interaction.current_agent.agent_name if interaction.current_agent else "None",
|
||||
"success": interaction.current_agent.success,
|
||||
"blocks": {f'{i}': block.jsonify() for i, block in enumerate(interaction.current_agent.get_blocks_result)} if interaction.current_agent else {},
|
||||
"blocks": {f'{i}': block.jsonify() for i, block in enumerate(interaction.current_agent.get_blocks_result())} if interaction.current_agent else {},
|
||||
"status": interaction.current_agent.get_status_message if interaction.current_agent else "No status available",
|
||||
"timestamp": str(time.time())
|
||||
}
|
||||
@ -175,7 +175,7 @@ async def process_query(request: QueryRequest):
|
||||
agent_name="Unknown",
|
||||
success="false",
|
||||
blocks={},
|
||||
status="Waiting for agent...",
|
||||
status="No agent working.",
|
||||
timestamp=str(time.time())
|
||||
)
|
||||
if is_generating:
|
||||
@ -192,7 +192,7 @@ async def process_query(request: QueryRequest):
|
||||
return JSONResponse(status_code=400, content=query_resp.jsonify())
|
||||
|
||||
if interaction.current_agent:
|
||||
blocks_json = {f'{i}': block.jsonify() for i, block in enumerate(interaction.current_agent.get_blocks_result)}
|
||||
blocks_json = {f'{i}': block.jsonify() for i, block in enumerate(interaction.current_agent.get_blocks_result())}
|
||||
else:
|
||||
logger.error("No current agent found")
|
||||
blocks_json = {}
|
||||
|
@ -346,11 +346,13 @@ class BrowserAgent(Agent):
|
||||
complete = True
|
||||
break
|
||||
|
||||
if (link == None and not len(extracted_form)) or Action.GO_BACK.value in answer or link in self.search_history:
|
||||
if (link == None and len(extracted_form) < 3) or Action.GO_BACK.value in answer or link in self.search_history:
|
||||
pretty_print(f"Going back to results. Still {len(unvisited)}", color="status")
|
||||
self.status_message = "Going back to search results..."
|
||||
unvisited = self.select_unvisited(search_result)
|
||||
prompt = self.make_newsearch_prompt(user_prompt, unvisited)
|
||||
self.search_history.append(link)
|
||||
self.current_page = link
|
||||
continue
|
||||
|
||||
animate_thinking(f"Navigating to {link}", color="status")
|
||||
|
Loading…
x
Reference in New Issue
Block a user