Skip to content

Commit

Permalink
💄 style: add switch portal thread (lobehub#4819)
Browse files Browse the repository at this point in the history
* 💄 style: improve i18n

* 💄 style: add switch portal thread

* style: improve i18n
  • Loading branch information
arvinxx authored Nov 27, 2024
1 parent b409379 commit 8dbf3ce
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 7 deletions.
1 change: 1 addition & 0 deletions locales/ar/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} نسخة",
"emptyAgent": "لا يوجد مساعد",
"historyRange": "نطاق التاريخ",
"historySummary": "ملخص الرسائل التاريخية",
"inbox": {
"desc": "قم بتشغيل مجموعة الدماغ وأشعل شرارة التفكير. مساعدك الذكي، هنا حيث يمكنك التواصل بكل شيء",
"title": "دردشة عشوائية"
Expand Down
1 change: 1 addition & 0 deletions locales/bg-BG/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Копие",
"emptyAgent": "Няма наличен асистент",
"historyRange": "Диапазон на историята",
"historySummary": "Исторически обобщение на съобщения",
"inbox": {
"desc": "Активирай мозъчния клъстер и събуди креативното мислене. Твоят виртуален агент е тук, за да общува с теб за всичко.",
"title": "Просто чати"
Expand Down
1 change: 1 addition & 0 deletions locales/de-DE/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Kopie",
"emptyAgent": "Kein Assistent verfügbar",
"historyRange": "Verlaufsbereich",
"historySummary": "Zusammenfassung historischer Nachrichten",
"inbox": {
"desc": "Aktiviere das Gehirncluster und entfache den Funken des Denkens. Dein intelligenter Assistent, der mit dir über alles kommuniziert.",
"title": "Lass uns plaudern"
Expand Down
1 change: 1 addition & 0 deletions locales/en-US/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Copy",
"emptyAgent": "No assistant available",
"historyRange": "History Range",
"historySummary": "Historical Message Summary",
"inbox": {
"desc": "Activate the brain cluster and spark creative thinking. Your virtual assistant is here to communicate with you about everything.",
"title": "Just Chat"
Expand Down
1 change: 1 addition & 0 deletions locales/es-ES/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Copia",
"emptyAgent": "No hay asistente disponible",
"historyRange": "Rango de historial",
"historySummary": "Resumen de mensajes históricos",
"inbox": {
"desc": "Despierta la mente con el poder del cerebro colectivo. Tu asistente inteligente está aquí para conversar contigo sobre cualquier cosa.",
"title": "Charla casual"
Expand Down
1 change: 1 addition & 0 deletions locales/fa-IR/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "نسخه‌ای از {{title}}",
"emptyAgent": "دستیار موجود نیست",
"historyRange": "محدوده تاریخی",
"historySummary": "خلاصه پیام‌های تاریخی",
"inbox": {
"desc": "خوشه‌های مغزی را فعال کنید و جرقه‌های تفکر را برانگیزید. دستیار هوشمند شما اینجاست تا با شما در مورد هر چیزی صحبت کند.",
"title": "گپ دوستانه"
Expand Down
1 change: 1 addition & 0 deletions locales/fr-FR/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Copie",
"emptyAgent": "Aucun assistant disponible",
"historyRange": "Plage d'historique",
"historySummary": "Résumé des messages historiques",
"inbox": {
"desc": "Débloquez le potentiel de votre esprit. Votre agent intelligent est là pour discuter avec vous de tout et de rien.",
"title": "Discutons un peu"
Expand Down
1 change: 1 addition & 0 deletions locales/it-IT/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Copia",
"emptyAgent": "Nessun assistente disponibile",
"historyRange": "Intervallo cronologico",
"historySummary": "Riepilogo della storia",
"inbox": {
"desc": "Attiva il cluster cerebrale, accendi la scintilla del pensiero. Il tuo assistente intelligente, qui per comunicare con te su tutto.",
"title": "Chiacchierata casuale"
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} のコピー",
"emptyAgent": "エージェントがいません",
"historyRange": "履歴範囲",
"historySummary": "履歴メッセージの要約",
"inbox": {
"desc": "脳のクラスターを起動し、創造性を引き出しましょう。あなたのスマートアシスタントは、あなたとすべてのことについてここでコミュニケーションします。",
"title": "気軽におしゃべり"
Expand Down
1 change: 1 addition & 0 deletions locales/ko-KR/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} 복사본",
"emptyAgent": "도우미가 없습니다",
"historyRange": "대화 기록 범위",
"historySummary": "역사 메시지 요약",
"inbox": {
"desc": "뇌 클러스터를 활성화하여 창의적인 아이디어를 끌어내는 인공지능 비서입니다. 여기서 모든 것에 대해 대화합니다.",
"title": "무작위 대화"
Expand Down
1 change: 1 addition & 0 deletions locales/nl-NL/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Kopie",
"emptyAgent": "Geen assistent beschikbaar",
"historyRange": "Geschiedenisbereik",
"historySummary": "Geschiedenis samenvatting",
"inbox": {
"desc": "Activeer de hersencluster en laat de vonken van gedachten overslaan. Je slimme assistent, hier om met je over alles te praten.",
"title": "Praat maar raak"
Expand Down
1 change: 1 addition & 0 deletions locales/pl-PL/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} kopia",
"emptyAgent": "Brak asystenta",
"historyRange": "Zakres historii",
"historySummary": "Podsumowanie wiadomości historycznych",
"inbox": {
"desc": "Włącz klastry mózgów, rozpal iskrę myślenia. Twój inteligentny asystent, gotowy do rozmowy o wszystkim.",
"title": "Pogadajmy sobie"
Expand Down
1 change: 1 addition & 0 deletions locales/pt-BR/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Cópia",
"emptyAgent": "Sem assistente disponível",
"historyRange": "Intervalo de Histórico",
"historySummary": "Resumo das mensagens históricas",
"inbox": {
"desc": "Ative o cluster cerebral, inspire faíscas de pensamento. Seu assistente inteligente, aqui para conversar sobre tudo.",
"title": "Conversa Aleatória"
Expand Down
1 change: 1 addition & 0 deletions locales/ru-RU/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Копия",
"emptyAgent": "Нет ассистента",
"historyRange": "История сообщений",
"historySummary": "Сводка исторических сообщений",
"inbox": {
"desc": "Зажги искру мысли, открой кластер мозгов. Твой виртуальный ассистент, готовый обсудить все с тобой.",
"title": "Просто поболтаем"
Expand Down
1 change: 1 addition & 0 deletions locales/tr-TR/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Kopya",
"emptyAgent": "Asistan yok",
"historyRange": "Geçmiş Aralığı",
"historySummary": "Tarihsel haber özeti",
"inbox": {
"desc": "Beyin fırtınasını başlatın ve yaratıcı düşünmeye başlayın. Sanal asistanınız burada, her konuda sizinle iletişim kurmak için hazır.",
"title": "Sohbet Et"
Expand Down
1 change: 1 addition & 0 deletions locales/vi-VN/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} Bản sao",
"emptyAgent": "Không có trợ lý",
"historyRange": "Phạm vi lịch sử",
"historySummary": "Tóm tắt tin tức lịch sử",
"inbox": {
"desc": "Kích hoạt cụm não, khơi dậy tia lửa tư duy. Trợ lý thông minh của bạn, ở đây để trò chuyện với bạn về mọi thứ.",
"title": "Chuyện phiếm"
Expand Down
1 change: 1 addition & 0 deletions locales/zh-CN/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} 副本",
"emptyAgent": "暂无助手",
"historyRange": "历史范围",
"historySummary": "历史消息总结",
"inbox": {
"desc": "开启大脑集群,激发思维火花。你的智能助理,在这里与你交流一切",
"title": "随便聊聊"
Expand Down
1 change: 1 addition & 0 deletions locales/zh-TW/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"duplicateTitle": "{{title}} 副本",
"emptyAgent": "暫無助手",
"historyRange": "歷史範圍",
"historySummary": "歷史消息總結",
"inbox": {
"desc": "開啟大腦集群,激發思維火花。你的智能助理,在這裡與你交流一切",
"title": "隨便聊聊"
Expand Down
5 changes: 3 additions & 2 deletions src/features/Conversation/components/History/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Typography } from 'antd';
import { createStyles } from 'antd-style';
import { ScrollText } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { Center, Flexbox } from 'react-layout-kit';

import { useChatStore } from '@/store/chat';
Expand All @@ -28,6 +29,7 @@ const useStyles = createStyles(({ css, token }) => ({

const History = memo(() => {
const { styles, theme } = useStyles();
const { t } = useTranslation('chat');
const [content, model] = useChatStore((s) => {
const history = topicSelectors.currentActiveTopicSummary(s);
return [history?.content, history?.model];
Expand All @@ -46,8 +48,7 @@ const History = memo(() => {
style={{ color: theme.colorTextDescription }}
/>
</Center>
<Typography.Text type={'secondary'}>历史消息总结</Typography.Text>

<Typography.Text type={'secondary'}>{t('historySummary')}</Typography.Text>
{model && (
<div>
<ModelTag model={model} />
Expand Down
33 changes: 28 additions & 5 deletions src/features/Portal/Thread/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
import { ActionIcon } from '@lobehub/ui';
import { XIcon } from 'lucide-react';
import { ArrowLeftRight, XIcon } from 'lucide-react';
import { memo } from 'react';
import { Flexbox } from 'react-layout-kit';

import SidebarHeader from '@/components/SidebarHeader';
import { useChatStore } from '@/store/chat';

import Title from './Title';

const Header = () => {
const closeThreadPortal = useChatStore((s) => s.closeThreadPortal);
const Header = memo(() => {
const [hasPortal, portalThreadId, closeThreadPortal, switchThread] = useChatStore((s) => [
!!s.portalThreadId,
s.portalThreadId,
s.closeThreadPortal,
s.switchThread,
]);

return (
<SidebarHeader
actions={<ActionIcon icon={XIcon} onClick={closeThreadPortal} />}
actions={
<Flexbox horizontal>
{hasPortal && (
<ActionIcon
icon={ArrowLeftRight}
onClick={() => {
if (!portalThreadId) return;

switchThread(portalThreadId);
closeThreadPortal();
}}
/>
)}
<ActionIcon icon={XIcon} onClick={closeThreadPortal} />
</Flexbox>
}
style={{ paddingBlock: 8, paddingInline: 8 }}
title={<Title />}
/>
);
};
});

export default Header;
1 change: 1 addition & 0 deletions src/locales/default/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
duplicateTitle: '{{title}} 副本',
emptyAgent: '暂无助手',
historyRange: '历史范围',
historySummary: '历史消息总结',
inbox: {
desc: '开启大脑集群,激发思维火花。你的智能助理,在这里与你交流一切',
title: '随便聊聊',
Expand Down

0 comments on commit 8dbf3ce

Please sign in to comment.