mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 11:20:15 +01:00
🚀 feat: Shared Links (#2772)
* ✨ feat(types): add necessary types for shared link feature * ✨ feat: add shared links functions to data service Added functions for retrieving, creating, updating, and deleting shared links and shared messages. * ✨ feat: Add useGetSharedMessages hook to fetch shared messages by shareId Adds a new hook `useGetSharedMessages` which fetches shared messages based on the provided shareId. * ✨ feat: Add share schema and data access functions to API models * ✨ feat: Add share endpoint to API The GET /api/share/${shareId} is exposed to the public, so authentication is not required. Other paths require authentication. * ♻️ refactor(utils): generalize react-query cache manipulation functions Introduces generic functions for manipulating react-query cache entries, marking a refinement in how query cache data is managed. It aims to enhance the flexibility and reusability of the cache interaction patterns within our application. - Replaced specific index names with more generic terms in queries.ts, enhancing consistency across data handling functions. - Introduced new utility functions in collection.ts for adding, updating, and deleting data entries in an InfiniteData<TCollection>. These utility functions (`addData`, `updateData`, `deleteData`, `findPage`) are designed to be re-usable across different data types and collections. - Adapted existing conversation utility functions in convos.ts to leverage these new generic utilities. * ✨ feat(shared-link): add functions to manipulate shared link cache list implemented new utility functions to handle additions, updates, and deletions in the shared link cache list. * ✨ feat: Add mutations and queries for shared links * ✨ feat(shared-link): add `Share` button to conversation list - Added a share button in each conversation in the conversation list. - Implemented functionality where clicking the share button triggers a POST request to the API. - The API checks if a share link was already created for the conversation today; if so, it returns the existing link. - If no link was created for today, the API will create a new share link and return it. - Each click on the share button results in a new API request, following the specification similar to ChatGPT's share link feature. * ♻️ refactor(hooks): generalize useNavScrolling for broader use - Modified `useNavScrolling` to accept a generic type parameter `TData`, allowing it to be used with different data structures besides `ConversationListResponse`. - Updated instances in `Nav.tsx` and `ArchivedChatsTable.tsx` to explicitly specify `ConversationListResponse` as the type argument when invoking `useNavScrolling`. * ✨ feat(settings): add shared links listing table with delete functionality in settings - Integrated a delete button for each shared link in the table, allowing users to remove links as needed. * ♻️ refactor(components): separate `EndpointIcon` from `Icon` component for standalone use * ♻️ refactor: update useGetSharedMessages to return TSharedLink - Modified the useGetSharedMessages hook to return not only a list of TMessage but also the TSharedLink itself. - This change was necessary to support displaying the title and date in the Shared Message UI, which requires data from TSharedLink. * ✨ feat(shared link): add UI for displaying shared conversations without authentication - Implemented a new UI component to display shared conversations, designed to be accessible without requiring authentication. - Reused components from the authenticated Messages module where possible. Copied and adapted components that could not be directly reused to fit the non-authenticated context. * 🔧 chore: Add translations Translate labels only. Messages remain in English as they are possibly subject to change. * ♻️ refactor: add icon and tooltip props to EditMenuButton component * moved icon and popover to arguments so that EditMenuButton can be reused. * modified so that when a ShareButton is closed, the parent DropdownMenu is also closed. * ♻️irefactor: added DropdownMenu for Export and Share * ♻️ refactor: renamed component names more intuitive * More accurate naming of the dropdown menu. * When the export button is closed, the parent dropdown menu is also closed. * 🌍 chore: updated translations * 🐞 Fix: OpenID Profile Image Download (#2757) * Add fetch requirement Fixes - error: [openidStrategy] downloadImage: Error downloading image at URL "https://graph.microsoft.com/v1.0/me/photo/$value": TypeError: response.buffer is not a function * Update openidStrategy.js --------- Co-authored-by: Danny Avila <danacordially@gmail.com> * 🚑 fix(export): Issue exporting Conversation with Assistants (#2769) * 🚑 fix(export): use content as text if content is present in the message If the endpoint is assistants, the text of the message goes into content, not message.text. * refactor(ExportModel): TypeScript, remove unused code --------- Co-authored-by: Yuichi Ohneda <ohneda@gmail.com> * 📤style: export button icon (#2752) * refactor(ShareDialog): logic and styling * refactor(ExportAndShareMenu): imports order and icon update * chore: imports * chore: imports/render logic * feat: message branching * refactor: add optional config to useGetStartupConfig * refactor: disable endpoints query * chore: fix search view styling gradient in light mode * style: ShareView gradient styling * refactor(Share): use select queries * style: shared link table buttons * localization and dark text styling * style: fix clipboard button layout shift app-wide and add localization for copy code * support assistants message content in shared links, add useCopyToClipboard, add copy buttons to Search Messages and Shared Link Messages * add localizations * comparisons --------- Co-authored-by: Yuichi Ohneda <ohneda@gmail.com> Co-authored-by: bsu3338 <bsu3338@users.noreply.github.com> Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
This commit is contained in:
parent
38ad36c1c5
commit
f0e8cca5df
78 changed files with 4683 additions and 317 deletions
|
|
@ -132,6 +132,17 @@ export default {
|
|||
com_ui_assistants_output: '助手输出',
|
||||
com_ui_delete: '删除',
|
||||
com_ui_create: '创建',
|
||||
com_ui_share: 'Share',
|
||||
com_ui_share_link_to_chat: 'Share link to chat',
|
||||
com_ui_share_error: 'There was an error sharing the chat link',
|
||||
com_ui_share_create_message: 'Your name and any messages you add after sharing stay private.',
|
||||
com_ui_share_created_message:
|
||||
'A public link to your chat has been created. Manage previously shared chats at any time via Settings.',
|
||||
com_ui_share_update_message:
|
||||
'Your name, custom instructions, and any messages you add after sharing stay private.',
|
||||
com_ui_share_updated_message:
|
||||
'A public link to your chat has been updated. Manage previously shared chats at any time via Settings.',
|
||||
com_ui_shared_link_not_found: 'Shared link not found',
|
||||
com_ui_delete_conversation: '删除对话?',
|
||||
com_ui_delete_conversation_confirm: '这将删除',
|
||||
com_ui_delete_assistant_confirm: '确定要删除此助手吗?该操作无法撤销。',
|
||||
|
|
@ -386,6 +397,12 @@ export default {
|
|||
com_nav_export_recursive_or_sequential: '递归或顺序?',
|
||||
com_nav_export_recursive: '递归',
|
||||
com_nav_export_conversation: '导出对话',
|
||||
com_nav_export: '导出',
|
||||
com_nav_shared_links: '共享链接',
|
||||
com_nav_shared_links_manage: '管理',
|
||||
com_nav_shared_links_empty: '您没有共享链接。',
|
||||
com_nav_shared_links_name: '名称',
|
||||
com_nav_shared_links_date_shared: '共享日期',
|
||||
com_nav_my_files: '我的文件',
|
||||
com_nav_theme: '主题',
|
||||
com_nav_theme_system: '跟随系统设置',
|
||||
|
|
@ -417,6 +434,15 @@ export default {
|
|||
com_nav_setting_data: '数据管理',
|
||||
com_nav_setting_account: '账户',
|
||||
/* The following are AI Translated */
|
||||
com_ui_date_october: '十月',
|
||||
com_ui_date_november: '十一月',
|
||||
com_ui_date_december: '十二月',
|
||||
com_ui_copied: '已复制!',
|
||||
com_ui_copy_code: '复制代码',
|
||||
com_ui_copy_link: '复制链接',
|
||||
com_ui_update_link: '更新链接',
|
||||
com_ui_create_link: '创建链接',
|
||||
com_nav_source_chat: '查看源代码对话',
|
||||
com_ui_date_today: '今天',
|
||||
com_ui_date_yesterday: '昨天',
|
||||
com_ui_date_previous_7_days: '过去7天',
|
||||
|
|
@ -1022,6 +1048,43 @@ export const comparisons = {
|
|||
english: 'Create',
|
||||
translated: '创建',
|
||||
},
|
||||
com_ui_share: {
|
||||
english: 'Share',
|
||||
translated: 'Share',
|
||||
},
|
||||
com_ui_share_link_to_chat: {
|
||||
english: 'Share link to chat',
|
||||
translated: 'Share link to chat',
|
||||
},
|
||||
com_ui_share_error: {
|
||||
english: 'There was an error sharing the chat link',
|
||||
translated: 'There was an error sharing the chat link',
|
||||
},
|
||||
com_ui_share_create_message: {
|
||||
english: 'Your name and any messages you add after sharing stay private.',
|
||||
translated: 'Your name and any messages you add after sharing stay private.',
|
||||
},
|
||||
com_ui_share_created_message: {
|
||||
english:
|
||||
'A public link to your chat has been created. Manage previously shared chats at any time via Settings.',
|
||||
translated:
|
||||
'A public link to your chat has been created. Manage previously shared chats at any time via Settings.',
|
||||
},
|
||||
com_ui_share_update_message: {
|
||||
english: 'Your name, custom instructions, and any messages you add after sharing stay private.',
|
||||
translated:
|
||||
'Your name, custom instructions, and any messages you add after sharing stay private.',
|
||||
},
|
||||
com_ui_share_updated_message: {
|
||||
english:
|
||||
'A public link to your chat has been updated. Manage previously shared chats at any time via Settings.',
|
||||
translated:
|
||||
'A public link to your chat has been updated. Manage previously shared chats at any time via Settings.',
|
||||
},
|
||||
com_ui_shared_link_not_found: {
|
||||
english: 'Shared link not found',
|
||||
translated: 'Shared link not found',
|
||||
},
|
||||
com_ui_delete_conversation: {
|
||||
english: 'Delete chat?',
|
||||
translated: '删除对话?',
|
||||
|
|
@ -1991,6 +2054,30 @@ export const comparisons = {
|
|||
english: 'Export conversation',
|
||||
translated: '导出对话',
|
||||
},
|
||||
com_nav_export: {
|
||||
english: 'Export',
|
||||
translated: '导出',
|
||||
},
|
||||
com_nav_shared_links: {
|
||||
english: 'Shared links',
|
||||
translated: '共享链接',
|
||||
},
|
||||
com_nav_shared_links_manage: {
|
||||
english: 'Manage',
|
||||
translated: '管理',
|
||||
},
|
||||
com_nav_shared_links_empty: {
|
||||
english: 'You have no shared links.',
|
||||
translated: '您没有共享链接。',
|
||||
},
|
||||
com_nav_shared_links_name: {
|
||||
english: 'Name',
|
||||
translated: '名称',
|
||||
},
|
||||
com_nav_shared_links_date_shared: {
|
||||
english: 'Date shared',
|
||||
translated: '共享日期',
|
||||
},
|
||||
com_nav_my_files: {
|
||||
english: 'My Files',
|
||||
translated: '我的文件',
|
||||
|
|
@ -2111,6 +2198,42 @@ export const comparisons = {
|
|||
english: 'Account',
|
||||
translated: '账户',
|
||||
},
|
||||
com_ui_date_october: {
|
||||
english: 'October',
|
||||
translated: '十月',
|
||||
},
|
||||
com_ui_date_november: {
|
||||
english: 'November',
|
||||
translated: '十一月',
|
||||
},
|
||||
com_ui_date_december: {
|
||||
english: 'December',
|
||||
translated: '十二月',
|
||||
},
|
||||
com_ui_copied: {
|
||||
english: 'Copied!',
|
||||
translated: '已复制!',
|
||||
},
|
||||
com_ui_copy_code: {
|
||||
english: 'Copy code',
|
||||
translated: '复制代码',
|
||||
},
|
||||
com_ui_copy_link: {
|
||||
english: 'Copy link',
|
||||
translated: '复制链接',
|
||||
},
|
||||
com_ui_update_link: {
|
||||
english: 'Update link',
|
||||
translated: '更新链接',
|
||||
},
|
||||
com_ui_create_link: {
|
||||
english: 'Create link',
|
||||
translated: '创建链接',
|
||||
},
|
||||
com_nav_source_chat: {
|
||||
english: 'View source chat',
|
||||
translated: '查看源代码对话',
|
||||
},
|
||||
com_ui_date_today: {
|
||||
english: 'Today',
|
||||
translated: '今天',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue