Skip to content

Commit

Permalink
♻️ refactor: refactor the portal implement (lobehub#3110)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Jul 1, 2024
1 parent 9304008 commit 53fb292
Show file tree
Hide file tree
Showing 56 changed files with 358 additions and 165 deletions.
2 changes: 1 addition & 1 deletion locales/ar/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "بعد ضبط عنوان سوق الإضافات، يمكن استخدام سوق الإضافات المخصص",
"title": "ضبط سوق الإضافات"
},
"showInPortal": "يرجى الاطلاع على التفاصيل في النافذة المنبثقة",
"showInPortal": "يرجى الاطلاع على التفاصيل في مساحة العمل",
"store": {
"actions": {
"confirmUninstall": "سيتم إلغاء تثبيت الإضافة، وسيتم مسح تكوين الإضافة، يرجى تأكيد العملية",
Expand Down
8 changes: 7 additions & 1 deletion locales/ar/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "تلخيص من قبل المساعد",
"Artifacts": "القطع الأثرية",
"actions": {
"genAiMessage": "إنشاء رسالة مساعد ذكاء اصطناعي",
"summary": "ملخص",
"summaryTooltip": "ملخص للمحتوى الحالي"
},
"emptyArtifactList": "قائمة القطع الأثرية الحالية فارغة، يرجى استخدام الإضافات في الجلسة ومن ثم التحقق مرة أخرى",
"title": "نافذة موسعة"
}
2 changes: 1 addition & 1 deletion locales/bg-BG/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "След като конфигурирате адреса на пазара на плъгини, можете да използвате персонализиран пазар на плъгини",
"title": "Конфигуриране на пазара на плъгини"
},
"showInPortal": "Моля, вижте подробностите в разширеното прозорец",
"showInPortal": "Моля, вижте подробностите в работното пространство",
"store": {
"actions": {
"confirmUninstall": "Плъгинът е на път да бъде деинсталиран. След деинсталирането конфигурацията на плъгина ще бъде изчистена. Моля, потвърдете операцията си.",
Expand Down
8 changes: 7 additions & 1 deletion locales/bg-BG/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Сумиране от помощник",
"Artifacts": "Артефакти",
"actions": {
"genAiMessage": "Създаване на съобщение на помощника",
"summary": "Обобщение",
"summaryTooltip": "Обобщение на текущото съдържание"
},
"emptyArtifactList": "Списъкът с текущите артефакти е празен. Моля, използвайте добавки в разговора и след това проверете отново.",
"title": "Разширено прозорец"
}
2 changes: 1 addition & 1 deletion locales/de-DE/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Nachdem Sie die Adresse des Plugin-Marktes konfiguriert haben, können Sie den benutzerdefinierten Plugin-Markt verwenden.",
"title": "Plugin-Markteinstellungen"
},
"showInPortal": "Bitte überprüfen Sie die Details im Erweiterungsfenster",
"showInPortal": "Bitte überprüfen Sie die Details im Portal",
"store": {
"actions": {
"confirmUninstall": "Das Plugin wird deinstalliert und alle Konfigurationen werden gelöscht. Bitte bestätigen Sie Ihre Aktion.",
Expand Down
8 changes: 7 additions & 1 deletion locales/de-DE/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Lassen Sie den Assistenten zusammenfassen",
"Artifacts": "Artefakte",
"actions": {
"genAiMessage": "Assistenten-Nachricht erstellen",
"summary": "Zusammenfassung",
"summaryTooltip": "Zusammenfassung des aktuellen Inhalts"
},
"emptyArtifactList": "Die Liste der Artefakte ist derzeit leer. Bitte verwenden Sie Plugins in der Sitzung und überprüfen Sie sie erneut.",
"title": "Erweiterungsfenster"
}
2 changes: 1 addition & 1 deletion locales/en-US/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "After configuring the address of the plugin marketplace, you can use a custom plugin marketplace",
"title": "Configure Plugin Marketplace"
},
"showInPortal": "Please view details in the extension window",
"showInPortal": "Please check the details in the Portal view",
"store": {
"actions": {
"confirmUninstall": "The plugin is about to be uninstalled. After uninstalling, the plugin configuration will be cleared. Please confirm your operation.",
Expand Down
10 changes: 8 additions & 2 deletions locales/en-US/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Let the assistant summarize",
"title": "Expand Window"
"Artifacts": "Artifacts",
"actions": {
"genAiMessage": "Generate Assistant Message",
"summary": "Summary",
"summaryTooltip": "Summarize current content"
},
"emptyArtifactList": "The current Artifacts list is empty. Please use plugins in the session as needed before viewing.",
"title": "Portal View"
}
2 changes: 1 addition & 1 deletion locales/es-ES/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Después de configurar la dirección del mercado de complementos, puede utilizar un mercado personalizado de complementos.",
"title": "Configuración del mercado de complementos"
},
"showInPortal": "Por favor, consulta los detalles en la ventana de expansión",
"showInPortal": "Por favor, consulta los detalles en el portal de trabajo",
"store": {
"actions": {
"confirmUninstall": "Está a punto de desinstalar este complemento. Se eliminará la configuración del complemento. Confirme su acción.",
Expand Down
8 changes: 7 additions & 1 deletion locales/es-ES/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Resumen del asistente",
"Artifacts": "Artefactos",
"actions": {
"genAiMessage": "Crear mensaje de IA",
"summary": "Resumen",
"summaryTooltip": "Resumir el contenido actual"
},
"emptyArtifactList": "La lista de Artefactos actual está vacía. Por favor, utilice los complementos en la conversación y vuelva a intentarlo.",
"title": "Ventana de expansión"
}
2 changes: 1 addition & 1 deletion locales/fr-FR/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Une fois l'adresse du marché des plugins configurée, vous pourrez utiliser un marché de plugins personnalisé.",
"title": "Paramètres du marché des plugins"
},
"showInPortal": "Veuillez consulter les détails dans la fenêtre d'extension",
"showInPortal": "Veuillez consulter les détails dans l'espace de travail",
"store": {
"actions": {
"confirmUninstall": "Vous êtes sur le point de désinstaller ce plugin. Une fois désinstallé, sa configuration sera effacée. Veuillez confirmer votre action.",
Expand Down
8 changes: 7 additions & 1 deletion locales/fr-FR/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Faire un résumé avec l'assistant",
"Artifacts": "Artifacts",
"actions": {
"genAiMessage": "Créer un message d'assistant",
"summary": "Résumé",
"summaryTooltip": "Résumé du contenu actuel"
},
"emptyArtifactList": "La liste des Artifacts est actuellement vide. Veuillez utiliser les plugins dans la conversation avant de consulter à nouveau.",
"title": "Fenêtre d'extension"
}
2 changes: 1 addition & 1 deletion locales/it-IT/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Dopo aver configurato l'indirizzo del mercato dei plugin, è possibile utilizzare un mercato dei plugin personalizzato",
"title": "Impostazioni del mercato dei plugin"
},
"showInPortal": "Si prega di visualizzare i dettagli nella finestra di estensione",
"showInPortal": "Si prega di visualizzare i dettagli nell'area di lavoro",
"store": {
"actions": {
"confirmUninstall": "Stai per disinstallare questo plugin. La disinstallazione cancellerà la configurazione del plugin. Conferma l'operazione",
Expand Down
8 changes: 7 additions & 1 deletion locales/it-IT/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Riepilogo assistente",
"Artifacts": "Artefatti",
"actions": {
"genAiMessage": "Genera messaggio AI",
"summary": "Sommario",
"summaryTooltip": "Sommario del contenuto attuale"
},
"emptyArtifactList": "La lista degli Artefatti attuale è vuota, si prega di utilizzare i plugin necessari durante la sessione e poi controllare di nuovo",
"title": "Finestra di espansione"
}
2 changes: 1 addition & 1 deletion locales/ja-JP/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "プラグインマーケットのアドレスを設定すると、カスタムのプラグインマーケットを使用できます",
"title": "プラグインマーケットの設定"
},
"showInPortal": "詳細は拡張ウィンドウで表示してください",
"showInPortal": "詳細はワークスペースで表示してください",
"store": {
"actions": {
"confirmUninstall": "このプラグインをアンインストールします。アンインストール後、プラグインの設定がクリアされます。操作を確認してください。",
Expand Down
8 changes: 7 additions & 1 deletion locales/ja-JP/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "アシスタントに要約させる",
"Artifacts": "アーティファクト",
"actions": {
"genAiMessage": "AIメッセージを生成",
"summary": "サマリー",
"summaryTooltip": "現在の内容を要約"
},
"emptyArtifactList": "現在、アーティファクトリストは空です。プラグインを使用してセッション中に追加してください。",
"title": "拡張ウィンドウ"
}
2 changes: 1 addition & 1 deletion locales/ko-KR/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "플러그인 마켓의 주소를 구성하면 사용자 정의 플러그인 마켓을 사용할 수 있습니다.",
"title": "플러그인 마켓 설정"
},
"showInPortal": "확장 창에서 자세히 보기",
"showInPortal": "작업 영역에서 자세히 확인하세요",
"store": {
"actions": {
"confirmUninstall": "이 플러그인을 제거하려고 합니다. 제거하면 플러그인 구성이 지워지므로 작업을 확인하세요.",
Expand Down
8 changes: 7 additions & 1 deletion locales/ko-KR/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "어시스턴트 요약",
"Artifacts": "아티팩트",
"actions": {
"genAiMessage": "AI 메시지 생성",
"summary": "요약",
"summaryTooltip": "현재 콘텐츠를 요약합니다"
},
"emptyArtifactList": "현재 아티팩트 목록이 비어 있습니다. 플러그인을 사용한 후에 다시 확인해주세요.",
"title": "확장 창"
}
2 changes: 1 addition & 1 deletion locales/nl-NL/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Na het instellen van de marktlocatie voor plugins, kunt u een aangepaste pluginmarkt gebruiken.",
"title": "Instellingen voor pluginmarkt"
},
"showInPortal": "Gelieve de details te bekijken in het uitbreidingsvenster",
"showInPortal": "Gelieve de details in het portaal te bekijken",
"store": {
"actions": {
"confirmUninstall": "Deze plugin wordt binnenkort verwijderd. Na verwijdering worden de configuraties gewist. Weet u zeker dat u door wilt gaan?",
Expand Down
8 changes: 7 additions & 1 deletion locales/nl-NL/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Laat de assistent samenvatten",
"Artifacts": "Artifacts",
"actions": {
"genAiMessage": "Creëer assistentbericht",
"summary": "Samenvatting",
"summaryTooltip": "Samenvatting van de huidige inhoud"
},
"emptyArtifactList": "De huidige lijst met Artifacts is leeg. Gebruik plugins in de sessie en bekijk deze later opnieuw.",
"title": "Uitbreidingsvenster"
}
2 changes: 1 addition & 1 deletion locales/pl-PL/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Po skonfigurowaniu adresu sklepu wtyczek możesz korzystać z niestandardowego sklepu wtyczek",
"title": "Skonfiguruj sklep wtyczek"
},
"showInPortal": "Proszę sprawdzić szczegóły w oknie rozszerzenia",
"showInPortal": "Proszę sprawdzić szczegóły w obszarze roboczym",
"store": {
"actions": {
"confirmUninstall": "Wtyczka zostanie odinstalowana. Po odinstalowaniu konfiguracja wtyczki zostanie wyczyszczona. Potwierdź swoje działanie.",
Expand Down
8 changes: 7 additions & 1 deletion locales/pl-PL/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Podsumowanie przez asystenta",
"Artifacts": "Artefakty",
"actions": {
"genAiMessage": "Tworzenie wiadomości AI",
"summary": "Podsumowanie",
"summaryTooltip": "Podsumowanie bieżącej zawartości"
},
"emptyArtifactList": "Obecna lista Artefaktów jest pusta. Proszę użyć wtyczek w trakcie sesji, a następnie sprawdzić ponownie.",
"title": "Okno rozszerzenia"
}
2 changes: 1 addition & 1 deletion locales/pt-BR/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Após configurar o endereço do mercado de plugins, você poderá usar um mercado personalizado de plugins.",
"title": "Configurações do Mercado de Plugins"
},
"showInPortal": "Por favor, veja os detalhes na janela de extensão",
"showInPortal": "Por favor, veja os detalhes na área de trabalho",
"store": {
"actions": {
"confirmUninstall": "Você está prestes a desinstalar este plugin. A desinstalação irá limpar a configuração do plugin. Confirme a operação.",
Expand Down
8 changes: 7 additions & 1 deletion locales/pt-BR/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Permita que o assistente resuma",
"Artifacts": "Artefatos",
"actions": {
"genAiMessage": "Gerar mensagem de IA",
"summary": "Resumo",
"summaryTooltip": "Resumir o conteúdo atual"
},
"emptyArtifactList": "A lista de Artefatos atual está vazia. Por favor, use os plugins conforme necessário durante a sessão e depois verifique novamente.",
"title": "Janela de Expansão"
}
2 changes: 1 addition & 1 deletion locales/ru-RU/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "После настройки адреса магазина плагинов можно использовать пользовательский магазин",
"title": "Настройки магазина плагинов"
},
"showInPortal": "Просмотрите подробности во всплывающем окне",
"showInPortal": "Просмотрите подробности в рабочей области",
"store": {
"actions": {
"confirmUninstall": "Вы собираетесь удалить этот плагин. После удаления его настройки будут утрачены. Вы уверены, что хотите продолжить?",
Expand Down
8 changes: 7 additions & 1 deletion locales/ru-RU/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Попросите помощника сделать сводку",
"Artifacts": "Артефакты",
"actions": {
"genAiMessage": "Создать сообщение помощника",
"summary": "Сводка",
"summaryTooltip": "Сводка текущего содержимого"
},
"emptyArtifactList": "Список текущих артефактов пуст. Пожалуйста, используйте плагины во время сеанса и затем просмотрите.",
"title": "Расширенное окно"
}
2 changes: 1 addition & 1 deletion locales/tr-TR/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Eklenti pazarı adresini yapılandırdıktan sonra, özel bir eklenti pazarı kullanabilirsiniz.",
"title": "Eklenti Pazarı Ayarla"
},
"showInPortal": "Detayları genişletme penceresinde görüntüleyin",
"showInPortal": "Detayları çalışma alanında görüntüleyin",
"store": {
"actions": {
"confirmUninstall": "Bu eklentiyi kaldırmak üzeresiniz, kaldırdıktan sonra eklenti yapılandırması temizlenecektir, işleminizi onaylayın",
Expand Down
8 changes: 7 additions & 1 deletion locales/tr-TR/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Asistanın özetlemesine izin ver",
"Artifacts": "Artefaktlar",
"actions": {
"genAiMessage": "Yapay Zeka Mesajı Oluştur",
"summary": "Özet",
"summaryTooltip": "Mevcut içeriği özetle"
},
"emptyArtifactList": "Mevcut Artefakt listesi boş, lütfen eklentileri kullanarak oturumda gerektiğinde göz atın",
"title": "Genişletme Penceresi"
}
2 changes: 1 addition & 1 deletion locales/vi-VN/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "Sau khi cấu hình địa chỉ thị trường plugin, bạn có thể sử dụng thị trường plugin tùy chỉnh",
"title": "Cài đặt thị trường plugin"
},
"showInPortal": "Vui lòng xem chi tiết trong cửa sổ mở rộng",
"showInPortal": "Vui lòng xem chi tiết trong khu vực làm việc",
"store": {
"actions": {
"confirmUninstall": "Sắp gỡ bỏ plugin này, sau khi gỡ bỏ sẽ xóa cấu hình của plugin này, vui lòng xác nhận hành động của bạn",
Expand Down
8 changes: 7 additions & 1 deletion locales/vi-VN/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "Tóm tắt bởi trợ lý",
"Artifacts": "Tác Phẩm",
"actions": {
"genAiMessage": "Tạo tin nhắn trợ giúp",
"summary": "Tóm tắt",
"summaryTooltip": "Tóm tắt nội dung hiện tại"
},
"emptyArtifactList": "Danh sách Tác Phẩm hiện tại đang trống, vui lòng sử dụng các plugin trong cuộc trò chuyện trước khi xem lại",
"title": "Cửa sổ mở rộng"
}
2 changes: 1 addition & 1 deletion locales/zh-CN/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"modalDesc": "配置插件市场的地址后,可以使用自定义的插件市场",
"title": "设置插件市场"
},
"showInPortal": "请在扩展窗中查看详情",
"showInPortal": "请在工作区中查看详情",
"store": {
"actions": {
"confirmUninstall": "即将卸载该插件,卸载后将清除该插件配置,请确认你的操作",
Expand Down
10 changes: 8 additions & 2 deletions locales/zh-CN/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "让助手总结",
"title": "扩展窗"
"Artifacts": "Artifacts",
"actions": {
"genAiMessage": "创建助手消息",
"summary": "总结",
"summaryTooltip": "总结当前内容"
},
"emptyArtifactList": "当前 Artifacts 列表为空,请在会话中按需使用插件后再查看",
"title": "工作区"
}
8 changes: 7 additions & 1 deletion locales/zh-TW/portal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"aiSummary": "讓助手總結",
"Artifacts": "文物",
"actions": {
"genAiMessage": "生成助手訊息",
"summary": "摘要",
"summaryTooltip": "總結目前內容"
},
"emptyArtifactList": "當前文物列表為空,請在會話中按需使用插件後再查看",
"title": "擴展視窗"
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
import { Icon } from '@lobehub/ui';
import { ActionIcon, Icon } from '@lobehub/ui';
import { Button } from 'antd';
import { LucideBotMessageSquare } from 'lucide-react';
import { LucideBotMessageSquare, LucideNotepadText } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';

import { useChatStore } from '@/store/chat';
import { chatPortalSelectors, chatSelectors } from '@/store/chat/selectors';

const Footer = () => {
const [messageId, triggerAIMessage, isAIGenerating] = useChatStore((s) => [
chatPortalSelectors.toolUIMessageId(s),
s.triggerAIMessage,
const [messageId, isAIGenerating, triggerAIMessage, summaryPluginContent] = useChatStore((s) => [
chatPortalSelectors.artifactMessageId(s),
chatSelectors.isAIGenerating(s),
s.triggerAIMessage,
s.summaryPluginContent,
]);
const { t } = useTranslation('portal');

return (
<Flexbox horizontal paddingBlock={12} paddingInline={12}>
<Flexbox gap={8} horizontal paddingBlock={12} paddingInline={12}>
<Button
icon={<Icon icon={LucideBotMessageSquare} />}
loading={isAIGenerating}
onClick={() => {
triggerAIMessage({ parentId: messageId });
}}
>
{t('aiSummary')}
{t('actions.genAiMessage')}
</Button>
<ActionIcon
icon={LucideNotepadText}
loading={isAIGenerating}
onClick={() => {
if (!messageId) return;

summaryPluginContent(messageId);
}}
title={'actions.summaryTooltip'}
/>
</Flexbox>
);
};
Expand Down
Loading

0 comments on commit 53fb292

Please sign in to comment.