🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix: not use branch topic when this topic is not save (#9083)
Shinji-Lif534d193387e
diff --git a/locales/ar/common.json b/locales/ar/common.jsonindex 80b331232d8..1caa4a33a52 100644--- a/locales/ar/common.json+++ b/locales/ar/common.json@@ -32,6 +32,7 @@"blog": "مدونة المنتجات","branching": "إنشاء موضوع فرعي","branchingDisable": "ميزة \"الموضوع الفرعي\" متاحة فقط في إصدار الخادم. إذا كنت بحاجة إلى هذه الميزة، يرجى التبديل إلى وضع نشر الخادم أو استخدام LobeChat Cloud",+ "branchingRequiresSavedTopic": "الموضوع الحالي غير محفوظ، يجب الحفظ قبل استخدام ميزة الموضوع الفرعي","cancel": "إلغاء","changelog": "سجل التغييرات","clientDB": {diff --git a/locales/bg-BG/common.json b/locales/bg-BG/common.jsonindex 9eabd48195a..fe616e81a85 100644--- a/locales/bg-BG/common.json+++ b/locales/bg-BG/common.json@@ -32,6 +32,7 @@"blog": "Продуктов блог","branching": "Създаване на подтема","branchingDisable": "Функцията „подтема“ е налична само в сървърната версия. Ако искате да използвате тази функция, моля, превключете на режим на сървърно разполагане или използвайте LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Текущата тема не е запазена, моля запазете я, за да използвате функцията за под-теми","cancel": "Отказ","changelog": "Дневник на промените","clientDB": {diff --git a/locales/de-DE/common.json b/locales/de-DE/common.jsonindex 3649beec72c..0d799967aab 100644--- a/locales/de-DE/common.json+++ b/locales/de-DE/common.json@@ -32,6 +32,7 @@"blog": "Produkt-Blog","branching": "Unterthema erstellen","branchingDisable": "Die Funktion „Unterthema“ ist nur in der Serverversion verfügbar. Wenn Sie diese Funktion benötigen, wechseln Sie bitte in den Serverbereitstellungsmodus oder verwenden Sie LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Das aktuelle Thema wurde nicht gespeichert. Speichern Sie es, um die Unterthemenfunktion nutzen zu können.","cancel": "Abbrechen","changelog": "Änderungsprotokoll","clientDB": {diff --git a/locales/en-US/common.json b/locales/en-US/common.jsonindex d5ab4702a83..7eb747af4a7 100644--- a/locales/en-US/common.json+++ b/locales/en-US/common.json@@ -32,6 +32,7 @@"blog": "Product Blog","branching": "Create Subtopic","branchingDisable": "The 'Subtopic' feature is only available in the server version. If you need this feature, please switch to server deployment mode or use LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Current topic is not saved, please save it first to use subtopic feature","cancel": "Cancel","changelog": "Changelog","clientDB": {diff --git a/locales/es-ES/common.json b/locales/es-ES/common.jsonindex 548977d3940..78b8d2839f6 100644--- a/locales/es-ES/common.json+++ b/locales/es-ES/common.json@@ -32,6 +32,7 @@"blog": "Blog de productos","branching": "Crear subtemas","branchingDisable": "La función de «subtemas» solo está disponible en la versión del servidor. Si necesita esta función, cambie al modo de implementación del servidor o utilice LobeChat Cloud.",+ "branchingRequiresSavedTopic": "El tema actual no está guardado, guárdalo para poder usar la función de subtemas","cancel": "Cancelar","changelog": "Registro de cambios","clientDB": {diff --git a/locales/fa-IR/common.json b/locales/fa-IR/common.jsonindex d589d959b5f..a316ec43cc8 100644--- a/locales/fa-IR/common.json+++ b/locales/fa-IR/common.json@@ -32,6 +32,7 @@"blog": "وبلاگ محصولات","branching": "ایجاد زیرموضوع","branchingDisable": "ویژگی «زیرموضوع» تنها در نسخه سرور قابل استفاده است، اگر به این ویژگی نیاز دارید، لطفاً به حالت استقرار سرور تغییر دهید یا از LobeChat Cloud استفاده کنید.",+ "branchingRequiresSavedTopic": "موضوع فعلی ذخیره نشده است، پس از ذخیره میتوانید از قابلیت زیرموضوع استفاده کنید","cancel": "لغو","changelog": "تغییرات","clientDB": {diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.jsonindex 647543c8314..a9e7e1628f5 100644--- a/locales/fr-FR/common.json+++ b/locales/fr-FR/common.json@@ -32,6 +32,7 @@"blog": "Blog des produits","branching": "Créer un sous-sujet","branchingDisable": "La fonction « sous-sujet » n'est disponible que dans la version serveur. Si vous avez besoin de cette fonctionnalité, veuillez passer en mode de déploiement serveur ou utiliser LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Le sujet actuel n'est pas enregistré, veuillez enregistrer avant d'utiliser la fonction de sous-sujet","cancel": "Annuler","changelog": "Journal des modifications","clientDB": {diff --git a/locales/it-IT/common.json b/locales/it-IT/common.jsonindex 36f31aa606e..77d22120a09 100644--- a/locales/it-IT/common.json+++ b/locales/it-IT/common.json@@ -32,6 +32,7 @@"blog": "Blog sui prodotti","branching": "Crea un sottotema","branchingDisable": "La funzione «sottotema» è disponibile solo nella versione server. Se desideri utilizzare questa funzione, passa alla modalità di distribuzione server o utilizza LobeChat Cloud.",+ "branchingRequiresSavedTopic": "L'argomento corrente non è salvato, è necessario salvarlo prima di poter utilizzare la funzione di sottoargomento","cancel": "Annulla","changelog": "Registro modifiche","clientDB": {diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.jsonindex d84833a914b..3f5d477f4a5 100644--- a/locales/ja-JP/common.json+++ b/locales/ja-JP/common.json@@ -32,6 +32,7 @@"blog": "製品ブログ","branching": "サブトピックを作成","branchingDisable": "「サブトピック」機能はサーバー版のみで利用可能です。この機能が必要な場合は、サーバー展開モードに切り替えるか、LobeChat Cloudを使用してください。",+ "branchingRequiresSavedTopic": "現在のトピックが保存されていません。保存後にサブトピック機能を使用できます。","cancel": "キャンセル","changelog": "変更履歴","clientDB": {diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.jsonindex f41f554e347..5cf9398ef23 100644--- a/locales/ko-KR/common.json+++ b/locales/ko-KR/common.json@@ -32,6 +32,7 @@"blog": "제품 블로그","branching": "하위 주제 만들기","branchingDisable": "「하위 주제」 기능은 서버 버전에서만 사용할 수 있습니다. 이 기능이 필요하시면 서버 배포 모드로 전환하거나 LobeChat Cloud를 사용하세요.",+ "branchingRequiresSavedTopic": "현재 주제가 저장되지 않았습니다. 저장한 후에 하위 주제 기능을 사용할 수 있습니다.","cancel": "취소","changelog": "변경 로그","clientDB": {diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.jsonindex 2ac2c75bc4f..6642bab290a 100644--- a/locales/nl-NL/common.json+++ b/locales/nl-NL/common.json@@ -32,6 +32,7 @@"blog": "Product Blog","branching": "Subonderwerp aanmaken","branchingDisable": "De functie 'Subonderwerp' is alleen beschikbaar in de serverversie. Als je deze functie wilt gebruiken, schakel dan over naar de serverimplementatiemodus of gebruik LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Het huidige onderwerp is niet opgeslagen. Sla het op om de subonderwerpfunctie te kunnen gebruiken.","cancel": "Annuleren","changelog": "Wijzigingslogboek","clientDB": {diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.jsonindex 1ba28514e30..bdd8979cd4d 100644--- a/locales/pl-PL/common.json+++ b/locales/pl-PL/common.json@@ -32,6 +32,7 @@"blog": "Blog produktowy","branching": "Utwórz podtemat","branchingDisable": "Funkcja „podtemat” jest dostępna tylko w wersji serwerowej. Aby skorzystać z tej funkcji, przełącz się na tryb wdrożenia serwera lub użyj LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Aktualny temat nie został zapisany, zapisz go, aby móc korzystać z funkcji podtematów","cancel": "Anuluj","changelog": "Dziennik zmian","clientDB": {diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.jsonindex b56d59eb677..46b5e4e23dc 100644--- a/locales/pt-BR/common.json+++ b/locales/pt-BR/common.json@@ -32,6 +32,7 @@"blog": "Blog de Produtos","branching": "Criar subtópico","branchingDisable": "A funcionalidade de \"subtópico\" está disponível apenas na versão do servidor. Se precisar dessa funcionalidade, mude para o modo de implantação no servidor ou use o LobeChat Cloud.",+ "branchingRequiresSavedTopic": "O tópico atual não foi salvo. Salve-o para poder usar a funcionalidade de subtópicos.","cancel": "Cancelar","changelog": "Registro de alterações","clientDB": {diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.jsonindex 2c39346cb79..6b45420004b 100644--- a/locales/ru-RU/common.json+++ b/locales/ru-RU/common.json@@ -32,6 +32,7 @@"blog": "Блог о продуктах","branching": "Создать подтему","branchingDisable": "Функция «Подтема» доступна только в серверной версии. Если вам нужна эта функция, переключитесь на серверный режим развертывания или используйте LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Текущая тема не сохранена, сохраните её, чтобы использовать функцию подтем.","cancel": "Отмена","changelog": "История изменений","clientDB": {diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.jsonindex 76f7c8491cc..c7eb2806420 100644--- a/locales/tr-TR/common.json+++ b/locales/tr-TR/common.json@@ -32,6 +32,7 @@"blog": "Ürün Blogu","branching": "Alt konu oluştur","branchingDisable": "«Alt konu» özelliği yalnızca sunucu sürümünde mevcuttur. Bu özelliği kullanmak için lütfen sunucu dağıtım moduna geçin veya LobeChat Cloud'u kullanın.",+ "branchingRequiresSavedTopic": "Geçerli konu kaydedilmedi, alt konu özelliğini kullanmak için önce kaydedilmelidir","cancel": "İptal","changelog": "Changelog","clientDB": {diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.jsonindex 058119d2592..01f58bea8e6 100644--- a/locales/vi-VN/common.json+++ b/locales/vi-VN/common.json@@ -32,6 +32,7 @@"blog": "Blog sản phẩm","branching": "Tạo chủ đề con","branchingDisable": "Chức năng «Chủ đề con» chỉ có sẵn trong phiên bản máy chủ. Nếu bạn cần chức năng này, hãy chuyển sang chế độ triển khai máy chủ hoặc sử dụng LobeChat Cloud.",+ "branchingRequiresSavedTopic": "Chủ đề hiện tại chưa được lưu, vui lòng lưu trước khi sử dụng chức năng chủ đề con","cancel": "Hủy","changelog": "Nhật ký cập nhật","clientDB": {diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.jsonindex 8b6b7de60c3..4c8f875ec11 100644--- a/locales/zh-CN/common.json+++ b/locales/zh-CN/common.json@@ -32,6 +32,7 @@"blog": "产品博客","branching": "创建子话题","branchingDisable": "「子话题」功能在当前模式下不可用,如需该功能,请切换到 Postgres/Pglite DB 模式或使用 LobeChat Cloud",+ "branchingRequiresSavedTopic": "当前话题未保存,保存后才可以使用子话题能力","cancel": "取消","changelog": "更新日志","clientDB": {diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.jsonindex c34aaecd20a..616afaf5b5c 100644--- a/locales/zh-TW/common.json+++ b/locales/zh-TW/common.json@@ -32,6 +32,7 @@"blog": "產品部落格","branching": "建立子主題","branchingDisable": "「子主題」功能僅在伺服器端版本可用,如需該功能,請切換到伺服器端部署模式或使用 LobeChat Cloud",+ "branchingRequiresSavedTopic": "當前話題未保存,保存後才可以使用子話題功能","cancel": "取消","changelog": "變更日誌","clientDB": {diff --git a/packages/database/src/models/__tests__/file.test.ts b/packages/database/src/models/__tests__/file.test.tsindex 4ef604b2388..075df0230cd 100644--- a/packages/database/src/models/__tests__/file.test.ts+++ b/packages/database/src/models/__tests__/file.test.ts@@ -1025,7 +1025,7 @@ describe('FileModel', () => {it('should handle unknown file category', async () => {// This tests the default case in switch statement (line 312-313)const unknownCategory = 'unknown' as FilesTabs;-+// We need to access the private method indirectly by testing the query method// that uses getFileTypePrefix internallyconst params = {@@ -1033,7 +1033,7 @@ describe('FileModel', () => {current: 1,pageSize: 10,};-+// This should not throw an error and should handle the unknown category gracefullyconst result = await fileModel.query(params);expect(result).toBeDefined();@@ -1054,7 +1054,7 @@ describe('FileModel', () => {};const { id: fileId } = await fileModel.create(testFile, true);-+// Create many chunks for this file to trigger batch processing// Note: This is a simplified test since we can't easily create 3000+ chunks// But it will still exercise the batch deletion code path@@ -1069,7 +1069,7 @@ describe('FileModel', () => {// Insert chunks (this might need to be done through proper API)// For testing purposes, we'll delete the file which should trigger the batch deletionawait fileModel.delete(fileId, true);-+// Verify the file is deletedconst deletedFile = await serverDB.query.files.findFirst({where: eq(files.id, fileId),diff --git a/packages/database/src/models/__tests__/session.test.ts b/packages/database/src/models/__tests__/session.test.tsindex fbba56de834..5b3c59d1ff5 100644--- a/packages/database/src/models/__tests__/session.test.ts+++ b/packages/database/src/models/__tests__/session.test.ts@@ -1152,14 +1152,14 @@ describe('SessionModel', () => {// 这个测试旨在覆盖 findSessionsByKeywords 中的错误处理逻辑 (lines 484-486)// 通过模拟一个可能导致错误的场景来触发 catch 块const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});-+// 创建一个会导致错误的场景// 我们可以通过传递一个会导致数据库查询问题的关键词来测试错误处理const result = await sessionModel.findSessionsByKeywords({ keyword: 'test' });-+// 即使发生错误,方法也应该返回一个空数组expect(Array.isArray(result)).toBe(true);-+consoleSpy.mockRestore();});diff --git a/src/features/Conversation/components/ChatItem/ActionsBar.tsx b/src/features/Conversation/components/ChatItem/ActionsBar.tsxindex a8517bf620a..830eeced059 100644--- a/src/features/Conversation/components/ChatItem/ActionsBar.tsx+++ b/src/features/Conversation/components/ChatItem/ActionsBar.tsx@@ -1,6 +1,7 @@import { ActionIconGroup, type ActionIconGroupEvent, type ActionIconGroupProps } from '@lobehub/ui';import { App } from 'antd';import isEqual from 'fast-deep-equal';+import { useSearchParams } from 'next/navigation';import { memo, use, useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -38,6 +39,8 @@ interface ActionsProps {const Actions = memo<ActionsProps>(({ id, inPortalThread, index }) => {const item = useChatStore(chatSelectors.getMessageById(id), isEqual);const { t } = useTranslation('common');+ const searchParams = useSearchParams();+ const topic = searchParams.get('topic');const [deleteMessage,regenerateMessage,@@ -84,6 +87,10 @@ const Actions = memo<ActionsProps>(({ id, inPortalThread, index }) => {break;}case 'branching': {+ if (!topic) {+ message.warning(t('branchingRequiresSavedTopic'));+ break;+ }openThreadCreator(id);break;}diff --git a/src/libs/next-auth/auth.config.ts b/src/libs/next-auth/auth.config.tsindex a9401bdfb40..0cda947e496 100644--- a/src/libs/next-auth/auth.config.ts+++ b/src/libs/next-auth/auth.config.ts@@ -6,6 +6,9 @@ import { getServerDBConfig } from '@/config/db';import { LobeNextAuthDbAdapter } from './adapter';import { ssoProviders } from './sso-providers';+import { LobeNextAuthDbAdapter } from './adapter';+import { ssoProviders } from './sso-providers';+const {NEXT_AUTH_DEBUG,NEXT_AUTH_SECRET,diff --git a/src/locales/default/common.ts b/src/locales/default/common.tsindex 348ebda9ae5..4b49f6f2ae6 100644--- a/src/locales/default/common.ts+++ b/src/locales/default/common.ts@@ -34,6 +34,7 @@ export default {branching: '创建子话题',branchingDisable:'「子话题」功能在当前模式下不可用,如需该功能,请切换到 Postgres/Pglite DB 模式或使用 LobeChat Cloud',+ branchingRequiresSavedTopic: '当前话题未保存,保存后才可以使用子话题能力',cancel: '取消',changelog: '更新日志',clientDB: {