Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

292 feat show the response is coming from the agent #295

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions vscode/media/onboarding/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ let data = [
},
"description": "Your primary agent for any usage or coding help.",
"metadata": {
"avatar_id": "https://cdn.commanddash.dev/assets/85fe1b9f-35a6-5732-9657-e880909c26e9/agents/avatars/08-06-2024/39a1406d-525f-44f9-b712-9d2a37cdc87b.jpeg",
"description": "Your primary agent for any usage or coding help.",
"display_name": "Dash",
"tags": [],
Expand Down Expand Up @@ -454,7 +453,7 @@ let data = [
"system_prompt": `You are a testing agent inside user's IDE. You can help them generate any kind of tests for their code in any programming language. They can attach multiple code pieces using Attach Snippet to Dash in the menu bar after selecting the code and provide you instruction on how they would like the tests to be generated.

Users can either chat with you or also activate specific commands /unit, /widget and /integration by typing / in the text field and then choosing one of them from the dropdown. Commands accepts predefined inputs and generates the test when submitted.`,
},
},
"supported_commands": [
{
"intent": "Generate unit test",
Expand Down Expand Up @@ -1661,18 +1660,43 @@ function displayMessages() {
} else {
questionnaireContainer.classList.add("hidden");
}
const _agentData = data.find((_data) => _data.name === currentActiveAgent);
_conversationHistory.forEach((_message) => {
const message = _message[currentActiveAgent];
const messageElement = document.createElement("div");
const roleElement = document.createElement("p");
const contentElement = document.createElement("p");
const buttonContainer = document.createElement("p");
const agent = document.createElement("span");

if (message.role === "model") {
modelCount++;

roleElement.innerHTML = `<div class="inline-flex flex-row items-center">${dashAI}<span class="font-bold text-md ml-1">CommandDash</span></div>`;
const agentImage = document.createElement("img");
agentImage.style.height = "27px";
agentImage.style.width = "27px";
agentImage.style.borderRadius = "7px";
agentImage.src = _agentData.metadata.avatar_id;
agentImage.style.objectFit = "container";
agentImage.onerror = function () {
agentImage.style.height = "27px";
agentImage.style.width = "32px";
agentImage.src = "https://raw.githubusercontent.com/CommandDash/commanddash/develop/assets/commanddash-logo.png";
};

const roleElementContainer = document.createElement("div");
roleElementContainer.classList.add("inline-flex", "flex-row", "items-center");
roleElementContainer.appendChild(agentImage);

const displayNameSpan = document.createElement("span");
displayNameSpan.classList.add("font-bold", "text-md", "ml-1");
displayNameSpan.textContent = _agentData.metadata.display_name;
roleElementContainer.appendChild(displayNameSpan);

roleElement.innerHTML = ''; // Clear any existing content
roleElement.appendChild(roleElementContainer);
roleElement.classList.add("block", "w-full", "px-2.5", "py-1.5", "bg-[#497BEF]/[.2]");

contentElement.classList.add("text-sm", "block", "px-2.5", "py-1.5", "pt-2", "break-words", "leading-relaxed", "bg-[#497BEF]/[.2]");
contentElement.innerHTML = markdownToPlain(message.parts);

Expand Down
Loading