-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 feat: Add Agent Duplication Functionality with Permission (#5022)
* 🤖 feat: Add Agent Duplication Functionality with Permission * 🐛 fix: Enhance Agent Duplication Logic and Filter Sensitive Data * refactor(agents/v1): reorganized variables and error logging * refactor: remove duplication permission * chore: update librechat-data-provider version to 0.7.64 * fix: optimize agent duplication --------- Co-authored-by: Marco Beretta <[email protected]>
- Loading branch information
1 parent
16eed5f
commit 18ad89b
Showing
17 changed files
with
270 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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,50 @@ | ||
import { CopyIcon } from 'lucide-react'; | ||
import { useDuplicateAgentMutation } from '~/data-provider'; | ||
import { cn, removeFocusOutlines } from '~/utils'; | ||
import { useToastContext } from '~/Providers'; | ||
import { useLocalize } from '~/hooks'; | ||
|
||
export default function DuplicateAgent({ agent_id }: { agent_id: string }) { | ||
const localize = useLocalize(); | ||
const { showToast } = useToastContext(); | ||
|
||
const duplicateAgent = useDuplicateAgentMutation({ | ||
onSuccess: () => { | ||
showToast({ | ||
message: localize('com_ui_agent_duplicated'), | ||
status: 'success', | ||
}); | ||
}, | ||
onError: (error) => { | ||
console.error(error); | ||
showToast({ | ||
message: localize('com_ui_agent_duplicate_error'), | ||
status: 'error', | ||
}); | ||
}, | ||
}); | ||
|
||
if (!agent_id) { | ||
return null; | ||
} | ||
|
||
const handleDuplicate = () => { | ||
duplicateAgent.mutate({ agent_id }); | ||
}; | ||
|
||
return ( | ||
<button | ||
className={cn( | ||
'btn btn-neutral border-token-border-light relative h-9 rounded-lg font-medium', | ||
removeFocusOutlines, | ||
)} | ||
aria-label={localize('com_ui_duplicate') + ' ' + localize('com_ui_agent')} | ||
type="button" | ||
onClick={handleDuplicate} | ||
> | ||
<div className="flex w-full items-center justify-center gap-2 text-primary"> | ||
<CopyIcon className="size-4" /> | ||
</div> | ||
</button> | ||
); | ||
} |
This file contains 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.