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

Display name on sent message tile. #286

Merged
merged 3 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
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
Binary file added assets/docs/agent-usage.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/docs/command.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/docs/multi-code-attachment.gif
Binary file not shown.
Binary file removed assets/docs/refactor-command.png
Binary file not shown.
5 changes: 3 additions & 2 deletions vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Explore 100s of agents available in the marketplace - from LLMs, Payment Gateway
**You can activate an agent and chat with it:**

<p align="center">
<img src="/assets/docs/multi-code-attachment.gif" alt="Multi code chat with VSCode inside Gemini" width="500"/>
<img src="/assets/docs/agent-usage.gif" alt="Multi code chat with VSCode inside Gemini" width="500"/>
</p>

Also, you can select and attach multiple code snippets from different files in your inline chat using **"Attach Snippet to Dash"** from the right-click menu.
Expand All @@ -44,8 +44,9 @@ Also, you can select and attach multiple code snippets from different files in y

**Run commands meant to perform specific tasks:**

For example, `@Test` agent has a command to help you genereate unit tests:
<p align="center">
<img src="/assets/docs/refactor-command.png" alt="Refactoring code with CommandDash" width="500"/>
<img src="/assets/docs/command.png" alt="Refactoring code with CommandDash" width="500" style="padding-left: 20px; padding-right: 20px;"/>
</p>

