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

update UI/ add gemini/ fix:ollama

ARajgore42d4730317c
diff --git a/.gitignore b/.gitignore
index 23d0c46..c43b17a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -157,11 +157,14 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
-#.idea/
+.idea/
notes.md
logs/
db/
screenshots/
pdfs/
-projects/
\ No newline at end of file
+projects/
+
+# bun files
+*.lockb
\ No newline at end of file
diff --git a/config.toml b/config.toml
index 8e45dbc..9968d4c 100644
--- a/config.toml
+++ b/config.toml
@@ -11,6 +11,8 @@ BING = "<YOUR_BING_API_KEY>"
CLAUDE = "<YOUR_CLAUDE_API_KEY>"
NETLIFY = "<YOUR_NETLIFY_API_KEY>"
OPENAI = "<YOUR_OPENAI_API_KEY>"
+GEMINI = "<YOUR_GEMINI_API_KEY>"
[API_ENDPOINTS]
BING = "https://api.bing.microsoft.com/v7.0/search"
+OLLAMA = "<YOUR_OLLAMA_ENDPOINT>"
diff --git a/devika.py b/devika.py
index 4a7b619..7f13474 100644
--- a/devika.py
+++ b/devika.py
@@ -17,8 +17,8 @@ from src.agents import Agent
from src.llm import LLM
app = Flask(__name__)
-log = logging.getLogger("werkzeug")
-log.disabled = True
+# log = logging.getLogger("werkzeug")
+# log.disabled = True
CORS(app)
Logger().logger.info("Booting up... This may take a few seconds")
@@ -27,6 +27,7 @@ TIKTOKEN_ENC = tiktoken.get_encoding("cl100k_base")
os.environ["TOKENIZERS_PARALLELISM"] = "false"
+
@app.route("/api/create-project", methods=["POST"])
def create_project():
data = request.json
@@ -92,12 +93,12 @@ def send_message():
message = data.get("message")
project_name = data.get("project_name")
base_model = data.get("base_model")
-
+
new_message = ProjectManager().new_message()
new_message["message"] = message
new_message["from_devika"] = False
ProjectManager().add_message_to_project(project_name, new_message)
-
+
if AgentState().is_agent_completed(project_name):
thread = Thread(
target=lambda: Agent(base_model=base_model).subsequent_execute(message, project_name)
@@ -205,4 +206,4 @@ def get_settings():
if __name__ == "__main__":
init_devika()
- app.run(debug=False, port=1337, host="0.0.0.0")
+ app.run(debug=True, host="0.0.0.0")
diff --git a/requirements.txt b/requirements.txt
index 53496f4..5b030e1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,6 +15,7 @@ tiktoken
ollama
openai
anthropic
+google-generativeai
sqlmodel
keybert
GitPython
diff --git a/src/config.py b/src/config.py
index 4f0d06b..a2564cc 100644
--- a/src/config.py
+++ b/src/config.py
@@ -1,5 +1,6 @@
import toml
+
class Config:
def __init__(self):
self.config = toml.load("config.toml")
@@ -9,37 +10,43 @@ class Config:
def get_bing_api_key(self):
return self.config["API_KEYS"]["BING"]
-
+
def get_bing_api_endpoint(self):
return self.config["API_ENDPOINTS"]["BING"]
-
+
+ def get_ollama_endpoint(self):
+ return self.config["API_ENDPOINTS"]["OLLAMA"]
+
def get_claude_api_key(self):
return self.config["API_KEYS"]["CLAUDE"]
-
+
def get_openai_api_key(self):
return self.config["API_KEYS"]["OPENAI"]
-
+
+ def get_gemini_api_key(self):
+ return self.config["API_KEYS"]["GEMINI"]
+
def get_netlify_api_key(self):
return self.config["API_KEYS"]["NETLIFY"]
-
+
def get_sqlite_db(self):
return self.config["STORAGE"]["SQLITE_DB"]
-
+
def get_screenshots_dir(self):
return self.config["STORAGE"]["SCREENSHOTS_DIR"]
-
+
def get_pdfs_dir(self):
return self.config["STORAGE"]["PDFS_DIR"]
-
+
def get_projects_dir(self):
return self.config["STORAGE"]["PROJECTS_DIR"]
-
+
def get_logs_dir(self):
return self.config["STORAGE"]["LOGS_DIR"]
-
+
def get_repos_dir(self):
return self.config["STORAGE"]["REPOS_DIR"]
-
+
def set_bing_api_key(self, key):
self.config["API_KEYS"]["BING"] = key
self.save_config()
@@ -47,7 +54,7 @@ class Config:
def set_bing_api_endpoint(self, endpoint):
self.config["API_ENDPOINTS"]["BING"] = endpoint
self.save_config()
-
+
def set_claude_api_key(self, key):
self.config["API_KEYS"]["CLAUDE"] = key
self.save_config()
@@ -59,11 +66,11 @@ class Config:
def set_netlify_api_key(self, key):
self.config["API_KEYS"]["NETLIFY"] = key
self.save_config()
-
+
def set_sqlite_db(self, db):
self.config["STORAGE"]["SQLITE_DB"] = db
self.save_config()
-
+
def set_screenshots_dir(self, dir):
self.config["STORAGE"]["SCREENSHOTS_DIR"] = dir
self.save_config()
@@ -71,7 +78,7 @@ class Config:
def set_pdfs_dir(self, dir):
self.config["STORAGE"]["PDFS_DIR"] = dir
self.save_config()
-
+
def set_projects_dir(self, dir):
self.config["STORAGE"]["PROJECTS_DIR"] = dir
self.save_config()
diff --git a/src/llm/gemini_client.py b/src/llm/gemini_client.py
new file mode 100644
index 0000000..472dd0d
--- /dev/null
+++ b/src/llm/gemini_client.py
@@ -0,0 +1,15 @@
+import google.generativeai as genai
+
+from src.config import Config
+
+
+class Gemini:
+ def __init__(self):
+ config = Config()
+ api_key = config.get_gemini_api_key()
+ genai.configure(api_key=api_key)
+
+ def inference(self, model_id: str, prompt: str) -> str:
+ model = genai.GenerativeModel(model_id)
+ response = model.generate_content(prompt)
+ return response.text
diff --git a/src/llm/llm.py b/src/llm/llm.py
index c16f23e..a2f54a9 100644
--- a/src/llm/llm.py
+++ b/src/llm/llm.py
@@ -1,66 +1,75 @@
from enum import Enum
-
-from .ollama_client import Ollama
-from .claude_client import Claude
-from .openai_client import OpenAI
-
from src.state import AgentState
-
import tiktoken
+from .ollama_client import Ollama
+from .claude_client import Claude
+from .openai_client import Openai
+from .gemini_client import Gemini
TOKEN_USAGE = 0
TIKTOKEN_ENC = tiktoken.get_encoding("cl100k_base")
+ollama = Ollama()
+
+
class Model(Enum):
CLAUDE_3_OPUS = ("Claude 3 Opus", "claude-3-opus-20240229")
CLAUDE_3_SONNET = ("Claude 3 Sonnet", "claude-3-sonnet-20240229")
CLAUDE_3_HAIKU = ("Claude 3 Haiku", "claude-3-haiku-20240307")
GPT_4_TURBO = ("GPT-4 Turbo", "gpt-4-0125-preview")
GPT_3_5 = ("GPT-3.5", "gpt-3.5-turbo-0125")
- OLLAMA_MODELS = [
- (
- model["name"],
- f"{model['details']['parameter_size']} - {model['details']['quantization_level']}",
- )
- for model in Ollama.list_models()
- ]
+ GEMINI_1_5_PRO = ("Gemini 1.5 Pro", "gemini-pro")
+
+ @staticmethod
+ def ollama_models():
+ try:
+ return [
+ (
+ model["name"],
+ f"{model['details']['parameter_size']} - {model['details']['quantization_level']}",
+ )
+ for model in ollama.list_models()
+ ]
+ except:
+ return []
+
class LLM:
def __init__(self, model_id: str = None):
self.model_id = model_id
-
+
def list_models(self) -> list[tuple[str, str]]:
- return [model.value for model in Model if model.name != "OLLAMA_MODELS"] + list(
- Model.OLLAMA_MODELS.value
- )
+ return [model.value for model in Model] + Model.ollama_models()
def model_id_to_enum_mapping(self):
- models = {model.value[1]: model for model in Model if model.name != "OLLAMA_MODELS"}
- ollama_models = {model[0]: "OLLAMA_MODELS" for model in Model.OLLAMA_MODELS.value}
- models.update(ollama_models)
+ models = {model.value[1]: model for model in Model}
+ models.update({model[0]: "OLLAMA_MODELS" for model in Model.ollama_models()})
return models
- def update_global_token_usage(self, string: str):
+ @staticmethod
+ def update_global_token_usage(string: str):
global TOKEN_USAGE
TOKEN_USAGE += len(TIKTOKEN_ENC.encode(string))
print(f"Token usage: {TOKEN_USAGE}")
- def inference(
- self, prompt: str
- ) -> str:
+ def inference(self, prompt: str) -> str:
self.update_global_token_usage(prompt)
-
- model = self.model_id_to_enum_mapping()[self.model_id]
- if model == "OLLAMA_MODELS":
- response = Ollama().inference(self.model_id, prompt).strip()
- elif "CLAUDE" in str(model):
+ model_enum = self.model_id_to_enum_mapping().get(self.model_id)
+ if model_enum is None:
+ raise ValueError(f"Model {self.model_id} not supported")
+
+ if model_enum == "OLLAMA_MODELS":
+ response = ollama.inference(self.model_id, prompt).strip()
+ elif "CLAUDE" in model_enum.name:
response = Claude().inference(self.model_id, prompt).strip()
- elif "GPT" in str(model):
- response = OpenAI().inference(self.model_id, prompt).strip()
+ elif "GPT" in model_enum.name:
+ response = Openai().inference(self.model_id, prompt).strip()
+ elif "GEMINI" in model_enum.name:
+ response = Gemini().inference(self.model_id, prompt).strip()
else:
- raise ValueError(f"Model {model} not supported")
+ raise ValueError(f"Model {model_enum} not supported")
self.update_global_token_usage(response)
-
+
return response
diff --git a/src/llm/ollama_client.py b/src/llm/ollama_client.py
index 1e17cc3..f1115d9 100644
--- a/src/llm/ollama_client.py
+++ b/src/llm/ollama_client.py
@@ -1,14 +1,19 @@
import ollama
+from src.config import Config
+
class Ollama:
- @staticmethod
- def list_models():
- return ollama.list()["models"]
+ def __init__(self):
+ config = Config()
+ self.client = ollama.Client(config.get_ollama_endpoint())
+
+ def list_models(self) -> list[dict]:
+ models = self.client.list()["models"]
+ return models
def inference(self, model_id: str, prompt: str) -> str:
- response = ollama.generate(
- model = model_id,
- prompt = prompt.strip()
+ response = self.client.generate(
+ model=model_id,
+ prompt=prompt.strip()
)
-
- return response['response']
\ No newline at end of file
+ return response['response']
diff --git a/src/llm/openai_client.py b/src/llm/openai_client.py
index b64d7df..77b9cc4 100644
--- a/src/llm/openai_client.py
+++ b/src/llm/openai_client.py
@@ -2,15 +2,15 @@ from openai import OpenAI
from src.config import Config
-class OpenAI:
- def __init__(self, api_key: str):
+
+class Openai:
+ def __init__(self):
config = Config()
api_key = config.get_openai_api_key()
- self.client = OpenAI(
- api_key=api_key,
- )
-
+ self.client = OpenAI(api_key=api_key)
+
def inference(self, model_id: str, prompt: str) -> str:
+ print("openai")
chat_completion = self.client.chat.completions.create(
messages=[
{
@@ -20,5 +20,5 @@ class OpenAI:
],
model=model_id,
)
-
+ print("openai")
return chat_completion.choices[0].message.content
diff --git a/ui/.gitignore b/ui/.gitignore
index c2658d7..1822831 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -1 +1,2 @@
node_modules/
+bun.lockb
diff --git a/ui/bun.lockb b/ui/bun.lockb
index 0f55da9..a818b29 100755
Binary files a/ui/bun.lockb and b/ui/bun.lockb differ
diff --git a/ui/index.html b/ui/index.html
index ba08615..a339da7 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -6,7 +6,14 @@
<title>Devika AI</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
</head>
- <body class="bg-slate-950 text-white font-sans">
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ font-family: 'Inter', sans-serif;
+ }
+ </style>
+ <body class="bg-gray-50 h-dvh">
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
diff --git a/ui/package.json b/ui/package.json
index bea3278..bc1ec63 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -31,7 +31,7 @@
"svelte": "^4.2.12",
"svelte-loader": "^3.2.0",
"tailwindcss": "latest",
- "vite": "^5.1.6",
+ "vite": "^5.2.2",
"xterm": "^5.2.0",
"xterm-addon-fit": "^0.8.0"
}
diff --git a/ui/src/App.svelte b/ui/src/App.svelte
index fbac006..493c20b 100644
--- a/ui/src/App.svelte
+++ b/ui/src/App.svelte
@@ -16,7 +16,7 @@
} from "./api";
onMount(() => {
- localStorage.clear();
+ // localStorage.clear();
const intervalId = setInterval(async () => {
await fetchProjectList();
@@ -24,7 +24,7 @@
await fetchAgentState();
await fetchMessages();
await checkInternetStatus();
- }, 1000);
+ }, 5000);
return () => clearInterval(intervalId);
});
@@ -33,17 +33,17 @@
<div class="flex h-screen">
<Sidebar />
- <div class="flex flex-col flex-1 p-4">
+ <div class="flex h-full flex-col flex-1 p-4">
<ControlPanel />
- <div class="flex h-full space-x-4">
- <div class="flex flex-col w-1/2">
+ <div class="flex space-x-4 h-full overflow-y-auto">
+ <div class="flex flex-col gap-4 w-1/2">
<MessageContainer />
<InternalMonologue />
<MessageInput />
</div>
- <div class="flex flex-col w-1/2 space-y-4">
+ <div class="flex flex-col gap-4 w-1/2">
<BrowserWidget />
<TerminalWidget />
</div>
diff --git a/ui/src/api.js b/ui/src/api.js
index 1d09e9f..ca391ac 100644
--- a/ui/src/api.js
+++ b/ui/src/api.js
@@ -6,7 +6,7 @@ import {
internet,
} from "./store";
-export const API_BASE_URL = "http://127.0.0.1:1337";
+export const API_BASE_URL = "http://127.0.0.1:5000";
export async function fetchProjectList() {
const response = await fetch(`${API_BASE_URL}/api/project-list`);
diff --git a/ui/src/components/BrowserWidget.svelte b/ui/src/components/BrowserWidget.svelte
index c2794dd..7003141 100644
--- a/ui/src/components/BrowserWidget.svelte
+++ b/ui/src/components/BrowserWidget.svelte
@@ -3,8 +3,8 @@
import { API_BASE_URL } from "../api";
</script>
-<div class="flex flex-col bg-slate-950 border border-indigo-700 rounded flex-1 overflow-hidden">
- <div class="p-2 flex items-center border-b border-gray-700">
+<div class="flex flex-col border-2 rounded-lg flex-1">
+ <div class="p-2 flex items-center border-b">
<div class="flex space-x-2 ml-2 mr-4">
<div class="w-3 h-3 bg-red-500 rounded-full"></div>
<div class="w-3 h-3 bg-yellow-400 rounded-full"></div>
@@ -13,7 +13,7 @@
<input
type="text"
id="browser-url"
- class="flex-grow bg-slate-900 p-2 rounded"
+ class="flex-grow border-2 rounded-lg p-2"
placeholder="chrome://newtab"
value={$agentState?.browser_session.url || ""}
readonly
@@ -27,7 +27,7 @@
alt="Browser snapshot"
/>
{:else}
- <div class="text-white text-center mt-5"><strong>💡 TIP:</strong> You can include a Git URL in your prompt to clone a repo!</div>
+ <div class="text-gray-400 text-center mt-5"><strong>💡 TIP:</strong> You can include a Git URL in your prompt to clone a repo!</div>
{/if}
</div>
</div>
@@ -40,6 +40,5 @@
.browser-img {
display: block;
object-fit: contain;
- max-width: 100%;
}
</style>
\ No newline at end of file
diff --git a/ui/src/components/ControlPanel.svelte b/ui/src/components/ControlPanel.svelte
index 66cbda6..dcc19d1 100644
--- a/ui/src/components/ControlPanel.svelte
+++ b/ui/src/components/ControlPanel.svelte
@@ -1,10 +1,24 @@
<script>
- import { onMount } from 'svelte';
+ import { onMount } from "svelte";
import { projectList, modelList, internet } from "../store";
import { createProject, fetchProjectList, getTokenUsage } from "../api";
- let selectedProject = localStorage.getItem("selectedProject") || "Select Project";
- let selectedModel = localStorage.getItem("selectedModel") || "Select Model";
+ let selectedProject;
+ let selectedModel;
+
+ if (projectList !== null) {
+ selectedProject = "Select Project";
+ localStorage.setItem("selectedProject", "");
+ } else {
+ selectedProject = localStorage.getItem("selectedProject") || projectList[0];
+ }
+ if(modelList !== null) {
+ selectedModel = localStorage.getItem("selectedModel") || modelList[0][1];
+ } else {
+ selectedModel = "Select Model";
+ localStorage.setItem("selectedModel", "");
+ }
+
let tokenUsage = 0;
async function updateTokenUsage() {
@@ -14,11 +28,13 @@
function selectProject(project) {
selectedProject = project;
localStorage.setItem("selectedProject", project);
+ document.getElementById("project-dropdown").classList.add("hidden");
}
function selectModel(model) {
selectedModel = `${model[0]} (${model[1]})`;
localStorage.setItem("selectedModel", model[1]);
+ document.getElementById("model-dropdown").classList.add("hidden");
}
async function createNewProject() {
@@ -51,8 +67,8 @@
}
}
- onMount(() => {
- setInterval(updateTokenUsage, 1000);
+ onMount(async () => {
+ await updateTokenUsage();
document
.getElementById("project-button")
@@ -76,50 +92,40 @@
});
</script>
-<div class="control-panel bg-slate-900 border border-indigo-700 rounded">
+<div class="control-panel">
<div class="dropdown-menu relative inline-block">
<button
type="button"
- class="inline-flex justify-center w-full gap-x-1.5 rounded-md bg-slate-900 px-3 py-2 text-sm font-semibold text-white shadow-sm ring-1 ring-inset ring-indigo-700 hover:bg-slate-800"
+ class="inline-flex items-center justify-center w-full gap-2 rounded-md px-3 py-2 text-sm font-semibold border-2 border-gray-200 "
id="project-button"
aria-expanded="true"
aria-haspopup="true"
>
<span id="selected-project">{selectedProject}</span>
- <svg
- class="-mr-1 h-5 w-5 text-gray-400"
- viewBox="0 0 20 20"
- fill="currentColor"
- aria-hidden="true"
- >
- <path
- fill-rule="evenodd"
- d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"
- clip-rule="evenodd"
- />
- </svg>
+ <i class="fas fa-angle-down"></i>
</button>
<div
id="project-dropdown"
- class="absolute left-0 z-10 mt-2 w-full origin-top-left rounded-md bg-slate-800 shadow-lg ring-1 ring-indigo-700 ring-opacity-5 focus:outline-none hidden"
+ class="absolute left-0 z-10 mt-2 w-40 origin-top-left rounded-md bg-gray-100 shadow-lg max-h-96 overflow-y-auto hidden"
role="menu"
aria-orientation="vertical"
aria-labelledby="project-button"
tabindex="-1"
>
- <div class="py-1" role="none">
+ <div role="none" class="flex flex-col divide-y-2 w-full">
<a
href="#"
- class="text-white block px-4 py-2 text-sm hover:bg-slate-700"
+ class="flex gap-2 items-center text-sm px-4 py-3 w-full"
on:click|preventDefault={createNewProject}
>
- + Create new project
+ <i class="fas fa-plus"></i>
+ new project
</a>
{#if $projectList !== null}
{#each $projectList as project}
<a
href="#"
- class="text-white block px-4 py-2 text-sm hover:bg-slate-700"
+ class="flex gap-2 items-center text-sm px-4 py-3 w-full text-clip {selectedProject === project ? 'bg-gray-300' : ''}"
on:click|preventDefault={() => selectProject(project)}
>
{project}
@@ -136,7 +142,12 @@
>
<div class="flex items-center space-x-2">
<span>Internet:</span>
- <div id="internet-status" class="internet-status" class:online={$internet} class:offline={!$internet}></div>
+ <div
+ id="internet-status"
+ class="internet-status"
+ class:online={$internet}
+ class:offline={!$internet}
+ ></div>
<span id="internet-status-text"></span>
</div>
<div class="flex items-center space-x-2">
@@ -147,41 +158,34 @@
<div>
<button
type="button"
- class="inline-flex w-full justify-center gap-x-1.5 rounded-md bg-slate-900 px-3 py-2 text-sm font-semibold text-white shadow-sm ring-1 ring-inset ring-indigo-700 hover:bg-slate-800"
+ class="inline-flex items-center justify-center w-fit gap-x-1.5 rounded-md px-3 py-2 text-sm font-semibold ring-2 ring-inset ring-black"
id="model-button"
aria-expanded="true"
aria-haspopup="true"
>
<span id="selected-model">{selectedModel}</span>
- <svg
- class="-mr-1 h-5 w-5 text-gray-400"
- viewBox="0 0 20 20"
- fill="currentColor"
- aria-hidden="true"
- >
- <path
- fill-rule="evenodd"
- d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"
- clip-rule="evenodd"
- />
- </svg>
+ <i class="fas fa-angle-down"></i>
+
</button>
</div>
<div
id="model-dropdown"
- class="absolute right-0 z-10 mt-2 w-full origin-top-right rounded-md bg-slate-800 shadow-lg ring-1 ring-indigo-700 ring-opacity-5 focus:outline-none hidden"
+ class="absolute right-0 z-10 mt-2 w-64 origin-top-right rounded-md bg-gray-100 shadow-lg max-h-96 overflow-y-auto hidden"
role="menu"
aria-orientation="vertical"
aria-labelledby="model-button"
tabindex="-1"
>
- <div class="py-1" role="none">
+ <div class="flex flex-col divide-y-2 w-full" role="none">
{#if $modelList !== null}
{#each $modelList as model}
<a
href="#"
- class="text-white block px-4 py-2 text-sm hover:bg-slate-700"
+ class="flex gap-2 items-center text-sm px-4 py-3 w-full text-clip
+ {(selectedModel == `${model[0]} (${model[1]})`) || (
+ selectedModel == model[1]
+ ) ? 'bg-gray-300' : ''}"
on:click|preventDefault={() => selectModel(model)}
>
{model[0]} ({model[1]})
@@ -208,7 +212,12 @@
.offline {
background-color: #ef4444;
}
-
+ /* no visible scrollbar */
+ #model-dropdown {
+ -ms-overflow-style: none; /* IE and Edge */
+ scrollbar-width: none; /* Firefox */
+ scroll-behavior: smooth;
+ }
@keyframes roll {
0% {
transform: translateY(-5%);
@@ -239,4 +248,4 @@
border-right: 1px solid #4b5563;
padding-right: 20px;
}
-</style>
\ No newline at end of file
+</style>
diff --git a/ui/src/components/InternalMonologue.svelte b/ui/src/components/InternalMonologue.svelte
index f5fdbc3..e4bbd9b 100644
--- a/ui/src/components/InternalMonologue.svelte
+++ b/ui/src/components/InternalMonologue.svelte
@@ -3,16 +3,16 @@
</script>
<div
- class="internal-monologue bg-slate-950 border border-indigo-700 p-2 rounded mt-4 flex items-start space-x-3"
+ class="internal-monologue border-2 flex items-center justify-center gap-2 px-2 py-4 rounded-lg"
>
<img
src="/assets/devika-avatar.png"
alt="Devika's Avatar"
class="avatar rounded-full flex-shrink-0"
/>
- <div>
+ <div class="flex flex-col w-full gap-1">
<p class="text-xs text-gray-400">Devika's Internal Monologue</p>
- <p class="text-sm">{$agentState?.internal_monologue || "😴"}</p>
+ <p class="text-xs">{$agentState?.internal_monologue || "😴"}</p>
</div>
</div>
diff --git a/ui/src/components/MessageContainer.svelte b/ui/src/components/MessageContainer.svelte
index 64da8ae..4bc3e89 100644
--- a/ui/src/components/MessageContainer.svelte
+++ b/ui/src/components/MessageContainer.svelte
@@ -13,10 +13,14 @@
});
</script>
-<div id="message-container" class="flex-grow overflow-y-auto pr-2" bind:this={messageContainer}>
+<div
+ id="message-container"
+ class="flex flex-col flex-1 gap-2 overflow-y-auto border-2 rounded-lg p-4"
+ bind:this={messageContainer}
+>
{#if $messages !== null}
{#each $messages as message}
- <div class="flex items-start space-x-3 mt-4">
+ <div class="flex items-center justify-center gap-2 px-2 py-4 border-b-2">
{#if message.from_devika}
<img
src="/assets/devika-avatar.png"
@@ -32,39 +36,37 @@
style="width: 40px; height: 40px;"
/>
{/if}
-
- <div class="flex flex-col w-full">
- <p class="text-xs text-gray-400 sender-name">
+ <div class="flex flex-col w-full gap-1">
+ <p class="text-xs text-gray-400">
{message.from_devika ? "Devika" : "You"}
<span class="timestamp"
>{new Date(message.timestamp).toLocaleTimeString()}</span
>
</p>
- {#if message.from_devika && message.message.startsWith('{')}
- <div
- class="bg-slate-800 p-2 rounded w-full mr-4"
- contenteditable="false"
- >
- {@html `<strong>Here's my step-by-step plan:</strong>`}
- <br><br>
- {#if JSON.parse(message.message)}
- {#each Object.entries(JSON.parse(message.message)) as [step, description]}
- <input type="checkbox" id="step-{step}" disabled />
- <label for="step-{step}"><strong>Step {step}</strong>: {description}</label>
- <br><br>
- {/each}
- {/if}
+ {#if message.from_devika && message.message.startsWith("{")}
+ <div class="w-full" contenteditable="false">
+ {@html `<strong>Here's my step-by-step plan:</strong>`}
+ <br /><br />
+ {#if JSON.parse(message.message)}
+ {#each Object.entries(JSON.parse(message.message)) as [step, description]}
+ <input type="checkbox" id="step-{step}" disabled />
+ <label for="step-{step}"
+ ><strong>Step {step}</strong>: {description}</label
+ >
+ <br /><br />
+ {/each}
+ {/if}
</div>
{:else if /https?:\/\/[^\s]+/.test(message.message)}
- <div
- class="bg-slate-800 p-2 rounded w-full mr-4"
- contenteditable="false"
- >
- {@html message.message.replace(/(https?:\/\/[^\s]+)/g, '<u><a href="$1" target="_blank" style="font-weight: bold;">$1</a></u>')}
+ <div class="w-full" contenteditable="false">
+ {@html message.message.replace(
+ /(https?:\/\/[^\s]+)/g,
+ '<u><a href="$1" target="_blank" style="font-weight: bold;">$1</a></u>'
+ )}
</div>
{:else}
<div
- class="bg-slate-800 p-2 rounded w-full mr-4"
+ class="w-full"
contenteditable="false"
bind:innerHTML={message.message}
></div>
@@ -89,22 +91,15 @@
}
#message-container {
- height: 390px;
overflow-y: auto;
}
-
+ /* scrollbar hidden for all browsers*/
#message-container::-webkit-scrollbar {
- width: 4px;
- }
-
- #message-container::-webkit-scrollbar-track {
- background: #020617;
- border-radius: 10px;
+ display: none;
}
-
- #message-container::-webkit-scrollbar-thumb {
- background: #4337c9;
- border-radius: 10px;
+ #message-container {
+ -ms-overflow-style: none;
+ scrollbar-width: none;
}
input[type="checkbox"] {
@@ -122,4 +117,4 @@
position: relative;
top: 3px;
}
-</style>
\ No newline at end of file
+</style>
diff --git a/ui/src/components/MessageInput.svelte b/ui/src/components/MessageInput.svelte
index 762e8c1..155bb4e 100644
--- a/ui/src/components/MessageInput.svelte
+++ b/ui/src/components/MessageInput.svelte
@@ -50,10 +50,10 @@
}
</script>
-<div class="expandable-input mt-4 relative">
+<div class="expandable-input relative">
<textarea
id="message-input"
- class="w-full p-2 bg-slate-800 rounded pr-20"
+ class="w-full p-2 border-2 rounded-lg pr-20"
placeholder="Type your message..."
bind:value={messageInput}
on:input={calculateTokens}
@@ -64,12 +64,12 @@
}
}}
></textarea>
- <div class="token-count absolute right-2 bottom-2 text-gray-400 text-xs">
+ <div class="token-count text-gray-400 text-xs p-2">
0 tokens
</div>
<button
id="send-message-btn"
- class={`px-4 py-2 rounded w-full mt-2 ${isAgentActive ? "bg-slate-800" : "bg-indigo-700"}`}
+ class={`px-4 py-3 border-2 text-white rounded-lg w-full ${isAgentActive ? "bg-slate-800" : "bg-black"}`}
on:click={handleSendMessage}
disabled={isAgentActive}
>
diff --git a/ui/src/components/Sidebar.svelte b/ui/src/components/Sidebar.svelte
index 9f51397..1f49a38 100644
--- a/ui/src/components/Sidebar.svelte
+++ b/ui/src/components/Sidebar.svelte
@@ -1,20 +1,20 @@
<div
- class="flex flex-col w-20 bg-slate-950 p-4 space-y-4 items-center shadow-2xl shadow-indigo-700"
+ class="flex flex-col p-4 gap-4 items-center bg-gray-100"
>
<div class="p-5 rounded nav-button relative">
- <button class="text-gray-400 hover:text-white flex justify-center w-full">
+ <button class="hover:text-white flex justify-center w-full">
<i class="fas fa-home fa-lg"></i>
</button>
<span class="tooltip">Home</span>
</div>
<div class="p-5 rounded nav-button relative">
- <button class="text-gray-400 hover:text-white flex justify-center w-full">
+ <button class="hover:text-white flex justify-center w-full">
<i class="fas fa-cog fa-lg"></i>
</button>
<span class="tooltip">Settings</span>
</div>
<div class="p-5 rounded nav-button relative">
- <button class="text-gray-400 hover:text-white flex justify-center w-full">
+ <button class="hover:text-white flex justify-center w-full">
<i class="fas fa-history fa-lg"></i>
</button>
<span class="tooltip">Logs</span>
diff --git a/ui/src/components/TerminalWidget.svelte b/ui/src/components/TerminalWidget.svelte
index a9d8b72..d759fdc 100644
--- a/ui/src/components/TerminalWidget.svelte
+++ b/ui/src/components/TerminalWidget.svelte
@@ -15,6 +15,12 @@
cursorBlink: true,
convertEol: true,
rows: 1,
+ theme: {
+ background: "#fdf6e3",
+ foreground: "#000000",
+ innerText: "#000000",
+ cursor: "#000000",
+ },
});
fitAddon = new FitAddon();
terminal.loadAddon(fitAddon);
@@ -54,8 +60,8 @@
}
</script>
-<div class="flex flex-col bg-slate-950 border border-indigo-700 rounded flex-1 overflow-hidden">
- <div class="p-2 flex items-center border-b border-gray-700">
+<div class="flex flex-col border-2 rounded-lg flex-1">
+ <div class="p-2 flex items-center border-b">
<div class="flex space-x-2 ml-2 mr-4">
<div class="w-3 h-3 bg-red-500 rounded-full"></div>
<div class="w-3 h-3 bg-yellow-400 rounded-full"></div>
@@ -65,26 +71,23 @@
</div>
<div
id="terminal-content"
- class="bg-black flex-grow flex overflow-hidden"
+ class="flex-grow flex overflow-hidden"
bind:this={terminalElement}
- style="height: 100%; margin-left: 5px;"
></div>
</div>
<style>
- #terminal-content {
- height: 100%;
- }
- #terminal-content :global(.xterm) {
+
+ /* #terminal-content :global(.xterm) {
padding: 10px;
height: 100%; /* Ensure terminal content height is fixed */
- }
+ /* }
#terminal-content :global(.xterm-viewport) {
overflow-y: auto !important;
height: 100%;
- }
+ } */
#terminal-content::-webkit-scrollbar, #terminal-content :global(.xterm-viewport)::-webkit-scrollbar {
width: 4px;