Skip to content

Commit

Permalink
✨ feat: support compress history messages (#4639)
Browse files Browse the repository at this point in the history
* ✨ feat: implement support summary history messages

* 💄 style: add history ui

* 💄 style: add history ui

* update

* ✨ feat: support summary history

* ✨ feat: support summary history

* 🚨 ci: fix type

* ♻️ refactor: refactor migration

* ✅ test: fix tests

* 📸 test: update snapshots

* ✅ test: add test for chatMessage

* ♻️ refactor: refactor the chat actions and add tests

* ✅ test: add test for summaryHistory chain

* ♻️ refactor: set history default 8

* 🌐 chore: update i18n

* ✨ feat: support control CompressHistory

* ✅ test: fix tests

* ✅ test: fix tests

* ✅ test: fix tests

* 🌐 chore: update i18n
  • Loading branch information
arvinxx authored Nov 9, 2024
1 parent 85334dc commit 145bbb4
Show file tree
Hide file tree
Showing 85 changed files with 4,218 additions and 242 deletions.
1 change: 1 addition & 0 deletions locales/ar/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "رسائل المحادثة",
"historySummary": "ملخص التاريخ",
"rest": "المتبقي",
"systemRole": "تعيين الدور",
"title": "تفاصيل الرمز",
Expand Down
9 changes: 7 additions & 2 deletions locales/ar/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "هل يجب إنشاء موضوع تلقائيًا أثناء الدردشة، يسري ذلك فقط في المواضيع المؤقتة",
"title": "تمكين إنشاء الموضوع تلقائيًا"
},
"enableCompressThreshold": {
"title": "هل تريد تمكين عتبة ضغط طول الرسائل التاريخية"
"enableCompressHistory": {
"title": "تفعيل تلخيص الرسائل التاريخية تلقائيًا"
},
"enableHistoryCount": {
"alias": "غير محدود",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "أدخل كلمة الموجه المخصصة",
"title": "كلمة الموجه المخصصة"
},
"historyCompress": {
"label": "نموذج تاريخ المحادثة",
"modelDesc": "حدد النموذج المستخدم لضغط تاريخ المحادثة",
"title": "تلخيص تلقائي لتاريخ المحادثة"
},
"queryRewrite": {
"label": "نموذج إعادة صياغة الأسئلة",
"modelDesc": "نموذج مخصص لتحسين أسئلة المستخدمين",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Чат съобщения",
"historySummary": "Историческо резюме",
"rest": "Оставащи",
"systemRole": "Настройки на ролята",
"title": "Детайли на токена",
Expand Down
9 changes: 7 additions & 2 deletions locales/bg-BG/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Дали да се създава автоматично тема по време на разговора, ефективно само във временни теми",
"title": "Автоматично създаване на тема"
},
"enableCompressThreshold": {
"title": "Активиране на прага на компресия на дължината на съобщенията в историята"
"enableCompressHistory": {
"title": "Активиране на автоматично обобщаване на историята на съобщенията"
},
"enableHistoryCount": {
"alias": "Неограничен",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Моля, въведете персонализирана подканва",
"title": "Персонализирана подканва"
},
"historyCompress": {
"label": "Модел на история на сесията",
"modelDesc": "Определете модела, използван за компресиране на историята на сесията",
"title": "Автоматично обобщаване на историята на сесията"
},
"queryRewrite": {
"label": "Модел за пренаписване на запитвания",
"modelDesc": "Определя модел за оптимизиране на запитванията на потребителите",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Chats",
"historySummary": "Historische Zusammenfassung",
"rest": "Verbleibend",
"systemRole": "Systemrolle",
"title": "Kontextdetails",
Expand Down
9 changes: 7 additions & 2 deletions locales/de-DE/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Automatische Erstellung eines Themas während des Gesprächs, nur in temporären Themen aktiv",
"title": "Automatische Themen-Erstellung aktivieren"
},
"enableCompressThreshold": {
"title": "Aktivieren der Komprimierungsschwelle für Historienlänge"
"enableCompressHistory": {
"title": "Automatische Zusammenfassung der Verlaufnachrichten aktivieren"
},
"enableHistoryCount": {
"alias": "Unbegrenzt",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Bitte benutzerdefinierte Eingabe eingeben",
"title": "Benutzerdefinierte Eingabe"
},
"historyCompress": {
"label": "Gesprächshistorienmodell",
"modelDesc": "Das Modell, das zur Komprimierung der Gesprächshistorie verwendet wird",
"title": "Automatische Zusammenfassung der Gesprächshistorie"
},
"queryRewrite": {
"label": "Fragenumformulierung Modell",
"modelDesc": "Modell zur Optimierung der Benutzeranfragen",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Chat Messages",
"historySummary": "History Summary",
"rest": "Remaining",
"systemRole": "Role Settings",
"title": "Context Details",
Expand Down
9 changes: 7 additions & 2 deletions locales/en-US/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Whether to automatically create a topic during the conversation, only effective in temporary topics",
"title": "Auto Create Topic"
},
"enableCompressThreshold": {
"title": "Enable History Message Length Compression Threshold"
"enableCompressHistory": {
"title": "Enable Automatic Summary of Chat History"
},
"enableHistoryCount": {
"alias": "Unlimited",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Please enter custom prompt",
"title": "Custom Prompt"
},
"historyCompress": {
"label": "Conversation History Model",
"modelDesc": "Specify the model used to compress conversation history",
"title": "Automatically Summarize Conversation History"
},
"queryRewrite": {
"label": "Question Rewriting Model",
"modelDesc": "Specify the model used to optimize user inquiries",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Mensajes de chat",
"historySummary": "Resumen histórico",
"rest": "Restante",
"systemRole": "Rol del sistema",
"title": "Detalles del token",
Expand Down
9 changes: 7 additions & 2 deletions locales/es-ES/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Indica si se debe crear automáticamente un tema durante la conversación, solo se aplica en temas temporales",
"title": "Crear tema automáticamente"
},
"enableCompressThreshold": {
"title": "Activar umbral de compresión de longitud de mensajes históricos"
"enableCompressHistory": {
"title": "Activar resumen automático de mensajes históricos"
},
"enableHistoryCount": {
"alias": "Sin límite",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Introduce la palabra clave personalizada",
"title": "Palabra clave personalizada"
},
"historyCompress": {
"label": "Modelo de historial de conversación",
"modelDesc": "Especifica el modelo utilizado para comprimir el historial de conversación",
"title": "Resumen automático del historial de conversación"
},
"queryRewrite": {
"label": "Modelo de reescritura de preguntas",
"modelDesc": "Modelo designado para optimizar las preguntas de los usuarios",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "پیام‌های گفتگو",
"historySummary": "خلاصه تاریخ",
"rest": "باقی‌مانده قابل استفاده",
"systemRole": "تنظیم نقش",
"title": "جزئیات پیام‌ها",
Expand Down
9 changes: 7 additions & 2 deletions locales/fa-IR/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "آیا در طول مکالمه به‌طور خودکار موضوع ایجاد شود، فقط در موضوعات موقت اعمال می‌شود",
"title": "ایجاد خودکار موضوع"
},
"enableCompressThreshold": {
"title": "آیا آستانه فشرده‌سازی طول پیام‌های تاریخی فعال شود"
"enableCompressHistory": {
"title": "فعال‌سازی خلاصه‌سازی خودکار تاریخچه پیام‌ها"
},
"enableHistoryCount": {
"alias": "بدون محدودیت",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "لطفاً اعلان سفارشی خود را وارد کنید",
"title": "اعلان سفارشی"
},
"historyCompress": {
"label": "مدل تاریخچه گفتگو",
"modelDesc": "مدلی که برای فشرده‌سازی تاریخچه گفتگو استفاده می‌شود",
"title": "خلاصه‌سازی خودکار تاریخچه گفتگو"
},
"queryRewrite": {
"label": "مدل بازنویسی پرسش",
"modelDesc": "مدلی که برای بهینه‌سازی پرسش‌های کاربران استفاده می‌شود",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Messages de discussion",
"historySummary": "Résumé historique",
"rest": "Restant disponible",
"systemRole": "Rôle système",
"title": "Détails du jeton",
Expand Down
9 changes: 7 additions & 2 deletions locales/fr-FR/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Activer la création automatique de sujets pendant la conversation, uniquement valable pour les sujets temporaires",
"title": "Activer la création automatique de sujets"
},
"enableCompressThreshold": {
"title": "Activer le seuil de compression de la longueur des messages"
"enableCompressHistory": {
"title": "Activer le résumé automatique des messages historiques"
},
"enableHistoryCount": {
"alias": "Illimité",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Veuillez entrer le mot-clé personnalisé",
"title": "Mot-clé personnalisé"
},
"historyCompress": {
"label": "Modèle d'historique de conversation",
"modelDesc": "Modèle utilisé pour compresser l'historique des conversations",
"title": "Résumé automatique de l'historique des conversations"
},
"queryRewrite": {
"label": "Modèle de reformulation des questions",
"modelDesc": "Modèle utilisé pour optimiser les questions des utilisateurs",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Chat",
"historySummary": "Riepilogo storico",
"rest": "Rimanenti",
"systemRole": "Ruolo di sistema",
"title": "Dettagli del Token",
Expand Down
9 changes: 7 additions & 2 deletions locales/it-IT/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Se creare automaticamente un argomento durante la conversazione, valido solo per le conversazioni temporanee",
"title": "Abilita la creazione automatica di argomenti"
},
"enableCompressThreshold": {
"title": "Abilita la soglia di compressione della lunghezza dei messaggi storici"
"enableCompressHistory": {
"title": "Attiva il riassunto automatico della cronologia dei messaggi"
},
"enableHistoryCount": {
"alias": "Illimitato",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Inserisci il suggerimento personalizzato",
"title": "Suggerimento personalizzato"
},
"historyCompress": {
"label": "Modello di storia delle conversazioni",
"modelDesc": "Specifica il modello utilizzato per comprimere la storia delle conversazioni",
"title": "Riepilogo automatico della storia delle conversazioni"
},
"queryRewrite": {
"label": "Modello di riscrittura delle domande",
"modelDesc": "Modello specificato per ottimizzare le domande degli utenti",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "チャットメッセージ",
"historySummary": "履歴の要約",
"rest": "残り利用可能",
"systemRole": "システムロール設定",
"title": "コンテキストの詳細",
Expand Down
9 changes: 7 additions & 2 deletions locales/ja-JP/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "会話中に自動的にトピックを作成するかどうか。一時的なトピックのみ有効です",
"title": "自動的にトピックを作成する"
},
"enableCompressThreshold": {
"title": "過去メッセージの長さの圧縮閾値を有効にする"
"enableCompressHistory": {
"title": "履歴メッセージの自動要約を有効にする"
},
"enableHistoryCount": {
"alias": "制限なし",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "カスタムプロンプトを入力してください",
"title": "カスタムプロンプト"
},
"historyCompress": {
"label": "会話履歴モデル",
"modelDesc": "会話履歴を圧縮するために指定されたモデル",
"title": "会話履歴の自動要約"
},
"queryRewrite": {
"label": "質問リライトモデル",
"modelDesc": "ユーザーの質問を最適化するために指定されたモデル",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "채팅 메시지",
"historySummary": "역사 요약",
"rest": "남은 사용량",
"systemRole": "시스템 역할",
"title": "컨텍스트 세부 정보",
Expand Down
9 changes: 7 additions & 2 deletions locales/ko-KR/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "대화 중에 자동으로 주제를 만들지 여부를 설정합니다. 일시적인 주제에서만 작동합니다",
"title": "자동 주제 생성 활성화"
},
"enableCompressThreshold": {
"title": "이전 메시지 길이 압축 임계값 활성화"
"enableCompressHistory": {
"title": "역사 메시지 자동 요약 활성화"
},
"enableHistoryCount": {
"alias": "제한 없음",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "사용자 정의 프롬프트 입력",
"title": "사용자 정의 프롬프트"
},
"historyCompress": {
"label": "대화 기록 모델",
"modelDesc": "대화 기록 압축에 사용되는 모델을 지정합니다",
"title": "대화 기록 자동 요약"
},
"queryRewrite": {
"label": "질문 재작성 모델",
"modelDesc": "사용자의 질문을 최적화하는 데 사용되는 모델 지정",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Chats",
"historySummary": "Geschiedenis samenvatting",
"rest": "Rust",
"systemRole": "Systeemrol",
"title": "Contextuele details",
Expand Down
9 changes: 7 additions & 2 deletions locales/nl-NL/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Automatisch een onderwerp maken tijdens het gesprek, alleen van toepassing op tijdelijke onderwerpen",
"title": "Automatisch onderwerp maken"
},
"enableCompressThreshold": {
"title": "Compressiedrempel voor berichtlengte inschakelen"
"enableCompressHistory": {
"title": "Automatisch samenvatten van historische berichten inschakelen"
},
"enableHistoryCount": {
"alias": "Onbeperkt",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Voer aangepaste prompt in",
"title": "Aangepaste prompt"
},
"historyCompress": {
"label": "Gespreksgeschiedenismodel",
"modelDesc": "Specificeer het model dat wordt gebruikt voor het comprimeren van gespreksgeschiedenis",
"title": "Automatisch samenvatten van gespreksgeschiedenis"
},
"queryRewrite": {
"label": "Vraag herschrijvingsmodel",
"modelDesc": "Model dat is opgegeven voor het optimaliseren van gebruikersvragen",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Rozmowy",
"historySummary": "Podsumowanie historii",
"rest": "Pozostałe",
"systemRole": "Rola systemowa",
"title": "Szczegóły tokena",
Expand Down
9 changes: 7 additions & 2 deletions locales/pl-PL/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"desc": "Automatyczne tworzenie tematu podczas rozmowy, działa tylko w przypadku tymczasowych tematów",
"title": "Automatyczne tworzenie tematu"
},
"enableCompressThreshold": {
"title": "Włącz próg kompresji historii"
"enableCompressHistory": {
"title": "Włącz automatyczne podsumowywanie historii wiadomości"
},
"enableHistoryCount": {
"alias": "Bez limitu",
Expand Down Expand Up @@ -378,6 +378,11 @@
"placeholder": "Wprowadź niestandardowe słowo podpowiedzi",
"title": "Niestandardowe słowo podpowiedzi"
},
"historyCompress": {
"label": "Model historii rozmów",
"modelDesc": "Model używany do kompresji historii rozmów",
"title": "Automatyczne podsumowanie historii rozmów"
},
"queryRewrite": {
"label": "Model przekształcania zapytań",
"modelDesc": "Model używany do optymalizacji zapytań użytkowników",
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 @@ -123,6 +123,7 @@
},
"tokenDetails": {
"chats": "Mensagens de bate-papo",
"historySummary": "Resumo Histórico",
"rest": "Restante disponível",
"systemRole": "Configuração de papel do sistema",
"title": "Detalhes do Token",
Expand Down
Loading

0 comments on commit 145bbb4

Please sign in to comment.