mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-04 18:20:09 +00:00
fix : chromedriver bug
This commit is contained in:
commit
80071fbeaa
@ -2,10 +2,10 @@
|
||||
is_local = True
|
||||
provider_name = ollama
|
||||
provider_model = deepseek-r1:14b
|
||||
provider_server_address = 127.0.0.1:5000
|
||||
provider_server_address = 127.0.0.1:11434
|
||||
agent_name = Friday
|
||||
recover_last_session = True
|
||||
save_session = False
|
||||
speak = True
|
||||
listen = False
|
||||
work_dir = /Users/mlg/Documents/A-project/AI/Agents/agenticSeek/ai_workplace
|
||||
work_dir = /Users/mlg/Documents/ai_workplace
|
@ -19,6 +19,7 @@ pyaudio==0.2.14
|
||||
librosa==0.10.2.post1
|
||||
selenium==4.29.0
|
||||
markdownify==1.1.0
|
||||
chromedriver-autoinstaller==0.6.4
|
||||
httpx>=0.27,<0.29
|
||||
anyio>=3.5.0,<5
|
||||
distro>=1.7.0,<2
|
||||
@ -29,4 +30,4 @@ tqdm>4
|
||||
ordered_set
|
||||
pypinyin
|
||||
cn2an
|
||||
jieba
|
||||
jieba
|
||||
|
@ -5,6 +5,7 @@ from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.common.exceptions import TimeoutException, WebDriverException
|
||||
import chromedriver_autoinstaller
|
||||
import time
|
||||
import os
|
||||
import shutil
|
||||
@ -38,10 +39,16 @@ class Browser:
|
||||
chrome_options.add_argument("--disable-gpu")
|
||||
chrome_options.add_argument("--no-sandbox")
|
||||
chrome_options.add_argument("--disable-dev-shm-usage")
|
||||
# Automatically find ChromeDriver path
|
||||
chromedriver_path = shutil.which("chromedriver")
|
||||
|
||||
chromedriver_path = shutil.which("chromedriver") # system installed driver.
|
||||
|
||||
#If not found, try auto-installing the correct version
|
||||
if not chromedriver_path:
|
||||
chromedriver_path = chromedriver_autoinstaller.install()
|
||||
|
||||
if not chromedriver_path:
|
||||
raise FileNotFoundError("ChromeDriver not found. Please install it or add it to your PATH.")
|
||||
|
||||
service = Service(chromedriver_path)
|
||||
self.driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
|
@ -61,7 +61,7 @@ class AgentRouter:
|
||||
result = self.classify_text(text)
|
||||
for agent in self.agents:
|
||||
if result["labels"][0] == agent.role:
|
||||
pretty_print(f"Selected agent: {agent.agent_name}", color="warning")
|
||||
pretty_print(f"Selected agent: {agent.agent_name} (roles: {agent.role})", color="warning")
|
||||
return agent
|
||||
return None
|
||||
|
||||
|
@ -4,6 +4,7 @@ import soundfile as sf
|
||||
import subprocess
|
||||
import re
|
||||
import platform
|
||||
from sys import modules
|
||||
|
||||
class Speech():
|
||||
"""
|
||||
@ -24,7 +25,7 @@ class Speech():
|
||||
self.voice = self.voice_map[language][2]
|
||||
self.speed = 1.2
|
||||
|
||||
def speak(self, sentence: str, voice_number: int = 1):
|
||||
def speak(self, sentence: str, voice_number: int = 1 , audio_file: str = 'sample.wav'):
|
||||
"""
|
||||
Convert text to speech using an AI model and play the audio.
|
||||
|
||||
@ -38,17 +39,17 @@ class Speech():
|
||||
sentence, voice=self.voice,
|
||||
speed=self.speed, split_pattern=r'\n+'
|
||||
)
|
||||
for i, (gs, ps, audio) in enumerate(generator):
|
||||
audio_file = 'sample.wav'
|
||||
display(Audio(data=audio, rate=24000, autoplay=i==0), display_id=False)
|
||||
for i, (_, _, audio) in enumerate(generator):
|
||||
if 'ipykernel' in modules: #only display in jupyter notebook.
|
||||
display(Audio(data=audio, rate=24000, autoplay=i==0), display_id=False)
|
||||
sf.write(audio_file, audio, 24000) # save each audio file
|
||||
if platform.system().lower() == "windows":
|
||||
import winsound
|
||||
winsound.PlaySound(audio_file, winsound.SND_FILENAME)
|
||||
elif platform.system().lower() == "linux":
|
||||
subprocess.call(["aplay", audio_file])
|
||||
else:
|
||||
elif platform.system().lower() == "darwin": # macOS
|
||||
subprocess.call(["afplay", audio_file])
|
||||
else: # linux or other.
|
||||
subprocess.call(["aplay", audio_file])
|
||||
|
||||
def replace_url(self, url: re.Match) -> str:
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user