mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-03 01:30:11 +00:00
fix : connection issue with 0.0.0.0 in app.js + unzoom browser view
This commit is contained in:
parent
2048af854f
commit
ef91502961
@ -25,7 +25,7 @@ function App() {
|
|||||||
|
|
||||||
const checkHealth = async () => {
|
const checkHealth = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.get('http://0.0.0.0:8000/health');
|
await axios.get('http://127.0.0.1:8000/health');
|
||||||
setIsOnline(true);
|
setIsOnline(true);
|
||||||
console.log('System is online');
|
console.log('System is online');
|
||||||
} catch {
|
} catch {
|
||||||
@ -37,7 +37,7 @@ function App() {
|
|||||||
const fetchScreenshot = async () => {
|
const fetchScreenshot = async () => {
|
||||||
try {
|
try {
|
||||||
const timestamp = new Date().getTime();
|
const timestamp = new Date().getTime();
|
||||||
const res = await axios.get(`http://0.0.0.0:8000/screenshots/updated_screen.png?timestamp=${timestamp}`, {
|
const res = await axios.get(`http://127.0.0.1:8000/screenshots/updated_screen.png?timestamp=${timestamp}`, {
|
||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
});
|
});
|
||||||
console.log('Screenshot fetched successfully');
|
console.log('Screenshot fetched successfully');
|
||||||
@ -76,7 +76,7 @@ function App() {
|
|||||||
|
|
||||||
const fetchLatestAnswer = async () => {
|
const fetchLatestAnswer = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get('http://0.0.0.0:8000/latest_answer');
|
const res = await axios.get('http://127.0.0.1:8000/latest_answer');
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
|
|
||||||
updateData(data);
|
updateData(data);
|
||||||
@ -134,7 +134,7 @@ function App() {
|
|||||||
try {
|
try {
|
||||||
console.log('Sending query:', query);
|
console.log('Sending query:', query);
|
||||||
setQuery('waiting for response...');
|
setQuery('waiting for response...');
|
||||||
const res = await axios.post('http://0.0.0.0:8000/query', {
|
const res = await axios.post('http://127.0.0.1:8000/query', {
|
||||||
query,
|
query,
|
||||||
tts_enabled: false
|
tts_enabled: false
|
||||||
});
|
});
|
||||||
|
@ -616,19 +616,24 @@ class Browser:
|
|||||||
return self.screenshot_folder + "/updated_screen.png"
|
return self.screenshot_folder + "/updated_screen.png"
|
||||||
|
|
||||||
def screenshot(self, filename:str = 'updated_screen.png') -> bool:
|
def screenshot(self, filename:str = 'updated_screen.png') -> bool:
|
||||||
"""Take a screenshot of the current page."""
|
"""Take a screenshot of the current page, attempt to capture the full page by zooming out."""
|
||||||
self.logger.info("Taking screenshot...")
|
self.logger.info("Taking full page screenshot...")
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
try:
|
try:
|
||||||
|
original_zoom = self.driver.execute_script("return document.body.style.zoom || 1;")
|
||||||
|
self.driver.execute_script("document.body.style.zoom='75%'")
|
||||||
|
time.sleep(0.1) # Allow time for the zoom to take effect
|
||||||
path = os.path.join(self.screenshot_folder, filename)
|
path = os.path.join(self.screenshot_folder, filename)
|
||||||
if not os.path.exists(self.screenshot_folder):
|
if not os.path.exists(self.screenshot_folder):
|
||||||
os.makedirs(self.screenshot_folder)
|
os.makedirs(self.screenshot_folder)
|
||||||
self.driver.save_screenshot(path)
|
self.driver.save_screenshot(path)
|
||||||
self.logger.info(f"Screenshot saved as {filename}")
|
self.logger.info(f"Full page screenshot saved as {filename}")
|
||||||
return True
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"Error taking screenshot: {str(e)}")
|
self.logger.error(f"Error taking full page screenshot: {str(e)}")
|
||||||
return False
|
return False
|
||||||
|
finally:
|
||||||
|
self.driver.execute_script(f"document.body.style.zoom='1'")
|
||||||
|
return True
|
||||||
|
|
||||||
def apply_web_safety(self):
|
def apply_web_safety(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user