mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-05 02:25:27 +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:
|
||||
{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".
|
||||
"""
|
||||
|
||||
@ -68,13 +73,17 @@ class BrowserAgent(Agent):
|
||||
animate_thinking("Thinking...", color="status")
|
||||
self.memory.push('user', user_prompt)
|
||||
answer, reasoning = self.llm_request(prompt)
|
||||
pretty_print("-"*100)
|
||||
pretty_print(answer, color="output")
|
||||
pretty_print("-"*100)
|
||||
if "REQUEST_EXIT" in answer:
|
||||
complete = True
|
||||
break
|
||||
links = self.extract_links(answer)
|
||||
links_clean = self.clean_links(links)
|
||||
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
|
||||
animate_thinking(f"Navigating to {links[0]}", color="status")
|
||||
speech_module.speak(f"Navigating to {links[0]}")
|
||||
|
@ -41,6 +41,8 @@ class Browser:
|
||||
|
||||
def is_sentence(self, text):
|
||||
"""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
|
||||
|
||||
def getText(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user