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: config file keys checking

[email protected]f90da39ca629
diff --git a/src/config.py b/src/config.py
index d804a8c..9e1d37b 100644
--- a/src/config.py
+++ b/src/config.py
@@ -16,9 +16,26 @@ class Config:
if not os.path.exists("config.toml"):
with open("sample.config.toml", "r") as f_in, open("config.toml", "w") as f_out:
f_out.write(f_in.read())
-
- self.config = toml.load("config.toml")
-
+ else:
+ # check if all the keys are present in the config file
+ with open("sample.config.toml", "r") as f:
+ sample_config = toml.load(f)
+
+ with open("config.toml", "r+") as f:
+ config = toml.load(f)
+
+ # Update the config with any missing keys and their keys of keys
+ for key, value in sample_config.items():
+ config.setdefault(key, value)
+ if isinstance(value, dict):
+ for sub_key, sub_value in value.items():
+ config[key].setdefault(sub_key, sub_value)
+
+ f.seek(0)
+ toml.dump(config, f)
+ f.truncate()
+
+ self.config = config
def get_config(self):
return self.config
diff --git a/src/init.py b/src/init.py
index 8a2207e..abb8b95 100644
--- a/src/init.py
+++ b/src/init.py
@@ -4,10 +4,13 @@ from src.logger import Logger
def init_devika():
- config = Config()
logger = Logger()
logger.info("Initializing Devika...")
+ logger.info("checking configurations...")
+
+ config = Config()
+
sqlite_db = config.get_sqlite_db()
screenshots_dir = config.get_screenshots_dir()
pdfs_dir = config.get_pdfs_dir()
diff --git a/src/llm/ollama_client.py b/src/llm/ollama_client.py
index 6498d7a..9560203 100644
--- a/src/llm/ollama_client.py
+++ b/src/llm/ollama_client.py
@@ -14,7 +14,7 @@ class Ollama:
except:
self.client = None
log.warning("Ollama not available")
- log.warning("run ollama server to use ollama models otherwise use other models")
+ log.warning("run ollama server to use ollama models otherwise use API models")
def inference(self, model_id: str, prompt: str) -> str:
response = self.client.generate(