Skip to content

Commit

Permalink
✨ feat: using YJS and WebRTC to support sync data between different d…
Browse files Browse the repository at this point in the history
…evices (lobehub#1525)

* ✨ feat: support sync with webrtc

* 🎨 chore: improve code

* 🎨 chore: improve code

* 🐛 fix: fix dont sync when a node enter first

* ✨ feat: support webrtc config settings

* ✨ feat: add device info card

* ✨ feat: finish sync settings

* ✨ feat: finish sync settings page

* ♻️ refactor: refactor the db to support yjs sync

* 🐛 fix: disconnect when user disable sync

* ♻️ refactor: refactor the console with debug

* 🚸 style: add experiment feature tag

* 📱 style: fix with mobile

* 🌐 chore: add i18n

* 💄 style: improve random name action

* 🚸 style: add default Device Name

* 🚸 style: add mobile experiment tag

* 🚨 ci: fix lint
  • Loading branch information
arvinxx authored and jjcruise committed Mar 26, 2024
1 parent 9863536 commit 23bb631
Show file tree
Hide file tree
Showing 101 changed files with 3,417 additions and 226 deletions.
40 changes: 34 additions & 6 deletions locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@
},
"about": "حول",
"advanceSettings": "إعدادات متقدمة",
"agentMaxToken": "أقصى طول للجلسة",
"agentModel": "النموذج",
"agentProfile": "ملف المساعد",
"appInitializing": "جاري تهيئة LobeChat، يرجى الانتظار ...",
"archive": "أرشيف",
"autoGenerate": "توليد تلقائي",
"autoGenerateTooltip": "إكمال تلقائي بناءً على الكلمات المقترحة لوصف المساعد",
"cancel": "إلغاء",
"changelog": "سجل التغييرات",
"close": "إغلاق",
"confirmRemoveSessionItemAlert": "سيتم حذف هذا المساعد قريبًا، وبمجرد الحذف لن يمكن استعادته، يرجى تأكيد الإجراء",
"copy": "نسخ",
"copyFail": "فشل في النسخ",
"copySuccess": "تم النسخ بنجاح",
Expand Down Expand Up @@ -128,6 +123,39 @@
"setting": "الإعدادات",
"share": "مشاركة",
"stop": "إيقاف",
"sync": {
"actions": {
"settings": "إعدادات المزامنة",
"sync": "مزامنة فورية"
},
"awareness": {
"current": "الجهاز الحالي"
},
"channel": "القناة",
"disabled": {
"actions": {
"enable": "تمكين المزامنة السحابية",
"settings": "تكوين معلمات المزامنة"
},
"desc": "بيانات الجلسة الحالية تُخزن فقط في هذا المتصفح. إذا كنت بحاجة إلى مزامنة البيانات بين عدة أجهزة، يرجى تكوين وتمكين المزامنة السحابية.",
"title": "لم يتم تشغيل مزامنة البيانات"
},
"enabled": {
"title": "مزامنة البيانات"
},
"status": {
"connecting": "جار الاتصال",
"disabled": "مزامنة غير مفعلة",
"ready": "متصل",
"synced": "تمت المزامنة",
"syncing": "جار المزامنة",
"unconnected": "فشل الاتصال"
},
"title": "حالة المزامنة",
"unconnected": {
"tip": "فشل اتصال خادم الإشارة، لن يتمكن من إنشاء قناة اتصال نقطية، يرجى التحقق من الشبكة وإعادة المحاولة"
}
},
"tab": {
"chat": "الدردشة",
"market": "الاكتشاف",
Expand All @@ -147,4 +175,4 @@
"hasNew": "يوجد تحديث متاح",
"newVersion": "هناك إصدار جديد متاح: {{version}}"
}
}
}
36 changes: 36 additions & 0 deletions locales/ar/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,47 @@
"placeholder": "الرجاء إدخال معرف المساعد، يجب أن يكون فريدًا، مثل تطوير الويب",
"tooltips": "مشاركة في سوق المساعدين"
},
"sync": {
"device": {
"deviceName": {
"hint": "أضف اسمًا للتعرف بشكل أفضل",
"placeholder": "الرجاء إدخال اسم الجهاز",
"title": "اسم الجهاز"
},
"title": "معلومات الجهاز",
"unknownBrowser": "متصفح غير معروف",
"unknownOS": "نظام التشغيل غير معروف"
},
"warning": {
"message": "هذه الميزة لا تزال تحت التجربة وقد تكون هناك حالات غير متوقعة أو غير مستقرة، في حال واجهت مشكلة، يرجى تقديم ردود فعل في الوقت المناسب."
},
"webrtc": {
"channelName": {
"desc": "سيستخدم WebRTC هذا الاسم لإنشاء قناة مزامنة، يرجى التأكد من فرادة اسم القناة",
"placeholder": "الرجاء إدخال اسم قناة المزامنة",
"shuffle": "توليف عشوائي",
"title": "اسم قناة المزامنة"
},
"channelPassword": {
"desc": "إضافة كلمة مرور لضمان خصوصية القناة، يمكن للأجهزة الانضمام إلى القناة فقط عند إدخال كلمة المرور الصحيحة",
"placeholder": "الرجاء إدخال كلمة مرور قناة المزامنة",
"title": "كلمة مرور قناة المزامنة"
},
"desc": "اتصال البيانات النقطي الفوري يتطلب تواجد الأجهزة معًا للمزامنة",
"enabled": {
"invalid": "الرجاء إدخال اسم قناة المزامنة قبل تشغيلها",
"title": "تمكين المزامنة"
},
"title": "WebRTC مزامنة"
}
},
"tab": {
"about": "حول",
"agent": "المساعد الافتراضي",
"common": "إعدادات عامة",
"experiment": "تجربة",
"llm": "نموذج اللغة",
"sync": "مزامنة السحابة",
"tts": "خدمة الكلام"
},
"tools": {
Expand Down
40 changes: 34 additions & 6 deletions locales/de-DE/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@
},
"about": "Über",
"advanceSettings": "Erweiterte Einstellungen",
"agentMaxToken": "Maximale Sitzungslänge",
"agentModel": "Modell",
"agentProfile": "Assistentenprofil",
"appInitializing": "LobeChat wird initialisiert. Bitte haben Sie einen Moment Geduld...",
"archive": "Archiv",
"autoGenerate": "Automatisch generieren",
"autoGenerateTooltip": "Assistentenbeschreibung automatisch auf Basis von Vorschlägen vervollständigen",
"cancel": "Abbrechen",
"changelog": "Änderungsprotokoll",
"close": "Schließen",
"confirmRemoveSessionItemAlert": "Möchten Sie diesen Assistenten wirklich löschen? Nach dem Löschen kann er nicht wiederhergestellt werden. Bitte bestätigen Sie Ihre Aktion.",
"copy": "Kopieren",
"copyFail": "Kopieren fehlgeschlagen",
"copySuccess": "Kopieren erfolgreich",
Expand Down Expand Up @@ -128,6 +123,39 @@
"setting": "Einstellung",
"share": "Teilen",
"stop": "Stoppen",
"sync": {
"actions": {
"settings": "同步设置",
"sync": "立即同步"
},
"awareness": {
"current": "当前设备"
},
"channel": "频道",
"disabled": {
"actions": {
"enable": "开启云端同步",
"settings": "配置同步参数"
},
"desc": "当前会话数据仅存储于此浏览器中。如果你需要在多个设备间同步数据,请配置并开启云端同步。",
"title": "数据同步未开启"
},
"enabled": {
"title": "数据同步"
},
"status": {
"connecting": "连接中",
"disabled": "同步未开启",
"ready": "已连接",
"synced": "已同步",
"syncing": "同步中",
"unconnected": "连接失败"
},
"title": "同步状态",
"unconnected": {
"tip": "信令服务器连接失败,将无法建立点对点通信频道,请检查网络后重试"
}
},
"tab": {
"chat": "Chat",
"market": "Entdecken",
Expand All @@ -147,4 +175,4 @@
"hasNew": "Neue Version verfügbar",
"newVersion": "Neue Version verfügbar: {{version}}"
}
}
}
36 changes: 36 additions & 0 deletions locales/de-DE/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,47 @@
"placeholder": "Geben Sie die Kennung des Assistenten ein, die eindeutig sein muss, z. B. Web-Entwicklung",
"tooltips": "Auf dem Assistentenmarkt teilen"
},
"sync": {
"device": {
"deviceName": {
"hint": "Fügen Sie einen Namen hinzu, um das Gerät zu identifizieren",
"placeholder": "Geben Sie den Gerätenamen ein",
"title": "Gerätename"
},
"title": "Geräteinformationen",
"unknownBrowser": "Unbekannter Browser",
"unknownOS": "Unbekanntes Betriebssystem"
},
"warning": {
"message": "Diese Funktion ist derzeit experimentell und kann unerwartete oder instabile Situationen aufweisen. Bitte geben Sie bei Problemen rechtzeitig Feedback ab."
},
"webrtc": {
"channelName": {
"desc": "WebRTC verwendet diesen Namen, um einen Synchronisierungskanal zu erstellen. Stellen Sie sicher, dass der Kanalname eindeutig ist",
"placeholder": "Geben Sie den Synchronisierungskanalnamen ein",
"shuffle": "Zufällige Generierung",
"title": "Synchronisierungskanalname"
},
"channelPassword": {
"desc": "Fügen Sie ein Passwort hinzu, um die Vertraulichkeit des Kanals zu gewährleisten. Nur wenn das Passwort korrekt ist, kann das Gerät dem Kanal beitreten",
"placeholder": "Geben Sie das Synchronisierungskennwort ein",
"title": "Synchronisierungskennwort"
},
"desc": "Echtzeit, Punkt-zu-Punkt-Datenkommunikation, bei der die Geräte gleichzeitig online sein müssen, um synchronisiert zu werden",
"enabled": {
"invalid": "Bitte geben Sie zuerst den Synchronisierungskanalnamen ein, bevor Sie die Synchronisierung aktivieren",
"title": "Synchronisierung aktivieren"
},
"title": "WebRTC-Synchronisierung"
}
},
"tab": {
"about": "Über",
"agent": "Standard-Assistent",
"common": "Allgemeine Einstellungen",
"experiment": "Experiment",
"llm": "Sprachmodell",
"sync": "Cloud-Synchronisierung",
"tts": "Sprachdienste"
},
"tools": {
Expand Down
40 changes: 34 additions & 6 deletions locales/en-US/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@
},
"about": "About",
"advanceSettings": "Advanced Settings",
"agentMaxToken": "Max Session Length",
"agentModel": "Model",
"agentProfile": "Agent Profile",
"appInitializing": "LobeChat is initializing, please wait...",
"archive": "Archive",
"autoGenerate": "Auto Generate",
"autoGenerateTooltip": "Auto-generate agent description based on prompts",
"cancel": "Cancel",
"changelog": "Changelog",
"close": "Close",
"confirmRemoveSessionItemAlert": "You are about to delete this agent. Once deleted, it cannot be recovered. Please confirm your action.",
"copy": "Copy",
"copyFail": "Copy failed",
"copySuccess": "Copied successfully",
Expand Down Expand Up @@ -128,6 +123,39 @@
"setting": "Settings",
"share": "Share",
"stop": "Stop",
"sync": {
"actions": {
"settings": "Sync Settings",
"sync": "Sync Now"
},
"awareness": {
"current": "Current Device"
},
"channel": "Channel",
"disabled": {
"actions": {
"enable": "Enable Cloud Sync",
"settings": "Sync Settings"
},
"desc": "Current session data is only stored in this browser. If you need to sync data across multiple devices, please configure and enable cloud sync.",
"title": "Data Sync Disabled"
},
"enabled": {
"title": "Data Sync Enabled"
},
"status": {
"connecting": "Connecting",
"disabled": "Sync Disabled",
"ready": "Connected",
"synced": "Synced",
"syncing": "Syncing",
"unconnected": "Connection Failed"
},
"title": "Sync Status",
"unconnected": {
"tip": "Signaling server connection failed, and peer-to-peer communication channel cannot be established. Please check the network and try again."
}
},
"tab": {
"chat": "Chat",
"market": "Discover",
Expand All @@ -147,4 +175,4 @@
"hasNew": "New update available",
"newVersion": "New version available: {{version}}"
}
}
}
36 changes: 36 additions & 0 deletions locales/en-US/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,47 @@
"placeholder": "Enter a unique identifier for the agent, e.g. web-development",
"tooltips": "Share to the agent marketplace"
},
"sync": {
"device": {
"deviceName": {
"hint": "Add a name for easy identification",
"placeholder": "Enter device name",
"title": "Device Name"
},
"title": "Device Information",
"unknownBrowser": "Unknown Browser",
"unknownOS": "Unknown OS"
},
"warning": {
"message": "This feature is currently experimental and may have unexpected or unstable behavior. If you encounter any issues, please submit feedback promptly."
},
"webrtc": {
"channelName": {
"desc": "WebRTC will use this name to create a sync channel. Ensure the channel name is unique.",
"placeholder": "Enter sync channel name",
"shuffle": "Generate Randomly",
"title": "Sync Channel Name"
},
"channelPassword": {
"desc": "Add a password to ensure channel privacy. Only devices with the correct password can join the channel.",
"placeholder": "Enter sync channel password",
"title": "Sync Channel Password"
},
"desc": "Real-time, peer-to-peer data communication requires all devices to be online for synchronization.",
"enabled": {
"invalid": "Please enter a sync channel name before enabling",
"title": "Enable Sync"
},
"title": "WebRTC Sync"
}
},
"tab": {
"about": "About",
"agent": "Default Agent",
"common": "Common Settings",
"experiment": "Experiment",
"llm": "Language Model",
"sync": "Cloud Sync",
"tts": "Text-to-Speech"
},
"tools": {
Expand Down
Loading

0 comments on commit 23bb631

Please sign in to comment.