Skip to content

Commit

Permalink
Merge pull request #163 from sourcery-ai/ben/sou-1446-feat-execute-re…
Browse files Browse the repository at this point in the history
…cipes-from-the-frontend

feat: allow chat to request complete recipe from the binary
  • Loading branch information
bm424 authored Jun 14, 2023
2 parents f1cecf5 + a927b8e commit 2ca1f20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/webview/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@
const message = messageInput.value.trim();
messageInput.value = "";
addUserMessageToUI(message);
sendRequestToExtension(message);
sendRequestToExtension({ message, kind: "user_message" });
checkTextarea();
}

function sendRecipeRequest(message) {
// Ensure we don't add on to the previous message
assistantMessageFinished();
addAssistantMessageToUI({
textContent: "Executing Recipe: " + message,
textContent: "Executing Recipe: " + message.name,
outcome: "success",
});
// Ensure new responses don't get added on to this one
assistantMessageFinished();
sendRequestToExtension(message);
sendRequestToExtension({ ...message, kind: "recipe_request" });
}

function assistantMessageFinished() {
Expand Down
2 changes: 1 addition & 1 deletion src/webview/recipes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
buttonContainer
.querySelector(`.${recipes[i]["id"]}`)
.addEventListener("click", () => {
sendMessageToExtension(recipes[i]["name"]);
sendMessageToExtension(recipes[i]);
});
recipeSection.append(buttonContainer);
}
Expand Down

0 comments on commit 2ca1f20

Please sign in to comment.