mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-06 19:15:28 +00:00
Fix : browser navigation prompt
This commit is contained in:
parent
9f9907cedb
commit
ddc0b2f5d4
BIN
media/exemples/web_search.png
Normal file
BIN
media/exemples/web_search.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 240 KiB |
@ -41,10 +41,15 @@ class BrowserAgent(Agent):
|
|||||||
Navigable links:
|
Navigable links:
|
||||||
{format_links}
|
{format_links}
|
||||||
|
|
||||||
Remember, you must seek the information the user want.
|
|
||||||
The user query was : {user_prompt}
|
|
||||||
|
|
||||||
You must choose a link to navigate to.
|
You must choose a link to navigate to or do a new search.
|
||||||
|
Remember, you seek the information the user want.
|
||||||
|
The user query was : {user_prompt}
|
||||||
|
If you want to do a new search, use the "web_search" tool.
|
||||||
|
Exemple:
|
||||||
|
```web_search
|
||||||
|
weather in tokyo
|
||||||
|
```
|
||||||
If you have an answer and want to exit the browser, please say "REQUEST_EXIT".
|
If you have an answer and want to exit the browser, please say "REQUEST_EXIT".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -68,13 +73,17 @@ class BrowserAgent(Agent):
|
|||||||
animate_thinking("Thinking...", color="status")
|
animate_thinking("Thinking...", color="status")
|
||||||
self.memory.push('user', user_prompt)
|
self.memory.push('user', user_prompt)
|
||||||
answer, reasoning = self.llm_request(prompt)
|
answer, reasoning = self.llm_request(prompt)
|
||||||
|
pretty_print("-"*100)
|
||||||
|
pretty_print(answer, color="output")
|
||||||
|
pretty_print("-"*100)
|
||||||
if "REQUEST_EXIT" in answer:
|
if "REQUEST_EXIT" in answer:
|
||||||
complete = True
|
complete = True
|
||||||
break
|
break
|
||||||
links = self.extract_links(answer)
|
links = self.extract_links(answer)
|
||||||
links_clean = self.clean_links(links)
|
links_clean = self.clean_links(links)
|
||||||
if len(links_clean) == 0:
|
if len(links_clean) == 0:
|
||||||
prompt = "Please choose a link to navigate to."
|
prompt = f"Please choose a link to navigate to or do a new search. Links found:\n{links_clean}"
|
||||||
|
pretty_print("No links found, doing a new search.", color="warning")
|
||||||
continue
|
continue
|
||||||
animate_thinking(f"Navigating to {links[0]}", color="status")
|
animate_thinking(f"Navigating to {links[0]}", color="status")
|
||||||
speech_module.speak(f"Navigating to {links[0]}")
|
speech_module.speak(f"Navigating to {links[0]}")
|
||||||
|
@ -41,6 +41,8 @@ class Browser:
|
|||||||
|
|
||||||
def is_sentence(self, text):
|
def is_sentence(self, text):
|
||||||
"""Check if the text is a sentence."""
|
"""Check if the text is a sentence."""
|
||||||
|
if "404" in text:
|
||||||
|
return True # we want the ai to see the error
|
||||||
return len(text.split(" ")) > 5 and '.' in text
|
return len(text.split(" ")) > 5 and '.' in text
|
||||||
|
|
||||||
def getText(self):
|
def getText(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user