10000 feat: add suggested actions to command bar by binary-koan · Pull Request #62 · antiwork/helper · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add suggested actions to command bar #62

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

Merged
merged 13 commits into from
Mar 14, 2025
Merged

Conversation

binary-koan
Copy link
Collaborator

Adds a strip with suggested actions below the command bar. These are based on the recommended tools logic, but extended to include close/spam/assign, and computed up front to avoid long load times.

Screenshot 2025-03-13 at 22 53 28

@binary-koan binary-koan self-assigned this Mar 13, 2025
Copy link
supabase bot commented Mar 13, 2025

Updates to Preview Branch (command-bar-suggestions) ↗︎

Deployments Status Updated
Database Fri, 14 Mar 2025 22:51:49 UTC
Services Fri, 14 Mar 2025 22:51:49 UTC
APIs Fri, 14 Mar 2025 22:51:49 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Fri, 14 Mar 2025 22:51:49 UTC
Migrations Fri, 14 Mar 2025 22:51:49 UTC
Seeding Fri, 14 Mar 2025 22:51:49 UTC
Edge Functions Fri, 14 Mar 2025 22:51:49 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Copy link
Collaborator Author
@binary-koan binary-koan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raphaelcosta _a Could you give this a quick look as well?

...tools.suggested
.flatMap((t) => (t.type === "tool" ? [t.tool] : []))
.map((tool) => ({
id: `tool-${tool.slug}-${JSON.stringify(tool.parameters)}`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just indentation change due to the flatMap

@@ -121,10 +121,10 @@ const KnowledgeBankSetting = () => {
{Array.from({ length: 2 }).map((_, i) => (
<div key={i} className="flex items-center gap-3 py-4">
<div className="grow space-y-2">
<div className="h-4 w-32 rounded bg-secondary animate-[pulse_2s_cubic-bezier(0.4,0,0.6,1)_infinite]" />
<div className="h-4 w-48 rounded bg-secondary animate-[pulse_2s_cubic-bezier(0.4,0,0.6,1)_infinite]" />
<div className="h-4 w-32 rounded bg-secondary animate-skeleton" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this hardcoded a bunch, think it's worth adding an alias

@@ -24,6 +24,13 @@ export default inngest.createFunction(
}
});

if ("status" in conversation && conversation.status === "open") {
await step.sendEvent("update-suggested-actions", {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth precomputing these since it takes a few seconds to load and the layout shift will be more annoying in the new position under the command bar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it makes more sense to listen for multiple events in the update suggested actions function instead? I don't have a strong opinion on it.

@@ -259,3 +284,57 @@ const validateParameters = (tool: Tool, params: Record<string, any>) => {
throw error;
}
};

const buildSimilarConversationActionsPrompt = async (embeddingText: string, mailbox: Mailbox): Promise<string> => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open to any thoughts on better ways to figure out recommended actions, but I figure checking and counting how many times things were done to similar conversations is a good place to start

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! It’s a great start!

Copy link
Member
@raphaelcosta raphaelcosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@binary-koan _a looks good! I added a few questions and also wanted to ask if you think it makes sense to trigger the command bar when pressing / while the editor is focused

@@ -24,6 +24,13 @@ export default inngest.createFunction(
}
});

if ("status" in conversation && conversation.status === "open") {
await step.sendEvent("update-suggested-actions", {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it makes more sense to listen for multiple events in the update suggested actions function instead? I don't have a strong opinion on it.

Comment on lines 29 to 40
suggestedActions: toolCalls.map(({ toolName, args }) => {
switch (toolName) {
case "close":
return { type: "close" };
case "spam":
return { type: "spam" };
case "assign":
return { type: "assign", clerkUserId: args.userId };
default:
return { type: "tool", slug: toolName, parameters: args };
}
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about doing that map inside the generateSuggestedActions function?

@@ -259,3 +284,57 @@ const validateParameters = (tool: Tool, params: Record<string, any>) => {
throw error;
}
};

const buildSimilarConversationActionsPrompt = async (embeddingText: string, mailbox: Mailbox): Promise<string> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! It’s a great start!

@neetogit-bot neetogit-bot bot assigned binary-koan and unassigned raphaelcosta Mar 14, 2025
@binary-koan binary-koan merged commit a38620e into main Mar 14, 2025
4 of 5 checks passed
@binary-koan binary-koan deleted the command-bar-suggestions branch March 14, 2025 23:28
vikaswakde pushed a commit to vikaswakde/helper that referenced this pull request Mar 15, 2025
Adds a strip with suggested actions below the command bar. These are
based on the recommended tools logic, but extended to include
close/spam/assign, and computed up front to avoid long load times.

<img width="1134" alt="Screenshot 2025-03-13 at 22 53 28"
src="https://github.com/user-attachments/assets/286ed1e2-17da-4bfa-9eaf-e332bf3ad146"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0