Skip to content

Commit

Permalink
Fix: setting page loading issue, messages from user (stitionai#359)
Browse files Browse the repository at this point in the history
* fix: HMR error

* fix: second message from not showing/ remove:console.log

resolved stitionai#359
  • Loading branch information
ARajgor authored Apr 4, 2024
1 parent 376050b commit edd99a7
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion devika.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def handle_message(data):
new_message = manager.new_message()
new_message['message'] = message
new_message['from_devika'] = False
manager.add_message_to_project(project_name, new_message)
manager.add_message_from_user(project_name, new_message['message'])

if AgentState.is_agent_completed(project_name):
thread = Thread(target=lambda: agent.subsequent_execute(message, project_name))
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/components/BrowserWidget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { API_BASE_URL, socket } from "$lib/api";
socket.on('screenshot', function(msg) {
console.log("screenshot: ", msg);
const data = msg['data'];
const img = document.querySelector('.browser-img');
img.src = `data:image/png;base64,${data}`;
Expand Down Expand Up @@ -32,6 +31,7 @@
<img
class="browser-img"
alt="Browser snapshot"
src={API_BASE_URL + "/api/get-browser-snapshot?snapshot_path=" + $agentState?.browser_session.screenshot}
/>
{:else}
<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>
Expand Down
4 changes: 0 additions & 4 deletions ui/src/lib/components/MessageInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
if ($agentState !== null) {
isAgentActive = $agentState.agent_is_active;
console.log("Agent is active", isAgentActive);
}
let messageInput = "";
Expand All @@ -26,7 +25,6 @@
if (messageInput.trim() !== "" && !isAgentActive) {
if ($messages.length === 0) {
console.log("Executing agent ... ", messageInput);
socket.emit("user-message", {
action: "execute_agent",
message: messageInput,
Expand All @@ -35,8 +33,6 @@
search_engine: serachEngine
});
} else {
console.log("Sending message", messageInput);
socket.emit("user-message", {
action: "continue",
message: messageInput,
Expand Down
3 changes: 0 additions & 3 deletions ui/src/lib/components/TerminalWidget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
agentState.subscribe((state) => {
if (state && state.terminal_session) {
console.log("Terminal state: ", state.terminal_session);
let command = state.terminal_session.command || 'echo "Waiting..."';
let output = state.terminal_session.output || "Waiting...";
let title = state.terminal_session.title || "Terminal";
Expand All @@ -47,7 +45,6 @@
output !== previousState.output ||
title !== previousState.title
) {
console.log("Command: ", command);
addCommandAndOutput(command, output, title);
// Update the previous state
Expand Down
3 changes: 0 additions & 3 deletions ui/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@
socket.on('server-message', function(data) {
console.log("server-message: ", data);
messages.update((msgs) => [...msgs, data['messages']]);
console.log("$message-store: ",$messages);
});
socket.on('agent-state', function(state) {
const lastState = state[state.length - 1];
agentState.set(lastState);
console.log("server-state: ", lastState);
console.log("$agent-state: ", $agentState);
});
socket.on('tokens', function(tokens) {
console.log("tokens: ", tokens);
tokenUsage.set(tokens["token_usage"]);
});
Expand Down
3 changes: 0 additions & 3 deletions ui/src/routes/settings/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
name={key}
class="p-2 border-2 w-1/2 rounded-lg {editMode ? '' : 'bg-gray-100 text-gray-500'}"
readonly={!editMode}
on:change={settings["API_KEYS"][key] = $event.target.value}
/>
</div>
{/each}
Expand All @@ -81,7 +80,6 @@
name={key}
class="p-2 w-1/2 border-2 rounded-lg {editMode ? '' : 'bg-gray-100 text-gray-500'}"
readonly={!editMode}
on:change={settings["API_ENDPOINTS"][key] = $event.target.value}
/>
</div>
{/each}
Expand All @@ -101,7 +99,6 @@
class="p-2 border-2 rounded-lg {editMode ? '' : 'bg-gray-100 text-gray-500'}"
readonly={!editMode}
placeholder="true/false"
on:change={settings["LOGGING"][key] = $event.target.value}
/>
</div>
{/each}
Expand Down

0 comments on commit edd99a7

Please sign in to comment.