-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat(chat): drag workflows and folders from sidebar into chat input #4028
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
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2a8d23d
feat(chat): drag workflows and folders from sidebar into chat input
waleedlatif1 c0dd830
fix(chat): fix effectAllowed, stale atInsertPosRef, and drag-enter ov…
waleedlatif1 9cfd1ee
feat(chat): add task dragging and visible drag ghost for sidebar items
waleedlatif1 3bdedad
feat(sidebar): add drag ghost with icons and task icon to context chips
waleedlatif1 0ebee18
refactor(types): narrow ChatMessageContext.kind to ChatContextKind un…
waleedlatif1 86e7c9e
feat(user-input): support Tab to select resource in mention dropdown
waleedlatif1 4e1fa16
fix(user-input): narrow ChatContext discriminated union before access…
waleedlatif1 fccf98d
fix(colors): overload workflowBorderColor to accept string | undefined
waleedlatif1 4ff9b84
fix(colors): simplify workflowBorderColor to single string | undefine…
waleedlatif1 7b8fa00
fix(chat): remove resource panel tab when context mention is deleted …
waleedlatif1 6d31c36
fix(chat): use resource ID for context removal identity check
waleedlatif1 4d492a4
fix(chat): add folder/task cases to resource resolver, task key to ex…
waleedlatif1 abaac15
revert(chat): remove folder/task from resolveResourceFromContext — no…
waleedlatif1 669f2ac
fix(chat): add chatId to stored context types and workflow.color to d…
waleedlatif1 e471b2e
fix(chat): guard chatId before adding task key to existingResourceKeys
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor(types): narrow ChatMessageContext.kind to ChatContextKind un…
…ion and add workflowBorderColor utility
- Loading branch information
commit 0ebee18ef68eee617c96c491def48b07f3b9b192
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
apps/sim/app/workspace/[workspaceId]/home/components/context-mention-icon.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { Blimp, Database, Folder as FolderIcon, Table as TableIcon } from '@/components/emcn/icons' | ||
| import { getDocumentIcon } from '@/components/icons/document-icons' | ||
| import { cn } from '@/lib/core/utils/cn' | ||
| import { workflowBorderColor } from '@/lib/workspaces/colors' | ||
| import type { ChatMessageContext } from '@/app/workspace/[workspaceId]/home/types' | ||
|
|
||
| interface ContextMentionIconProps { | ||
| context: ChatMessageContext | ||
| /** Only used when context.kind is 'workflow' or 'current_workflow'; ignored otherwise. */ | ||
| workflowColor?: string | null | ||
| /** Applied to every icon element. Include sizing and positional classes (e.g. h-[12px] w-[12px]). */ | ||
| className: string | ||
| } | ||
|
|
||
| /** Renders the icon for a context mention chip. Returns null when no icon applies. */ | ||
| export function ContextMentionIcon({ context, workflowColor, className }: ContextMentionIconProps) { | ||
| switch (context.kind) { | ||
| case 'workflow': | ||
| case 'current_workflow': | ||
| return workflowColor ? ( | ||
| <span | ||
| className={cn('rounded-[3px] border-[2px]', className)} | ||
| style={{ | ||
| backgroundColor: workflowColor, | ||
| borderColor: workflowBorderColor(workflowColor), | ||
| backgroundClip: 'padding-box', | ||
| }} | ||
| /> | ||
| ) : null | ||
| case 'knowledge': | ||
| return <Database className={className} /> | ||
| case 'table': | ||
| return <TableIcon className={className} /> | ||
| case 'file': { | ||
| const FileDocIcon = getDocumentIcon('', context.label) | ||
| return <FileDocIcon className={className} /> | ||
| } | ||
| case 'folder': | ||
| return <FolderIcon className={className} /> | ||
| case 'past_chat': | ||
| return <Blimp className={className} /> | ||
| default: | ||
| return null | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.