mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-06 11:05:26 +00:00
fix : blocks not appearing on front for planner agent
This commit is contained in:
parent
812af254b5
commit
82aecd0aae
@ -12,12 +12,12 @@ English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Franç
|
||||
|
||||
[](https://fosowl.github.io/agenticSeek.html)  [](https://discord.gg/m37d7XxZ) [](https://x.com/Martin993886460) [](https://github.com/Fosowl/agenticSeek/stargazers)
|
||||
|
||||
> 🛠️ **Work in Progress** – Looking for contributors!
|
||||
|
||||
> *Plan a 3 days trip to Budapest, find me a list of attractions and hotels, save everything in a CSV file*
|
||||
> *Plan a 3 days solo trip to Budapest, find me a list of attractions and hostels, save everything in a CSV file*
|
||||
|
||||
https://github.com/user-attachments/assets/4bd5faf6-459f-4f94-bd1d-238c4b331469
|
||||
|
||||
> 🛠️ **Work in Progress** – Looking for contributors!
|
||||
|
||||
- **100% Local**: *No cloud, runs on your hardware. Your data stays yours.*
|
||||
|
||||
@ -31,7 +31,6 @@ https://github.com/user-attachments/assets/4bd5faf6-459f-4f94-bd1d-238c4b331469
|
||||
|
||||
- **Memory**: *Efficient memory and sessions management.*
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure you have chrome driver, docker and python3.10 (or newer) installed.
|
||||
|
@ -79,6 +79,7 @@ function App() {
|
||||
const res = await axios.get('http://0.0.0.0:8000/latest_answer');
|
||||
const data = res.data;
|
||||
|
||||
updateData(data);
|
||||
if (!data.answer || data.answer.trim() === '') {
|
||||
return;
|
||||
}
|
||||
@ -98,7 +99,6 @@ function App() {
|
||||
},
|
||||
]);
|
||||
setStatus(data.status);
|
||||
setResponseData(data);
|
||||
scrollToBottom();
|
||||
} else {
|
||||
console.log('Duplicate answer detected, skipping:', data.answer);
|
||||
@ -108,6 +108,17 @@ function App() {
|
||||
}
|
||||
};
|
||||
|
||||
const updateData = (data) => {
|
||||
setResponseData((prev) => ({
|
||||
...prev,
|
||||
blocks: data.blocks || prev.blocks || null,
|
||||
done: data.done,
|
||||
answer: data.answer,
|
||||
agent_name: data.agent_name,
|
||||
status: data.status,
|
||||
uid: data.uid,
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
@ -130,7 +141,7 @@ function App() {
|
||||
setQuery('Enter your query...');
|
||||
console.log('Response:', res.data);
|
||||
const data = res.data;
|
||||
setResponseData(data);
|
||||
updateData(data);
|
||||
fetchLatestAnswer();
|
||||
} catch (err) {
|
||||
console.error('Error:', err);
|
||||
|
@ -317,6 +317,8 @@ class BrowserAgent(Agent):
|
||||
while not complete and len(unvisited) > 0:
|
||||
|
||||
self.memory.clear()
|
||||
print("Debug history:", self.search_history)
|
||||
unvisited = self.select_unvisited(search_result)
|
||||
answer, reasoning = await self.llm_decide(prompt, show_reasoning = False)
|
||||
self.last_answer = answer
|
||||
pretty_print('▂'*32, color="status")
|
||||
@ -339,6 +341,11 @@ class BrowserAgent(Agent):
|
||||
|
||||
links = self.parse_answer(answer)
|
||||
link = self.select_link(links)
|
||||
if link == self.current_page:
|
||||
pretty_print(f"Already visited {link}. Search callback.", color="status")
|
||||
prompt = self.make_newsearch_prompt(user_prompt, unvisited)
|
||||
self.search_history.append(link)
|
||||
continue
|
||||
|
||||
if Action.REQUEST_EXIT.value in answer:
|
||||
self.status_message = "Exiting web browser..."
|
||||
@ -349,7 +356,6 @@ class BrowserAgent(Agent):
|
||||
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
|
||||
@ -357,8 +363,12 @@ class BrowserAgent(Agent):
|
||||
|
||||
animate_thinking(f"Navigating to {link}", color="status")
|
||||
if speech_module: speech_module.speak(f"Navigating to {link}")
|
||||
self.browser.go_to(link)
|
||||
nav_ok = self.browser.go_to(link)
|
||||
self.search_history.append(link)
|
||||
if not nav_ok:
|
||||
pretty_print(f"Failed to navigate to {link}.", color="failure")
|
||||
prompt = self.make_newsearch_prompt(user_prompt, unvisited)
|
||||
continue
|
||||
self.current_page = link
|
||||
page_text = self.browser.get_text()
|
||||
self.navigable_links = self.browser.get_navigable()
|
||||
|
@ -135,10 +135,6 @@ class PlannerAgent(Agent):
|
||||
animate_thinking("Thinking...", color="status")
|
||||
self.memory.push('user', prompt)
|
||||
answer, reasoning = await self.llm_request()
|
||||
print("LLM answer:")
|
||||
print(reasoning)
|
||||
print(answer)
|
||||
print("LLM answer end")
|
||||
if "NO_UPDATE" in answer:
|
||||
return []
|
||||
agents_tasks = self.parse_agent_tasks(answer)
|
||||
@ -160,6 +156,7 @@ class PlannerAgent(Agent):
|
||||
Returns:
|
||||
dict: The updated plan.
|
||||
"""
|
||||
self.status_message = "Updating plan..."
|
||||
last_agent_work = agents_work_result[id]
|
||||
tool_success_str = "success" if success else "failure"
|
||||
pretty_print(f"Agent {id} work {tool_success_str}.", color="success" if success else "failure")
|
||||
@ -196,6 +193,7 @@ class PlannerAgent(Agent):
|
||||
Returns:
|
||||
str: The result of the agent process.
|
||||
"""
|
||||
self.status_message = f"Starting task {task['task']}..."
|
||||
agent_prompt = self.make_prompt(task['task'], required_infos)
|
||||
pretty_print(f"Agent {task['agent']} started working...", color="status")
|
||||
agent_answer, _ = await self.agents[task['agent'].lower()].process(agent_prompt, None)
|
||||
@ -219,6 +217,7 @@ class PlannerAgent(Agent):
|
||||
agents_tasks = []
|
||||
agents_work_result = dict()
|
||||
|
||||
self.status_message = "Making a plan..."
|
||||
agents_tasks = await self.make_plan(goal)
|
||||
|
||||
if agents_tasks == []:
|
||||
@ -227,7 +226,7 @@ class PlannerAgent(Agent):
|
||||
steps = len(agents_tasks)
|
||||
while i < steps:
|
||||
task_name, task = agents_tasks[i][0], agents_tasks[i][1]
|
||||
self.status_message = "Starting agent process..."
|
||||
self.status_message = "Starting agents..."
|
||||
pretty_print(f"I will {task_name}.", color="info")
|
||||
pretty_print(f"Assigned agent {task['agent']} to {task_name}", color="info")
|
||||
if speech_module: speech_module.speak(f"I will {task_name}. I assigned the {task['agent']} agent to the task.")
|
||||
|
@ -166,13 +166,17 @@ class Browser:
|
||||
try:
|
||||
initial_handles = self.driver.window_handles
|
||||
self.driver.get(url)
|
||||
wait = WebDriverWait(self.driver, timeout=10)
|
||||
wait.until(
|
||||
lambda driver: (
|
||||
not any(keyword in driver.page_source.lower() for keyword in ["checking your browser", "captcha"])
|
||||
),
|
||||
message="stuck on 'checking browser' or verification screen"
|
||||
)
|
||||
try:
|
||||
wait = WebDriverWait(self.driver, timeout=10)
|
||||
wait.until(
|
||||
lambda driver: (
|
||||
not any(keyword in driver.page_source.lower() for keyword in ["checking your browser", "captcha"])
|
||||
),
|
||||
message="stuck on 'checking browser' or verification screen"
|
||||
)
|
||||
except TimeoutException:
|
||||
self.logger.warning("Timeout while waiting for page to bypass 'checking your browser'")
|
||||
return False
|
||||
self.apply_web_safety()
|
||||
self.logger.log(f"Navigated to: {url}")
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user