Skip to content

Commit

Permalink
(fix:locales) sync conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
ManishMadan2882 committed Jan 7, 2025
1 parent fa10812 commit d198196
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 17 deletions.
36 changes: 23 additions & 13 deletions frontend/src/conversation/ConversationBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism';
import rehypeKatex from 'rehype-katex';
import remarkGfm from 'remark-gfm';
import remarkMath from 'remark-math';
import { useTranslation } from 'react-i18next';

import DocsGPT3 from '../assets/cute_docsgpt3.svg';
import Dislike from '../assets/dislike.svg?react';
Expand Down Expand Up @@ -62,6 +63,7 @@ const ConversationBubble = forwardRef<
},
ref,
) {
const { t } = useTranslation();
// const bubbleRef = useRef<HTMLDivElement | null>(null);
const chunks = useSelector(selectChunks);
const selectedDocs = useSelector(selectSelectedDocs);
Expand Down Expand Up @@ -113,13 +115,13 @@ const ConversationBubble = forwardRef<
{isEditClicked && (
<div ref={editableQueryRef} className="w-[75%] flex flex-col">
<textarea
placeholder="Type the updated query..."
placeholder={t('conversation.edit.placeholder')}
onChange={(e) => {
setEditInputBox(e.target.value);
}}
rows={1}
value={editInputBox}
className="ml-2 mr-12 text-[15px] resize-y h-12 min-h-max rounded-3xl p-3 no-scrollbar leading-relaxed dark:border-[0.5px] dark:border-white dark:bg-raisin-black dark:text-white px-[18px] border-[1.5px] border-black"
className="ml-2 mr-12 text-[15px] resize-y h-12 min-h-max rounded-3xl p-3 no-scrollbar leading-relaxed dark:border-[0.5px] dark:border-white dark:bg-raisin-black dark:text-white px-[18px] border-[1.5px] border-black"
/>
<div
className={`flex flex-row-reverse justify-end gap-1 mt-3 text-sm font-medium`}
Expand Down Expand Up @@ -185,12 +187,14 @@ const ConversationBubble = forwardRef<
avatar={
<img
src={Sources}
alt="Sources"
alt={t('conversation.sources.title')}
className="h-full w-full object-fill"
/>
}
/>
<p className="text-base font-semibold">Sources</p>
<p className="text-base font-semibold">
{t('conversation.sources.title')}
</p>
</div>
<div className="grid grid-cols-2 gap-2 lg:grid-cols-4">
{Array.from({ length: 4 }).map((_, index) => (
Expand All @@ -217,12 +221,14 @@ const ConversationBubble = forwardRef<
avatar={
<img
src={Sources}
alt="Sources"
alt={t('conversation.sources.title')}
className="h-full w-full object-fill"
/>
}
/>
<p className="text-base font-semibold">Sources</p>
<p className="text-base font-semibold">
{t('conversation.sources.title')}
</p>
</div>
<div className="fade-in ml-3 mr-5 max-w-[90vw] md:max-w-[70vw] lg:max-w-[50vw]">
<div className="grid grid-cols-2 gap-2 lg:grid-cols-4">
Expand Down Expand Up @@ -289,9 +295,11 @@ const ConversationBubble = forwardRef<
className="flex h-28 cursor-pointer flex-col-reverse rounded-[20px] bg-gray-1000 p-4 text-purple-30 hover:bg-[#F1F1F1] hover:text-[#6D3ECC] dark:bg-gun-metal dark:hover:bg-[#2C2E3C] dark:hover:text-[#8C67D7]"
onClick={() => setIsSidebarOpen(true)}
>
<p className="ellipsis-text h-22 text-xs">{`View ${
sources?.length ? sources.length - 3 : 0
} more`}</p>
<p className="ellipsis-text h-22 text-xs">
{t('conversation.sources.view_more', {
count: sources?.length ? sources.length - 3 : 0,
})}
</p>
</div>
)}
</div>
Expand All @@ -306,12 +314,14 @@ const ConversationBubble = forwardRef<
avatar={
<img
src={DocsGPT3}
alt="DocsGPT"
alt={t('conversation.answer')}
className="h-full w-full object-cover"
/>
}
/>
<p className="text-base font-semibold">Answer</p>
<p className="text-base font-semibold">
{t('conversation.answer')}
</p>
</div>
<div
className={`fade-in-bubble ml-2 mr-5 flex max-w-[90vw] rounded-[28px] bg-gray-1000 py-[14px] px-7 dark:bg-gun-metal md:max-w-[70vw] lg:max-w-[50vw] ${
Expand Down Expand Up @@ -419,7 +429,7 @@ const ConversationBubble = forwardRef<
${type !== 'ERROR' ? 'group-hover:lg:visible' : 'hidden'}`}
>
<div>
<SpeakButton text={message} /> {/* Add SpeakButton here */}
<SpeakButton text={message} />
</div>
</div>
{type === 'ERROR' && (
Expand Down Expand Up @@ -557,7 +567,7 @@ function AllSources(sources: AllSourcesProps) {
{source.source && source.source !== 'local' ? (
<img
src={Link}
alt="Link"
alt={'Link'}
className="h-3 w-3 cursor-pointer object-fill"
onClick={() =>
window.open(source.source, '_blank', 'noopener, noreferrer')
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,21 @@
"delete": "Delete",
"rename": "Rename",
"deleteWarning": "Are you sure you want to delete this conversation?"
},
"conversation": {
"copy": "Copy",
"copied": "Copied",
"speak": "Speak",
"answer": "Answer",
"edit": {
"placeholder": "Type the updated query..."
},
"sources": {
"title": "Sources",
"text": "Source Text",
"link": "Source Link",
"view_more": "{{count}} more sources"
},
"retry": "Retry"
}
}
34 changes: 33 additions & 1 deletion frontend/src/locale/jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@
"date": "ベクトル日付",
"type": "タイプ",
"tokenUsage": "トークン使用量",
"noData": "既存のドキュメントはありません"
"noData": "既存のドキュメントはありません",
"searchPlaceholder": "検索...",
"addNew": "新規追加",
"addNewTitle": "新規ドキュメントを追加",
"preLoaded": "プリロード済み",
"private": "プライベート",
"sync": "同期",
"syncFrequency": {
"never": "なし",
"daily": "毎日",
"weekly": "毎週",
"monthly": "��月"
}
},
"apiKeys": {
"label": "チャットボット",
Expand Down Expand Up @@ -148,5 +160,25 @@
"delete": "削除",
"rename": "名前変更",
"deleteWarning": "この会話を削除してもよろしいですか?"
},
"conversation": {
"copy": "コピー",
"copied": "コピーしました",
"speak": "スピーク",
"feedback": {
"like": "いいね",
"dislike": "よくない"
},
"answer": "回答",
"edit": {
"placeholder": "更新されたクエリを入力してください..."
},
"sources": {
"title": "ソース",
"text": "ソーステキスト",
"link": "ソースリンク",
"view_more": "さらに{{count}}個のソース"
},
"retry": "再試行"
}
}
2 changes: 1 addition & 1 deletion frontend/src/locale/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"filterByChatbot": "按聊天機器人篩選",
"none": "",
"selectChatbotPlaceholder": "選擇聊天機器人",
"apiGeneratedConversations": "API生成/聊天機器人對話"
"apiGeneratedConversations": "API生成/聊天機器人對話"
},
"tools": {
"label": "工具"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export default function Settings() {
case 'Widgets':
return (
<Widgets
widgetScreenshot={widgetScreenshot} // Add this line
onWidgetScreenshotChange={updateWidgetScreenshot} // Add this line
widgetScreenshot={widgetScreenshot}
onWidgetScreenshotChange={updateWidgetScreenshot}
/>
);
case t('settings.apiKeys.label'):
Expand Down

0 comments on commit d198196

Please sign in to comment.