-
Notifications
You must be signed in to change notification settings - Fork 93
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
Conversation
Updates to Preview Branch (command-bar-suggestions) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
There was a problem hiding this 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)}`, |
There was a problem hiding this comment.
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" /> |
There was a problem hiding this comment.
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", { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
There was a problem hiding this 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", { |
There was a problem hiding this comment.
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.
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 }; | ||
} | ||
}), |
There was a problem hiding this comment.
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> => { |
There was a problem hiding this comment.
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!
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" />
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.