Skip to content

Devika is the first open-source implementation of an Agentic Software Engineer. Initially started as an open-source alternative to Devin.

Python

Fix: none link and remove api from log (#452)

ayush rajgor37071fab0c43
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index f022d42..d9cf0a3 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -1,12 +1,3 @@
----
-name: Pull request
-about: Create a pull request to help us improve
-title: ''
-labels: ''
-assignees: ''
-
----
-
<!-- NOTE: A similar PR may already be submitted! Please search among the [Pull request] before creating one.
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
diff --git a/devika.py b/devika.py
index bf97df6..43c21f7 100644
--- a/devika.py
+++ b/devika.py
@@ -2,8 +2,6 @@
DO NOT REARRANGE THE ORDER OF THE FUNCTION CALLS AND VARIABLE DECLARATIONS
AS IT MAY CAUSE IMPORT ERRORS AND OTHER ISSUES
"""
-# import eventlet
-# eventlet.monkey_patch()
from gevent import monkey
monkey.patch_all()
from src.init import init_devika
diff --git a/src/agents/agent.py b/src/agents/agent.py
index 3ff554c..8b7954a 100644
--- a/src/agents/agent.py
+++ b/src/agents/agent.py
@@ -66,10 +66,10 @@ class Agent:
self.engine = search_engine
self.tokenizer = tiktoken.get_encoding("cl100k_base")
- async def open_page(self, project_name, pdf_download_url):
+ async def open_page(self, project_name, url):
browser = await Browser().start()
- await browser.go_to(pdf_download_url)
+ await browser.go_to(url)
_, raw = await browser.screenshot(project_name)
data = await browser.extract_text()
await browser.close()
@@ -79,9 +79,7 @@ class Agent:
def search_queries(self, queries: list, project_name: str) -> dict:
results = {}
-
knowledge_base = KnowledgeBase()
- web_search = None
if self.engine == "bing":
web_search = BingSearch()
@@ -107,7 +105,8 @@ class Agent:
link = web_search.get_first_link()
print("\nLink :: ", link, '\n')
-
+ if not link:
+ continue
browser, raw, data = loop.run_until_complete(self.open_page(project_name, link))
emit_agent("screenshot", {"data": raw, "project_name": project_name}, False)
results[query] = self.formatter.execute(data, project_name)
@@ -218,7 +217,7 @@ class Agent:
deploy_url = deploy_metadata["deploy_url"]
response = {
- "message": "Done! I deployed your project on Netflify.",
+ "message": "Done! I deployed your project on Netlify.",
"deploy_url": deploy_url
}
response = json.dumps(response, indent=4)
diff --git a/src/browser/search.py b/src/browser/search.py
index e624b09..3271851 100644
--- a/src/browser/search.py
+++ b/src/browser/search.py
@@ -66,7 +66,7 @@ class GoogleSearch:
# self.query_result = None
#
# def search(self, query):
-# from duckduckgo_search import DDGS
+ from duckduckgo_search import DDGS
# try:
# self.query_result = DDGS().text(query, max_results=5, region="us")
# print(self.query_result)
@@ -102,6 +102,8 @@ class DuckDuckGoSearch:
return resp.content
if resp.status_code == (202, 301, 403):
raise Exception(f"Error: {resp.status_code} rate limit error")
+ if not resp:
+ return None
except Exception as error:
if "timeout" in str(error).lower():
raise TimeoutError("Duckduckgo timed out error")
diff --git a/src/logger.py b/src/logger.py
index 944fc57..e485f7e 100644
--- a/src/logger.py
+++ b/src/logger.py
@@ -67,6 +67,8 @@ def route_logger(logger: Logger):
logger.debug(f"{request.path} {request.method} - Response: File response")
else:
response_summary = response.get_data(as_text=True)
+ if 'settings' in request.path:
+ response_summary = "*** Settings are not logged ***"
logger.debug(f"{request.path} {request.method} - Response: {response_summary}")
except Exception as e:
logger.exception(f"{request.path} {request.method} - {e})")