Note: Commands are optionally offered by agents depending on the usecase.
Expand Down
72 changes: 37 additions & 35 deletions vscode/media/onboarding/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,16 @@ const SetupStep = {

let data = [
{
"chat_mode": {
"data_sources": [
"501123716"
],
"system_prompt": " CommandDash is a marketplace of programming agents in developer's IDE that are expert at integrating any API or SDK.\n \n You are the @dash agent in CommandDash (which works from the users IDE). User can chat with you to get coding help and also use your /workspace, /refactor, and /document commands.\n\n They can also attach multiple code snippets by using the option \"Attach Snippet to Dash\" from the menu bar.\n\n You are the agent activated by default but user can also install other Dash Agents from the CommandDash marketplace by tapping the @ button on the top right which will open a listing of all the agents available with their details depending on which library they want to work with.\n\n Example Dash Agents are Gemini, Firebase, Langchain, Stripe etc that can help you quickly build features using their packages. If user is looking for help with any library, suggest them looking out if an agent for that exists in the marketplace.\n\n To switch to these agents after installing, type @ in the text field and choose your agent in the dropdown, then start asking your questions.\n \n You can also create your own Dash Agents and add them to the marketplace. More details here: https://www.commanddash.io/docs/introduction\n \n The users will interacting with you from their IDE and have the setup already done. Help them with any of their queries. All the best.",
"version": "0.0.1"
},
"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/07-06-2024/76f575c4-c6f9-40c2-8292-8f9a2cba0b0b.jpeg",
"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 All @@ -283,31 +290,26 @@ let data = [
"min_cli_version": "0.0.1",
"name": "@dash",
"publisher_id": "85fe1b9f-35a6-5732-9657-e880909c26e9",
"chat_mode": {
"data_sources": [],
"system_prompt": " CommandDash is a marketplace of programming agents in developer's IDE that are expert at integrating any API or SDK.\n \n You are the @dash agent in CommandDash (which works from the users IDE). User can chat with you to get coding help and also use your /workspace, /refactor, and /document commands.\n\n They can also attach multiple code snippets by using the option \"Attach Snippet to Dash\" from the menu bar.\n\n You are the agent activated by default but user can also install other Dash Agents from the CommandDash marketplace by tapping the @ button on the top right which will open a listing of all the agents available with their details depending on which library they want to work with.\n\n Example Dash Agents are Gemini, Firebase, Langchain, Stripe etc that can help you quickly build features using their packages.\n\n To switch to these agents after installing, type @ in the text field and choose your agent in the dropdown, then start asking your questions.\n \n You can also create your own Dash Agents and add them to the marketplace. More details here: https://www.commanddash.io/docs/introduction\n \n The users will interacting with you from their IDE and have the setup already done. Help them with any of their queries. All the best.",
"version": "0.0.1"
},
"supported_commands": [
{
"intent": "Ask questions on your codebase",
"registered_inputs": [
{
"display_text": "Query",
"id": "903396436",
"id": "368689265",
"optional": false,
"type": "string_input",
"version": "0.0.1"
}
],
"registered_outputs": [
{
"id": "206381269",
"id": "729757158",
"type": "multi_code_output",
"version": "0.0.1"
},
{
"id": "741501672",
"id": "791477237",
"type": "prompt_output",
"version": "0.0.1"
}
Expand All @@ -316,42 +318,42 @@ let data = [
"steps": [
{
"outputs": [
"206381269"
"729757158"
],
"query": "<903396436>",
"query": "<368689265>",
"type": "search_in_workspace",
"version": "0.0.1",
"workspace_object_type": "all"
},
{
"outputs": [
"741501672"
"791477237"
],
"prompt": "Here are the related references from user's project:\n ```\n <206381269>\n ```\n \n Answer the user's query <Query> based on the reference shared above.\n Query: <903396436>.\n \n If you cannot find the answer in the attaches references, say \"Sorry, I couldn't find the answer to your question in the workspace.\"",
"prompt": "Here are the related references from user's project:\n ```\n <729757158>\n ```\n \n Answer the user's query <Query> based on the reference shared above.\n Query: <368689265>.\n \n If you cannot find the answer in the attaches references, say \"Sorry, I couldn't find the answer to your question in the workspace.\"",
"type": "prompt_query",
"version": "0.0.1"
},
{
"type": "append_to_chat",
"value": "<741501672>",
"value": "<791477237>",
"version": "0.0.1"
}
],
"text_field_layout": "Hi, Please share your query: <903396436>"
"text_field_layout": "Hi, Please share your query: <368689265>"
},
{
"intent": "Refactor your code",
"registered_inputs": [
{
"display_text": "Instruction",
"id": "260641975",
"id": "505692143",
"optional": false,
"type": "string_input",
"version": "0.0.1"
},
{
"display_text": "Code",
"id": "907016073",
"id": "963359893",
"include_contextual_code": true,
"optional": false,
"type": "code_input",
Expand All @@ -360,7 +362,7 @@ let data = [
],
"registered_outputs": [
{
"id": "752315169",
"id": "589657894",
"type": "prompt_output",
"version": "0.0.1"
}
Expand All @@ -369,41 +371,41 @@ let data = [
"steps": [
{
"outputs": [
"752315169"
"589657894"
],
"prompt": "You are a coding assistant helping user to write code.\n\n\n Please find instructions provided my users <Instructions> and the code that is need to be modified <Code> based on the provided instructions:\n\n Instructions: <260641975>\n\n Code:\n ```dart\n <907016073>\n ```\n \n Note: State any assumption made and improvements introduced used while modification.\n ",
"prompt": "You are a coding assistant helping user to write code.\n\n\n Please find instructions provided my users <Instructions> and the code that is need to be modified <Code> based on the provided instructions:\n\n Instructions: <505692143>\n\n Code:\n ```dart\n <963359893>\n ```\n \n Note: State any assumption made and improvements introduced used while modification.\n ",
"type": "prompt_query",
"version": "0.0.1"
},
{
"type": "append_to_chat",
"value": "<752315169>",
"value": "<589657894>",
"version": "0.0.1"
}
],
"text_field_layout": "Hi, Please share the following info for refactoring: <260641975> <907016073>"
"text_field_layout": "Hi, Please share the following info for refactoring: <505692143> <963359893>"
},
{
"intent": "Add inline documentation to your code",
"registered_inputs": [
{
"display_text": "Code",
"id": "969449752",
"id": "988682939",
"include_contextual_code": true,
"optional": false,
"type": "code_input",
"version": "0.0.1"
},
{
"display_text": "Additional Instrunction",
"id": "904424077",
"id": "128434866",
"optional": true,
"type": "string_input",
"version": "0.0.1"
},
{
"display_text": "Reference Code",
"id": "166904426",
"id": "526759072",
"include_contextual_code": true,
"optional": true,
"type": "code_input",
Expand All @@ -412,7 +414,7 @@ let data = [
],
"registered_outputs": [
{
"id": "926029354",
"id": "521137469",
"type": "prompt_output",
"version": "0.0.1"
}
Expand All @@ -421,23 +423,23 @@ let data = [
"steps": [
{
"outputs": [
"926029354"
"521137469"
],
"prompt": "You are a coding assistant and instructor who writes professional code.\n \n Please find the user's code <Code>, additional instructional instructions <Additional Instructions>, and relevant references <References> to update existing comments or generate inline documentation if they are not already present in the user shared code.\n \n Code:\n ```dart\n <969449752>\n ```\n \n References:\n ```dart\n <166904426>\n ```\n \n Additional Instructions: <904424077>\n \n Share the updated code with proper comments back. Keep it as informational as possible for other developers to understand.",
"prompt": "You are a coding assistant and instructor who writes professional code.\n \n Please find the user's code <Code>, additional instructional instructions <Additional Instructions>, and relevant references <References> to update existing comments or generate inline documentation if they are not already present in the user shared code.\n \n Code:\n ```dart\n <988682939>\n ```\n \n References:\n ```dart\n <526759072>\n ```\n \n Additional Instructions: <128434866>\n \n Share the updated code with proper comments back. Keep it as informational as possible for other developers to understand.",
"type": "prompt_query",
"version": "0.0.1"
},
{
"type": "append_to_chat",
"value": "<926029354>",
"value": "<521137469>",
"version": "0.0.1"
}
],
"text_field_layout": "Hi, Let's generate inline documentation. Please share the following info: <969449752> <166904426> <904424077>"
"text_field_layout": "Hi, Let's generate inline documentation. Please share the following info: <988682939> <526759072> <128434866>"
}
],
"testing": true,
"version": "1.0.0"
"testing": false,
"version": "1.0.3"
},
{
"description": "Get help with writing tests.",
Expand Down Expand Up @@ -926,7 +928,7 @@ async function submitResponse() {
if (checkValueExists(agentsData.registered_inputs)) {
const currentAgentData = data.find((agent) => agent.name === currentActiveAgent);
toggleLoader(true);
vscode.postMessage({ type: "agents", value: { data: { ...agentsData, agent: currentActiveAgent, agent_version: currentAgentData?.version, testing: currentAgentData?.testing }, isCommandLess: false } });
vscode.postMessage({ type: "agents", value: { data: { ...agentsData, agent: currentActiveAgent, agent_version: currentAgentData?.version, testing: currentAgentData?.testing, metadata: currentAgentData?.metadata }, isCommandLess: false } });

questionnaireContainer.classList.add("hidden");
textInput.textContent = "";
Expand All @@ -945,7 +947,7 @@ async function submitResponse() {
commandLessData.prompt = value;

const activeAgentData = data.find(agent => agent.name === currentActiveAgent);
const commandLess = { agent_version: activeAgentData.version, agent: activeAgentData.name, chat_mode: activeAgentData?.chat_mode, ...commandLessData, testing: activeAgentData?.testing };
const commandLess = { agent_version: activeAgentData.version, agent: activeAgentData.name, chat_mode: activeAgentData?.chat_mode, ...commandLessData, testing: activeAgentData?.testing, metadata: activeAgentData?.metadata };
vscode.postMessage({ type: "agents", value: { data: { ...commandLess }, isCommandLess: true } });
questionnaireContainer.classList.add("hidden");
textInput.textContent = "";
Expand Down Expand Up @@ -1680,7 +1682,7 @@ function displayMessages() {
const agents = document.createElement("div");
agents.classList.add("inline-flex", "flex-row");
roleElement.appendChild(agents);
agents.innerHTML = `<span class="text-[#497BEF]">${message.agent ? message.agent : ""}</span><span class="text-rose-500 mx-1">${message.slug ? message.slug : ""}</span>`;
agents.innerHTML = `<span class="text-[#497BEF]">@${message.agent ? message.agent : ""}</span><span class="text-rose-500 mx-1">${message.slug ? message.slug : ""}</span>`;
contentElement.classList.add("text-sm", "block", "w-full", "px-2.5", "py-1.5", "break-words", "user-message");
contentElement.innerHTML = markdownToPlain(message.parts);
} else if (message.role === "dash") {
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/providers/chat_view_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
url: 'https://api.commanddash.dev/agent/get-agent-list',
data: {
"testing": false,
"cli_version": "0.0.1"

Check warning on line 251 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `cli_version` must match one of the following formats: camelCase
}
};
let response = await makeAuthorizedHttpRequest(config, this.context);
Expand All @@ -270,7 +270,7 @@
url: 'https://api.commanddash.dev/agent/get-agent',
data: {
"testing": testing,
"cli_version": "0.0.1",

Check warning on line 273 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `cli_version` must match one of the following formats: camelCase
"name": name,
"version": version
}
Expand Down Expand Up @@ -303,7 +303,7 @@
[`@${name}`]: {
...agentDetails,
name: `@${name}`,
supported_commands: agentDetails?.supported_commands.map((command: any) => ({

Check warning on line 306 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `supported_commands` must match one of the following formats: camelCase
...command,
slug: `/${command.slug}`
}))
Expand Down Expand Up @@ -479,30 +479,30 @@
//change agents on the select of agents
let prompt = '';
const conversationHistory = this._publicConversationHistory.filter(obj => Object.keys(obj)[0] === this._activeAgent).map(obj => obj[this._activeAgent]);
agentResponse = { ...agentResponse, registered_inputs: [...agentResponse.registered_inputs, { type: "chat_query_input", value: JSON.stringify(conversationHistory), id: Math.floor(Date.now() / 1000).toString() }], 'chat_documents': this.chatDocuments[this._activeAgent] };

Check warning on line 482 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `registered_inputs` must match one of the following formats: camelCase

Check warning on line 482 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `chat_documents` must match one of the following formats: camelCase
if (isCommandLess) {
prompt = agentResponse.prompt;
} else {
prompt = this.formatPrompt(agentResponse);
}

this._publicConversationHistory.push({ [this._activeAgent]: { role: 'user', parts: prompt, agent: agentResponse.agent, slug: agentResponse.slug } });
this._publicConversationHistory.push({ [this._activeAgent]: { role: 'user', parts: prompt, agent: agentResponse.metadata.display_name, slug: agentResponse.slug } });
this._view?.webview.postMessage({ type: 'displayMessages', value: this._publicConversationHistory });
try {
let auth = Auth.getInstance();
/// Request the client to process the task and handle result or error
let agentTrackData = {
'agent_name': (agentResponse['agent'] as string).substring(1),

Check warning on line 495 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `agent_name` must match one of the following formats: camelCase
'slash_command': agentResponse['slug'],

Check warning on line 496 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `slash_command` must match one of the following formats: camelCase
'agent_version': agentResponse['agent_version']

Check warning on line 497 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `agent_version` must match one of the following formats: camelCase
};
logEvent('agent_start', agentTrackData);
const response = await task.run({
kind: "agent-execute", data: {
"auth_details": {

Check warning on line 502 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `auth_details` must match one of the following formats: camelCase
"type": "gemini",
"key": auth.getApiKey(),
"github_token": auth.getGithubAccessToken()

Check warning on line 505 in vscode/src/providers/chat_view_provider.ts

View workflow job for this annotation

GitHub Actions / lint

Object Literal Property name `github_token` must match one of the following formats: camelCase
},
...agentResponse,
agent_name: (agentResponse['agent'] as string).substring(1) // remove the '@'
Expand Down