🤯 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
feat: Improve CMDK (#10877)
René Wangc1be517fd684
diff --git a/locales/ar/chat.json b/locales/ar/chat.jsonindex 77d9b4d1027..f793a17db1e 100644--- a/locales/ar/chat.json+++ b/locales/ar/chat.json@@ -404,6 +404,13 @@"search": "بحث"},"task": {+ "activity": {+ "calling": "جارٍ استدعاء الأداة...",+ "generating": "جارٍ توليد الرد...",+ "gotResult": "تم الحصول على نتيجة الأداة",+ "toolCalling": "جارٍ استدعاء {{toolName}}...",+ "toolResult": "تم الحصول على نتيجة {{toolName}}"+ },"metrics": {"stepsShort": "خطوة","toolCallsShort": "مرة استخدام الأداة"diff --git a/locales/ar/common.json b/locales/ar/common.jsonindex eb6f499762f..0ee6bf25441 100644--- a/locales/ar/common.json+++ b/locales/ar/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "حول","aiModeEmptyState": "أدخل سؤالك في الحقل أعلاه لبدء المحادثة مع الذكاء الاصطناعي",+ "aiModeHint": "اضغط Enter لطرح سؤال على Lobe AI","aiModePlaceholder": "اطرح سؤالاً على الذكاء الاصطناعي...","community": "المجتمع","communitySupport": "دعم المجتمع",+ "context": {+ "agent": "المساعد",+ "community": "المجتمع",+ "general": "عام",+ "group": "المجموعة",+ "memory": "الذاكرة",+ "page": "الوثيقة",+ "painting": "الرسم",+ "resource": "الموارد",+ "settings": "الإعدادات"+ },"discover": "استكشاف","memory": "الذاكرة","navigate": "التنقل","newAgent": "إنشاء مساعد جديد",+ "newLibrary": "إنشاء مكتبة جديدة","noResults": "لم يتم العثور على نتائج","openSettings": "فتح الإعدادات","pages": "المستندات",@@ -155,9 +168,11 @@"agents": "مساعدون","assistant": "مساعد الذكاء الاصطناعي","assistants": "مساعدو الذكاء الاصطناعي",+ "communityAgent": "مساعد المجتمع","file": "ملف","files": "ملفات","loading": "جارٍ البحث...",+ "market": "المجتمع","mcp": "خادم MCP","mcps": "خوادم MCP","message": "المحادثة",@@ -166,6 +181,7 @@"pages": "المستندات","plugin": "الملحق","plugins": "الملحقات",+ "searchMore": "البحث عن المزيد من {{type}}","searching": "نتائج البحث","topic": "موضوع","topics": "مواضيع"diff --git a/locales/ar/plugin.json b/locales/ar/plugin.jsonindex dfbef5dad02..a130e9f9021 100644--- a/locales/ar/plugin.json+++ b/locales/ar/plugin.json@@ -136,7 +136,7 @@"off": "إيقاف التصحيح","on": "عرض معلومات استدعاء الإضافة","payload": "حمولة الإضافة",- "pluginState": "حالة الإضافة",+ "pluginState": "حالة المكون الإضافي","response": "النتيجة المرجعة","title": "تفاصيل الإضافة","tool_call": "طلب استدعاء الأداة"diff --git a/locales/bg-BG/chat.json b/locales/bg-BG/chat.jsonindex 5a1c637e31e..d6c0cc7e7ce 100644--- a/locales/bg-BG/chat.json+++ b/locales/bg-BG/chat.json@@ -404,6 +404,13 @@"search": "Търсене"},"task": {+ "activity": {+ "calling": "Извикване на инструмента...",+ "generating": "Генериране на отговор...",+ "gotResult": "Резултатът от инструмента е получен",+ "toolCalling": "Извикване на {{toolName}}...",+ "toolResult": "Резултатът от {{toolName}} е получен"+ },"metrics": {"stepsShort": "стъпки","toolCallsShort": "използвания на инструменти"diff --git a/locales/bg-BG/common.json b/locales/bg-BG/common.jsonindex 1594d4efd35..9efcc6135dc 100644--- a/locales/bg-BG/common.json+++ b/locales/bg-BG/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Относно","aiModeEmptyState": "Въведете въпроса си в полето по-горе, за да започнете разговор с AI",+ "aiModeHint": "Натиснете Enter, за да попитате Lobe AI","aiModePlaceholder": "Задайте въпрос на AI...","community": "Общност","communitySupport": "Общностна поддръжка",+ "context": {+ "agent": "Асистент",+ "community": "Общност",+ "general": "Общи",+ "group": "Група",+ "memory": "Памет",+ "page": "Документ",+ "painting": "Рисуване",+ "resource": "Ресурс",+ "settings": "Настройки"+ },"discover": "Открий","memory": "Памет","navigate": "Навигация","newAgent": "Създай агент",+ "newLibrary": "Създай нова библиотека","noResults": "Няма намерени резултати","openSettings": "Отвори настройките","pages": "Документи",@@ -155,9 +168,11 @@"agents": "Асистенти","assistant": "AI Асистент","assistants": "AI Асистенти",+ "communityAgent": "Асистент на общността","file": "Файл","files": "Файлове","loading": "Търсене...",+ "market": "Общност","mcp": "MCP Сървър","mcps": "MCP Сървъри","message": "Съобщение",@@ -166,6 +181,7 @@"pages": "Документи","plugin": "Приставка","plugins": "Приставки",+ "searchMore": "Търси още {{type}}","searching": "Резултати от търсенето","topic": "Тема","topics": "Теми"diff --git a/locales/bg-BG/plugin.json b/locales/bg-BG/plugin.jsonindex 9371e97b726..cb842b473cd 100644--- a/locales/bg-BG/plugin.json+++ b/locales/bg-BG/plugin.json@@ -136,7 +136,7 @@"off": "Изключване на отстраняване на грешки","on": "Преглед на информация за извикване на плъгин","payload": "Товар на плъгина",- "pluginState": "Състояние на плъгина",+ "pluginState": "Състояние на приставката","response": "Резултат","title": "Детайли за плъгина","tool_call": "Заявка за извикване на инструмент"diff --git a/locales/de-DE/chat.json b/locales/de-DE/chat.jsonindex 54e1c219a67..ea3e6b900b7 100644--- a/locales/de-DE/chat.json+++ b/locales/de-DE/chat.json@@ -404,6 +404,13 @@"search": "Suche"},"task": {+ "activity": {+ "calling": "Werkzeug wird aufgerufen...",+ "generating": "Antwort wird generiert...",+ "gotResult": "Werkzeugergebnis erhalten",+ "toolCalling": "{{toolName}} wird aufgerufen...",+ "toolResult": "{{toolName}}-Ergebnis erhalten"+ },"metrics": {"stepsShort": "Schritte","toolCallsShort": "Werkzeugaufrufe"diff --git a/locales/de-DE/common.json b/locales/de-DE/common.jsonindex 5b803a75916..d72647c4731 100644--- a/locales/de-DE/common.json+++ b/locales/de-DE/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Über","aiModeEmptyState": "Gib deine Frage oben ein, um mit der KI zu chatten",+ "aiModeHint": "Drücken Sie Enter, um Lobe AI zu fragen","aiModePlaceholder": "Stelle der KI eine Frage...","community": "Community","communitySupport": "Community-Support",+ "context": {+ "agent": "Assistent",+ "community": "Community",+ "general": "Allgemein",+ "group": "Gruppe",+ "memory": "Erinnerung",+ "page": "Dokument",+ "painting": "Malerei",+ "resource": "Ressource",+ "settings": "Einstellungen"+ },"discover": "Entdecken","memory": "Erinnerung","navigate": "Navigieren","newAgent": "Neuen Assistenten erstellen",+ "newLibrary": "Neue Bibliothek","noResults": "Keine Ergebnisse gefunden","openSettings": "Einstellungen öffnen","pages": "Dokumente",@@ -155,9 +168,11 @@"agents": "Assistenten","assistant": "KI-Assistent","assistants": "KI-Assistenten",+ "communityAgent": "Community-Assistent","file": "Datei","files": "Dateien","loading": "Wird gesucht...",+ "market": "Community","mcp": "MCP-Server","mcps": "MCP-Server","message": "Nachricht",@@ -166,6 +181,7 @@"pages": "Dokumente","plugin": "Plugin","plugins": "Plugins",+ "searchMore": "Mehr {{type}} suchen","searching": "Suchergebnisse","topic": "Thema","topics": "Themen"diff --git a/locales/de-DE/plugin.json b/locales/de-DE/plugin.jsonindex 8509c4a12ce..420585577ba 100644--- a/locales/de-DE/plugin.json+++ b/locales/de-DE/plugin.json@@ -136,7 +136,7 @@"off": "Debugging ausschalten","on": "Plugin-Aufrufinformationen anzeigen","payload": "Plugin-Nutzlast",- "pluginState": "Plugin-Zustand",+ "pluginState": "Plugin-Status","response": "Antwort","title": "Plugin-Details","tool_call": "Werkzeugaufruf-Anfrage"diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 88c766fc597..9b0001d9689 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -404,6 +404,13 @@"search": "Search"},"task": {+ "activity": {+ "calling": "Calling tool...",+ "generating": "Generating response...",+ "gotResult": "Tool result received",+ "toolCalling": "Calling {{toolName}}...",+ "toolResult": "{{toolName}} result received"+ },"metrics": {"stepsShort": "steps","toolCallsShort": "tool uses"diff --git a/locales/en-US/common.json b/locales/en-US/common.jsonindex deee7c7dedd..31e1d669697 100644--- a/locales/en-US/common.json+++ b/locales/en-US/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "About","aiModeEmptyState": "Type your question above to start chatting with AI",+ "aiModeHint": "Press Enter to ask Lobe AI","aiModePlaceholder": "Ask AI anything...","community": "Community","communitySupport": "Community Support",+ "context": {+ "agent": "Assistant",+ "community": "Community",+ "general": "General",+ "group": "Group",+ "memory": "Memory",+ "page": "Document",+ "painting": "Painting",+ "resource": "Resource",+ "settings": "Settings"+ },"discover": "Discover","memory": "Memory","navigate": "Navigate","newAgent": "Create New Assistant",+ "newLibrary": "New Library","noResults": "No results found","openSettings": "Open Settings","pages": "Documents",@@ -155,9 +168,11 @@"agents": "Assistants","assistant": "AI Assistant","assistants": "AI Assistants",+ "communityAgent": "Community Assistant","file": "File","files": "Files","loading": "Searching...",+ "market": "Community","mcp": "MCP Server","mcps": "MCP Servers","message": "Message",@@ -166,6 +181,7 @@"pages": "Documents","plugin": "Plugin","plugins": "Plugins",+ "searchMore": "Search more {{type}}","searching": "Search Results","topic": "Topic","topics": "Topics"diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.jsonindex c11b341c552..ce41528640a 100644--- a/locales/en-US/plugin.json+++ b/locales/en-US/plugin.json@@ -136,7 +136,7 @@"off": "Turn Off Debug","on": "View Plugin Call Info","payload": "Plugin Payload",- "pluginState": "Plugin State",+ "pluginState": "Plugin Status","response": "Response","title": "Plugin Details","tool_call": "Tool Call Request"diff --git a/locales/es-ES/chat.json b/locales/es-ES/chat.jsonindex 2b57b680298..7a88a7adc43 100644--- a/locales/es-ES/chat.json+++ b/locales/es-ES/chat.json@@ -404,6 +404,13 @@"search": "Buscar"},"task": {+ "activity": {+ "calling": "Llamando a la herramienta...",+ "generating": "Generando respuesta...",+ "gotResult": "Resultado de la herramienta obtenido",+ "toolCalling": "Llamando a {{toolName}}...",+ "toolResult": "Resultado de {{toolName}} obtenido"+ },"metrics": {"stepsShort": "pasos","toolCallsShort": "usos de herramientas"diff --git a/locales/es-ES/common.json b/locales/es-ES/common.jsonindex 81dc05e73d7..90d47537869 100644--- a/locales/es-ES/common.json+++ b/locales/es-ES/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Acerca de","aiModeEmptyState": "Escribe tu pregunta en el cuadro de arriba para comenzar a conversar con la IA",+ "aiModeHint": "Presiona Enter para preguntar a Lobe AI","aiModePlaceholder": "Hazle una pregunta a la IA...","community": "Comunidad","communitySupport": "Soporte de la comunidad",+ "context": {+ "agent": "Asistente",+ "community": "Comunidad",+ "general": "General",+ "group": "Grupo",+ "memory": "Memoria",+ "page": "Documento",+ "painting": "Pintura",+ "resource": "Recurso",+ "settings": "Configuración"+ },"discover": "Descubrir","memory": "Memoria","navigate": "Navegar","newAgent": "Nuevo asistente",+ "newLibrary": "Nueva biblioteca","noResults": "No se encontraron resultados","openSettings": "Abrir configuración","pages": "Documentos",@@ -155,9 +168,11 @@"agents": "Asistentes","assistant": "Asistente de IA","assistants": "Asistentes de IA",+ "communityAgent": "Asistente de la comunidad","file": "Archivo","files": "Archivos","loading": "Buscando...",+ "market": "Comunidad","mcp": "Servidor MCP","mcps": "Servidores MCP","message": "Conversación",@@ -166,6 +181,7 @@"pages": "Documentos","plugin": "Complemento","plugins": "Complementos",+ "searchMore": "Buscar más {{type}}","searching": "Resultados de búsqueda","topic": "Tema","topics": "Temas"diff --git a/locales/es-ES/plugin.json b/locales/es-ES/plugin.jsonindex 254107871cb..d5c456baae8 100644--- a/locales/es-ES/plugin.json+++ b/locales/es-ES/plugin.json@@ -136,7 +136,7 @@"off": "Desactivar depuración","on": "Ver información de llamadas al plugin","payload": "Carga útil del plugin",- "pluginState": "Estado del plugin",+ "pluginState": "Estado del complemento","response": "Resultado devuelto","title": "Detalles del plugin","tool_call": "Solicitud de llamada a herramienta"diff --git a/locales/fa-IR/chat.json b/locales/fa-IR/chat.jsonindex 149132608be..c771f419cf2 100644--- a/locales/fa-IR/chat.json+++ b/locales/fa-IR/chat.json@@ -404,6 +404,13 @@"search": "جستجو"},"task": {+ "activity": {+ "calling": "در حال فراخوانی ابزار...",+ "generating": "در حال تولید پاسخ...",+ "gotResult": "نتیجه ابزار دریافت شد",+ "toolCalling": "در حال فراخوانی {{toolName}}...",+ "toolResult": "نتیجه {{toolName}} دریافت شد"+ },"metrics": {"stepsShort": "گام","toolCallsShort": "بار استفاده از ابزار"diff --git a/locales/fa-IR/common.json b/locales/fa-IR/common.jsonindex 9b5dc948e16..b781a383946 100644--- a/locales/fa-IR/common.json+++ b/locales/fa-IR/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "درباره","aiModeEmptyState": "برای شروع گفتگو با هوش مصنوعی، سوال خود را در کادر بالا وارد کنید",+ "aiModeHint": "Enter را فشار دهید تا از Lobe AI بپرسید","aiModePlaceholder": "سوالی از هوش مصنوعی بپرسید...","community": "انجمن","communitySupport": "پشتیبانی جامعه",+ "context": {+ "agent": "دستیار",+ "community": "انجمن",+ "general": "عمومی",+ "group": "گروه",+ "memory": "حافظه",+ "page": "سند",+ "painting": "نقاشی",+ "resource": "منبع",+ "settings": "تنظیمات"+ },"discover": "کشف","memory": "حافظه","navigate": "ناوبری","newAgent": "دستیار جدید",+ "newLibrary": "ایجاد کتابخانه جدید","noResults": "نتیجهای یافت نشد","openSettings": "باز کردن تنظیمات","pages": "اسناد",@@ -155,9 +168,11 @@"agents": "دستیارها","assistant": "دستیار هوش مصنوعی","assistants": "دستیاران هوش مصنوعی",+ "communityAgent": "دستیار انجمن","file": "فایل","files": "فایلها","loading": "در حال جستجو...",+ "market": "انجمن","mcp": "سرور MCP","mcps": "سرورهای MCP","message": "گفتوگو",@@ -166,6 +181,7 @@"pages": "اسناد","plugin": "افزونه","plugins": "افزونهها",+ "searchMore": "جستجوی بیشتر {{type}}","searching": "نتایج جستجو","topic": "موضوع","topics": "موضوعات"diff --git a/locales/fr-FR/chat.json b/locales/fr-FR/chat.jsonindex 2ee46c2a842..64aab0b6e0f 100644--- a/locales/fr-FR/chat.json+++ b/locales/fr-FR/chat.json@@ -404,6 +404,13 @@"search": "Recherche"},"task": {+ "activity": {+ "calling": "Appel de l'outil en cours...",+ "generating": "Génération de la réponse en cours...",+ "gotResult": "Résultat de l'outil obtenu",+ "toolCalling": "Appel de {{toolName}} en cours...",+ "toolResult": "Résultat de {{toolName}} obtenu"+ },"metrics": {"stepsShort": "étapes","toolCallsShort": "utilisations d’outils"diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.jsonindex c9283024b14..82ed54659a3 100644--- a/locales/fr-FR/common.json+++ b/locales/fr-FR/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "À propos","aiModeEmptyState": "Saisissez votre question dans le champ ci-dessus pour commencer à discuter avec l'IA",+ "aiModeHint": "Appuyez sur Entrée pour interroger Lobe AI","aiModePlaceholder": "Posez une question à l'IA...","community": "Communauté","communitySupport": "Support communautaire",+ "context": {+ "agent": "Assistant",+ "community": "Communauté",+ "general": "Général",+ "group": "Groupe",+ "memory": "Mémoire",+ "page": "Document",+ "painting": "Peinture",+ "resource": "Ressource",+ "settings": "Paramètres"+ },"discover": "Découvrir","memory": "Mémoire","navigate": "Naviguer","newAgent": "Nouvel assistant",+ "newLibrary": "Nouvelle bibliothèque","noResults": "Aucun résultat trouvé","openSettings": "Ouvrir les paramètres","pages": "Documents",@@ -155,9 +168,11 @@"agents": "Assistants","assistant": "Assistant IA","assistants": "Assistants IA",+ "communityAgent": "Assistant communautaire","file": "Fichier","files": "Fichiers","loading": "Recherche en cours...",+ "market": "Communauté","mcp": "Serveur MCP","mcps": "Serveurs MCP","message": "Message",@@ -166,6 +181,7 @@"pages": "Documents","plugin": "Plugin","plugins": "Plugins",+ "searchMore": "Rechercher plus de {{type}}","searching": "Résultats de recherche","topic": "Sujet","topics": "Sujets"diff --git a/locales/it-IT/chat.json b/locales/it-IT/chat.jsonindex 5a24c0e7ab0..b03d1a0d253 100644--- a/locales/it-IT/chat.json+++ b/locales/it-IT/chat.json@@ -404,6 +404,13 @@"search": "Cerca"},"task": {+ "activity": {+ "calling": "Chiamata allo strumento in corso...",+ "generating": "Generazione della risposta in corso...",+ "gotResult": "Risultato dello strumento ottenuto",+ "toolCalling": "Chiamata a {{toolName}} in corso...",+ "toolResult": "Risultato di {{toolName}} ottenuto"+ },"metrics": {"stepsShort": "passi","toolCallsShort": "utilizzi strumenti"diff --git a/locales/it-IT/common.json b/locales/it-IT/common.jsonindex 59a22559cf8..220aa698f37 100644--- a/locales/it-IT/common.json+++ b/locales/it-IT/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Informazioni","aiModeEmptyState": "Inserisci la tua domanda nel campo sopra per iniziare a conversare con l'AI",+ "aiModeHint": "Premi Invio per chiedere a Lobe AI","aiModePlaceholder": "Fai una domanda all'AI...","community": "Comunità","communitySupport": "Supporto della comunità",+ "context": {+ "agent": "Assistente",+ "community": "Comunità",+ "general": "Generale",+ "group": "Gruppo",+ "memory": "Memoria",+ "page": "Documento",+ "painting": "Pittura",+ "resource": "Risorsa",+ "settings": "Impostazioni"+ },"discover": "Scopri","memory": "Memoria","navigate": "Naviga","newAgent": "Nuovo assistente",+ "newLibrary": "Nuova Libreria","noResults": "Nessun risultato trovato","openSettings": "Apri impostazioni","pages": "Documenti",@@ -155,9 +168,11 @@"agents": "Assistenti","assistant": "Assistente AI","assistants": "Assistenti AI",+ "communityAgent": "Assistente della Comunità","file": "File","files": "File","loading": "Ricerca in corso...",+ "market": "Comunità","mcp": "Server MCP","mcps": "Server MCP","message": "Conversazione",@@ -166,6 +181,7 @@"pages": "Documenti","plugin": "Plugin","plugins": "Plugin",+ "searchMore": "Cerca altri {{type}}","searching": "Risultati della ricerca","topic": "Argomento","topics": "Argomenti"diff --git a/locales/it-IT/plugin.json b/locales/it-IT/plugin.jsonindex 21236e10d38..8cfc29d5891 100644--- a/locales/it-IT/plugin.json+++ b/locales/it-IT/plugin.json@@ -136,7 +136,7 @@"off": "Disattiva debug","on": "Visualizza informazioni chiamata plugin","payload": "Payload plugin",- "pluginState": "Stato plugin",+ "pluginState": "Stato del plugin","response": "Risultato restituito","title": "Dettagli plugin","tool_call": "Richiesta chiamata strumento"diff --git a/locales/ja-JP/chat.json b/locales/ja-JP/chat.jsonindex 87ccc058b4c..6c17b8d6258 100644--- a/locales/ja-JP/chat.json+++ b/locales/ja-JP/chat.json@@ -404,6 +404,13 @@"search": "検索"},"task": {+ "activity": {+ "calling": "ツールを呼び出しています...",+ "generating": "返信を生成しています...",+ "gotResult": "ツールの結果を取得しました",+ "toolCalling": "{{toolName}} を呼び出しています...",+ "toolResult": "{{toolName}} の結果を取得しました"+ },"metrics": {"stepsShort": "歩","toolCallsShort": "回ツール使用"diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.jsonindex ecc3f18c7a3..861af956d39 100644--- a/locales/ja-JP/common.json+++ b/locales/ja-JP/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "概要","aiModeEmptyState": "上の入力欄に質問を入力して、AIとの対話を始めましょう",+ "aiModeHint": "EnterキーでLobe AIに質問","aiModePlaceholder": "AIに質問する...","community": "コミュニティ","communitySupport": "コミュニティサポート",+ "context": {+ "agent": "アシスタント",+ "community": "コミュニティ",+ "general": "一般",+ "group": "グループ",+ "memory": "メモリー",+ "page": "ドキュメント",+ "painting": "ペインティング",+ "resource": "リソース",+ "settings": "設定"+ },"discover": "発見","memory": "メモリー","navigate": "ナビゲート","newAgent": "新しいエージェントを作成",+ "newLibrary": "新しいライブラリを作成","noResults": "該当する結果が見つかりませんでした","openSettings": "設定を開く","pages": "ドキュメント",@@ -155,9 +168,11 @@"agents": "アシスタント","assistant": "AIアシスタント","assistants": "AIアシスタント",+ "communityAgent": "コミュニティアシスタント","file": "ファイル","files": "ファイル","loading": "検索中...",+ "market": "コミュニティ","mcp": "MCPサーバー","mcps": "MCPサーバー","message": "メッセージ",@@ -166,6 +181,7 @@"pages": "ドキュメント","plugin": "プラグイン","plugins": "プラグイン",+ "searchMore": "{{type}}をさらに検索","searching": "検索結果","topic": "トピック","topics": "トピック"diff --git a/locales/ja-JP/plugin.json b/locales/ja-JP/plugin.jsonindex 74a5f69fc46..a2372dd9b2e 100644--- a/locales/ja-JP/plugin.json+++ b/locales/ja-JP/plugin.json@@ -136,7 +136,7 @@"off": "デバッグをオフにする","on": "プラグイン呼び出し情報を表示","payload": "プラグインペイロード",- "pluginState": "プラグイン状態",+ "pluginState": "プラグインの状態","response": "返却結果","title": "プラグイン詳細","tool_call": "ツール呼び出しリクエスト"diff --git a/locales/ko-KR/chat.json b/locales/ko-KR/chat.jsonindex e1723767b72..49ca29cc317 100644--- a/locales/ko-KR/chat.json+++ b/locales/ko-KR/chat.json@@ -404,6 +404,13 @@"search": "검색"},"task": {+ "activity": {+ "calling": "도구를 호출하는 중...",+ "generating": "응답을 생성하는 중...",+ "gotResult": "도구 결과를 가져왔습니다",+ "toolCalling": "{{toolName}} 호출 중...",+ "toolResult": "{{toolName}} 결과를 가져왔습니다"+ },"metrics": {"stepsShort": "단계","toolCallsShort": "도구 사용 횟수"diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.jsonindex a1ce4947759..490a14adf7f 100644--- a/locales/ko-KR/common.json+++ b/locales/ko-KR/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "정보","aiModeEmptyState": "위의 입력창에 질문을 입력하여 AI와 대화를 시작하세요",+ "aiModeHint": "Enter 키를 눌러 Lobe AI에게 질문하세요","aiModePlaceholder": "AI에게 질문하기...","community": "커뮤니티","communitySupport": "커뮤니티 지원",+ "context": {+ "agent": "도우미",+ "community": "커뮤니티",+ "general": "일반",+ "group": "그룹",+ "memory": "기억",+ "page": "문서",+ "painting": "그림",+ "resource": "자료",+ "settings": "설정"+ },"discover": "탐색","memory": "기억","navigate": "탐색","newAgent": "새 에이전트 만들기",+ "newLibrary": "새 라이브러리 만들기","noResults": "관련 결과를 찾을 수 없습니다","openSettings": "설정 열기","pages": "문서",@@ -155,9 +168,11 @@"agents": "도우미","assistant": "AI 어시스턴트","assistants": "AI 어시스턴트",+ "communityAgent": "커뮤니티 도우미","file": "파일","files": "파일","loading": "검색 중...",+ "market": "커뮤니티","mcp": "MCP 서버","mcps": "MCP 서버","message": "대화",@@ -166,6 +181,7 @@"pages": "문서","plugin": "플러그인","plugins": "플러그인",+ "searchMore": "{{type}} 더 검색하기","searching": "검색 결과","topic": "주제","topics": "주제"diff --git a/locales/nl-NL/chat.json b/locales/nl-NL/chat.jsonindex a737308be42..a53ba0134ec 100644--- a/locales/nl-NL/chat.json+++ b/locales/nl-NL/chat.json@@ -404,6 +404,13 @@"search": "Zoeken"},"task": {+ "activity": {+ "calling": "Hulpmiddel wordt aangeroepen...",+ "generating": "Antwoord wordt gegenereerd...",+ "gotResult": "Resultaat van hulpmiddel ontvangen",+ "toolCalling": "{{toolName}} wordt aangeroepen...",+ "toolResult": "Resultaat van {{toolName}} ontvangen"+ },"metrics": {"stepsShort": "stap","toolCallsShort": "keer gereedschap gebruikt"diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.jsonindex 67242c00954..9f8dbd66320 100644--- a/locales/nl-NL/common.json+++ b/locales/nl-NL/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Over","aiModeEmptyState": "Typ je vraag in het invoerveld hierboven om een gesprek met de AI te starten",+ "aiModeHint": "Druk op Enter om Lobe AI te vragen","aiModePlaceholder": "Stel een vraag aan de AI...","community": "Community","communitySupport": "Communityondersteuning",+ "context": {+ "agent": "Assistent",+ "community": "Gemeenschap",+ "general": "Algemeen",+ "group": "Groep",+ "memory": "Geheugen",+ "page": "Document",+ "painting": "Schilderij",+ "resource": "Bron",+ "settings": "Instellingen"+ },"discover": "Ontdekken","memory": "Geheugen","navigate": "Navigeren","newAgent": "Nieuwe Assistent",+ "newLibrary": "Nieuwe bibliotheek","noResults": "Geen resultaten gevonden","openSettings": "Instellingen openen","pages": "Documenten",@@ -155,9 +168,11 @@"agents": "Assistenten","assistant": "AI-assistent","assistants": "AI-assistenten",+ "communityAgent": "Gemeenschapsassistent","file": "Bestand","files": "Bestanden","loading": "Bezig met zoeken...",+ "market": "Gemeenschap","mcp": "MCP-server","mcps": "MCP-servers","message": "Gesprek",@@ -166,6 +181,7 @@"pages": "Documenten","plugin": "Plug-in","plugins": "Plug-ins",+ "searchMore": "Zoek meer {{type}}","searching": "Zoekresultaten","topic": "Onderwerp","topics": "Onderwerpen"diff --git a/locales/nl-NL/plugin.json b/locales/nl-NL/plugin.jsonindex 050d4aabc70..e7b0fe66356 100644--- a/locales/nl-NL/plugin.json+++ b/locales/nl-NL/plugin.json@@ -136,7 +136,7 @@"off": "Debuggen uitschakelen","on": "Plugin-aanroepinformatie bekijken","payload": "Plugin payload",- "pluginState": "Plugin status",+ "pluginState": "Plug-instatus","response": "Resultaat","title": "Plugin details","tool_call": "Tool-aanroepverzoek"diff --git a/locales/pl-PL/chat.json b/locales/pl-PL/chat.jsonindex 48a51ed8fb6..7a21d94e8a7 100644--- a/locales/pl-PL/chat.json+++ b/locales/pl-PL/chat.json@@ -404,6 +404,13 @@"search": "Szukaj"},"task": {+ "activity": {+ "calling": "Wywoływanie narzędzia...",+ "generating": "Generowanie odpowiedzi...",+ "gotResult": "Otrzymano wynik narzędzia",+ "toolCalling": "Wywoływanie {{toolName}}...",+ "toolResult": "Otrzymano wynik z {{toolName}}"+ },"metrics": {"stepsShort": "krok","toolCallsShort": "użycie narzędzia"diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.jsonindex ff346ace24a..66d672dfa1b 100644--- a/locales/pl-PL/common.json+++ b/locales/pl-PL/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "O nas","aiModeEmptyState": "Wpisz swoje pytanie w polu powyżej, aby rozpocząć rozmowę z AI",+ "aiModeHint": "Naciśnij Enter, aby zapytać Lobe AI","aiModePlaceholder": "Zadaj pytanie AI...","community": "Społeczność","communitySupport": "Wsparcie społeczności",+ "context": {+ "agent": "Asystent",+ "community": "Społeczność",+ "general": "Ogólne",+ "group": "Grupa",+ "memory": "Pamięć",+ "page": "Dokument",+ "painting": "Obraz",+ "resource": "Zasób",+ "settings": "Ustawienia"+ },"discover": "Odkrywaj","memory": "Pamięć","navigate": "Nawigacja","newAgent": "Nowy asystent",+ "newLibrary": "Nowa biblioteka","noResults": "Brak wyników","openSettings": "Otwórz ustawienia","pages": "Dokumenty",@@ -155,9 +168,11 @@"agents": "Asystenci","assistant": "Asystent AI","assistants": "Asystenci AI",+ "communityAgent": "Asystent społeczności","file": "Plik","files": "Pliki","loading": "Wyszukiwanie...",+ "market": "Społeczność","mcp": "Serwer MCP","mcps": "Serwery MCP","message": "Wiadomość",@@ -166,6 +181,7 @@"pages": "Dokumenty","plugin": "Wtyczka","plugins": "Wtyczki",+ "searchMore": "Szukaj więcej {{type}}","searching": "Wyniki wyszukiwania","topic": "Temat","topics": "Tematy"diff --git a/locales/pt-BR/chat.json b/locales/pt-BR/chat.jsonindex ee91cb2e048..021e714312e 100644--- a/locales/pt-BR/chat.json+++ b/locales/pt-BR/chat.json@@ -404,6 +404,13 @@"search": "Pesquisar"},"task": {+ "activity": {+ "calling": "Chamando a ferramenta...",+ "generating": "Gerando resposta...",+ "gotResult": "Resultado da ferramenta obtido",+ "toolCalling": "Chamando {{toolName}}...",+ "toolResult": "Resultado de {{toolName}} obtido"+ },"metrics": {"stepsShort": "passos","toolCallsShort": "usos de ferramenta"diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.jsonindex 9855bc1a69e..6370fa7423b 100644--- a/locales/pt-BR/common.json+++ b/locales/pt-BR/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Sobre","aiModeEmptyState": "Digite sua pergunta na caixa acima para começar a conversar com a IA",+ "aiModeHint": "Pressione Enter para perguntar ao Lobe AI","aiModePlaceholder": "Pergunte algo à IA...","community": "Comunidade","communitySupport": "Suporte da Comunidade",+ "context": {+ "agent": "Assistente",+ "community": "Comunidade",+ "general": "Geral",+ "group": "Grupo",+ "memory": "Memória",+ "page": "Documento",+ "painting": "Pintura",+ "resource": "Recurso",+ "settings": "Configurações"+ },"discover": "Descobrir","memory": "Memória","navigate": "Navegar","newAgent": "Novo Assistente",+ "newLibrary": "Nova Biblioteca","noResults": "Nenhum resultado encontrado","openSettings": "Abrir Configurações","pages": "Documentos",@@ -155,9 +168,11 @@"agents": "Assistentes","assistant": "Assistente de IA","assistants": "Assistentes de IA",+ "communityAgent": "Assistente da Comunidade","file": "Arquivo","files": "Arquivos","loading": "Buscando...",+ "market": "Comunidade","mcp": "Servidor MCP","mcps": "Servidores MCP","message": "Conversa",@@ -166,6 +181,7 @@"pages": "Documentos","plugin": "Plugin","plugins": "Plugins",+ "searchMore": "Buscar mais {{type}}","searching": "Resultados da busca","topic": "Tópico","topics": "Tópicos"diff --git a/locales/ru-RU/chat.json b/locales/ru-RU/chat.jsonindex 27b83f28ed8..6a46589f3a7 100644--- a/locales/ru-RU/chat.json+++ b/locales/ru-RU/chat.json@@ -404,6 +404,13 @@"search": "Поиск"},"task": {+ "activity": {+ "calling": "Вызов инструмента...",+ "generating": "Генерация ответа...",+ "gotResult": "Результат инструмента получен",+ "toolCalling": "Вызов {{toolName}}...",+ "toolResult": "Результат {{toolName}} получен"+ },"metrics": {"stepsShort": "шаг","toolCallsShort": "исп. инструм."diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.jsonindex 33276934c37..4bbd7f597e4 100644--- a/locales/ru-RU/common.json+++ b/locales/ru-RU/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "О нас","aiModeEmptyState": "Введите свой вопрос в поле выше, чтобы начать диалог с ИИ",+ "aiModeHint": "Нажмите Enter, чтобы задать вопрос Lobe AI","aiModePlaceholder": "Задайте вопрос ИИ...","community": "Сообщество","communitySupport": "Поддержка сообщества",+ "context": {+ "agent": "Ассистент",+ "community": "Сообщество",+ "general": "Общее",+ "group": "Группа",+ "memory": "Память",+ "page": "Документ",+ "painting": "Рисование",+ "resource": "Ресурсы",+ "settings": "Настройки"+ },"discover": "Обзор","memory": "Память","navigate": "Навигация","newAgent": "Создать помощника",+ "newLibrary": "Создать библиотеку","noResults": "Ничего не найдено","openSettings": "Открыть настройки","pages": "Документы",@@ -155,9 +168,11 @@"agents": "Помощники","assistant": "AI помощник","assistants": "AI помощники",+ "communityAgent": "Ассистент сообщества","file": "Файл","files": "Файлы","loading": "Поиск...",+ "market": "Сообщество","mcp": "Сервер MCP","mcps": "Серверы MCP","message": "Сообщение",@@ -166,6 +181,7 @@"pages": "Документы","plugin": "Плагин","plugins": "Плагины",+ "searchMore": "Искать больше {{type}}","searching": "Результаты поиска","topic": "Тема","topics": "Темы"diff --git a/locales/tr-TR/chat.json b/locales/tr-TR/chat.jsonindex 9aa5558cf2e..3d0d7b5e764 100644--- a/locales/tr-TR/chat.json+++ b/locales/tr-TR/chat.json@@ -404,6 +404,13 @@"search": "Ara"},"task": {+ "activity": {+ "calling": "Araç çağrılıyor...",+ "generating": "Yanıt oluşturuluyor...",+ "gotResult": "Araç sonucu alındı",+ "toolCalling": "{{toolName}} çağrılıyor...",+ "toolResult": "{{toolName}} sonucu alındı"+ },"metrics": {"stepsShort": "Adım","toolCallsShort": "Araç Kullanımı"diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.jsonindex c0c81c87a21..2453e406b83 100644--- a/locales/tr-TR/common.json+++ b/locales/tr-TR/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Hakkında","aiModeEmptyState": "Yukarıdaki giriş kutusuna sorunuzu yazarak yapay zeka ile sohbet etmeye başlayın",+ "aiModeHint": "Enter tuşuna basarak Lobe AI'ye sor","aiModePlaceholder": "Yapay zekaya soru sor...","community": "Topluluk","communitySupport": "Topluluk Desteği",+ "context": {+ "agent": "Asistan",+ "community": "Topluluk",+ "general": "Genel",+ "group": "Grup",+ "memory": "Hafıza",+ "page": "Belge",+ "painting": "Resim",+ "resource": "Kaynak",+ "settings": "Ayarlar"+ },"discover": "Keşfet","memory": "Hafıza","navigate": "Gezin","newAgent": "Yeni Asistan Oluştur",+ "newLibrary": "Yeni Kütüphane","noResults": "Sonuç bulunamadı","openSettings": "Ayarları Aç","pages": "Belgeler",@@ -155,9 +168,11 @@"agents": "Asistanlar","assistant": "Yapay Zeka Asistanı","assistants": "Yapay Zeka Asistanları",+ "communityAgent": "Topluluk Asistanı","file": "Dosya","files": "Dosyalar","loading": "Aranıyor...",+ "market": "Topluluk","mcp": "MCP Sunucusu","mcps": "MCP Sunucuları","message": "Mesaj",@@ -166,6 +181,7 @@"pages": "Belgeler","plugin": "Eklenti","plugins": "Eklentiler",+ "searchMore": "Daha fazla {{type}} ara","searching": "Arama Sonuçları","topic": "Konu","topics": "Konular"diff --git a/locales/vi-VN/chat.json b/locales/vi-VN/chat.jsonindex 9872b493e81..29878cdeb51 100644--- a/locales/vi-VN/chat.json+++ b/locales/vi-VN/chat.json@@ -404,6 +404,13 @@"search": "Tìm kiếm"},"task": {+ "activity": {+ "calling": "Đang gọi công cụ...",+ "generating": "Đang tạo phản hồi...",+ "gotResult": "Đã nhận kết quả từ công cụ",+ "toolCalling": "Đang gọi {{toolName}}...",+ "toolResult": "Đã nhận kết quả từ {{toolName}}"+ },"metrics": {"stepsShort": "bước","toolCallsShort": "lượt dùng công cụ"diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.jsonindex 34db345e2c3..fef9ddc4b29 100644--- a/locales/vi-VN/common.json+++ b/locales/vi-VN/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "Giới thiệu","aiModeEmptyState": "Nhập câu hỏi của bạn vào ô phía trên để bắt đầu trò chuyện với AI",+ "aiModeHint": "Nhấn Enter để hỏi Lobe AI","aiModePlaceholder": "Đặt câu hỏi cho AI...","community": "Cộng đồng","communitySupport": "Hỗ trợ cộng đồng",+ "context": {+ "agent": "Trợ lý",+ "community": "Cộng đồng",+ "general": "Chung",+ "group": "Nhóm",+ "memory": "Ký ức",+ "page": "Tài liệu",+ "painting": "Tranh vẽ",+ "resource": "Tài nguyên",+ "settings": "Cài đặt"+ },"discover": "Khám phá","memory": "Ký ức","navigate": "Điều hướng","newAgent": "Tạo trợ lý mới",+ "newLibrary": "Tạo thư viện mới","noResults": "Không tìm thấy kết quả phù hợp","openSettings": "Mở cài đặt","pages": "Tài liệu",@@ -155,9 +168,11 @@"agents": "Trợ lý","assistant": "Trợ lý AI","assistants": "Trợ lý AI",+ "communityAgent": "Trợ lý cộng đồng","file": "Tệp","files": "Tệp","loading": "Đang tìm kiếm...",+ "market": "Cộng đồng","mcp": "Máy chủ MCP","mcps": "Máy chủ MCP","message": "Cuộc trò chuyện",@@ -166,6 +181,7 @@"pages": "Tài liệu","plugin": "Plugin","plugins": "Plugin",+ "searchMore": "Tìm thêm {{type}}","searching": "Kết quả tìm kiếm","topic": "Chủ đề","topics": "Chủ đề"diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 5dd647c692e..c230b967de7 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -404,6 +404,13 @@"search": "搜索"},"task": {+ "activity": {+ "calling": "正在调用工具...",+ "generating": "正在生成回复...",+ "gotResult": "已获取工具结果",+ "toolCalling": "正在调用 {{toolName}}...",+ "toolResult": "已获取 {{toolName}} 结果"+ },"metrics": {"stepsShort": "步","toolCallsShort": "次使用工具"diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.jsonindex 5baddec8c71..272c6ae6ca0 100644--- a/locales/zh-CN/common.json+++ b/locales/zh-CN/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "关于","aiModeEmptyState": "在上方输入框中输入你的问题,开始与 AI 对话",+ "aiModeHint": "Enter to ask Lobe AI","aiModePlaceholder": "向 AI 提问...","community": "社区","communitySupport": "社区支持",+ "context": {+ "agent": "助手",+ "community": "社区",+ "general": "通用",+ "group": "群组",+ "memory": "记忆",+ "page": "文稿",+ "painting": "绘画",+ "resource": "资源",+ "settings": "设置"+ },"discover": "发现","memory": "记忆","navigate": "导航","newAgent": "新建助手",+ "newLibrary": "新建库","noResults": "未找到相关结果","openSettings": "打开设置","pages": "文稿",@@ -155,9 +168,11 @@"agents": "助手","assistant": "AI 助手","assistants": "AI 助手",+ "communityAgent": "社区助手","file": "文件","files": "文件","loading": "搜索中...",+ "market": "社区","mcp": "MCP 服务器","mcps": "MCP 服务器","message": "对话",@@ -166,6 +181,7 @@"pages": "文稿","plugin": "插件","plugins": "插件",+ "searchMore": "搜索更多{{type}}","searching": "搜索结果","topic": "话题","topics": "话题"diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.jsonindex c14bfaa8939..e755bbc6f89 100644--- a/locales/zh-CN/plugin.json+++ b/locales/zh-CN/plugin.json@@ -136,7 +136,7 @@"off": "关闭调试","on": "查看插件调用信息","payload": "插件载荷",- "pluginState": "插件 State",+ "pluginState": "插件状态","response": "返回结果","title": "插件详情","tool_call": "工具调用请求"diff --git a/locales/zh-TW/chat.json b/locales/zh-TW/chat.jsonindex f5919d16cbb..322614d08d2 100644--- a/locales/zh-TW/chat.json+++ b/locales/zh-TW/chat.json@@ -404,6 +404,13 @@"search": "搜尋"},"task": {+ "activity": {+ "calling": "正在呼叫工具...",+ "generating": "正在產生回覆...",+ "gotResult": "已取得工具結果",+ "toolCalling": "正在呼叫 {{toolName}}...",+ "toolResult": "已取得 {{toolName}} 結果"+ },"metrics": {"stepsShort": "步驟","toolCallsShort": "次使用工具"diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.jsonindex 898ddf7931d..fea3c44cb69 100644--- a/locales/zh-TW/common.json+++ b/locales/zh-TW/common.json@@ -138,13 +138,26 @@"cmdk": {"about": "關於","aiModeEmptyState": "在上方輸入框中輸入你的問題,開始與 AI 對話",+ "aiModeHint": "按 Enter 向 Lobe AI 詢問","aiModePlaceholder": "向 AI 提問...","community": "社群","communitySupport": "社群支援",+ "context": {+ "agent": "助手",+ "community": "社群",+ "general": "通用",+ "group": "群組",+ "memory": "記憶",+ "page": "文稿",+ "painting": "繪畫",+ "resource": "資源",+ "settings": "設定"+ },"discover": "探索","memory": "記憶","navigate": "導覽","newAgent": "新增助手",+ "newLibrary": "新增資料庫","noResults": "未找到相關結果","openSettings": "開啟設定","pages": "文稿",@@ -155,9 +168,11 @@"agents": "助理","assistant": "AI 助手","assistants": "AI 助手",+ "communityAgent": "社群助手","file": "檔案","files": "檔案","loading": "搜尋中...",+ "market": "社群","mcp": "MCP 伺服器","mcps": "MCP 伺服器","message": "對話",@@ -166,6 +181,7 @@"pages": "文件","plugin": "外掛","plugins": "外掛",+ "searchMore": "搜尋更多{{type}}","searching": "搜尋結果","topic": "主題","topics": "主題"diff --git a/locales/zh-TW/plugin.json b/locales/zh-TW/plugin.jsonindex fb53dc66597..720c6595c72 100644--- a/locales/zh-TW/plugin.json+++ b/locales/zh-TW/plugin.json@@ -136,7 +136,7 @@"off": "關閉調試","on": "查看插件調用信息","payload": "插件載荷",- "pluginState": "插件 State",+ "pluginState": "外掛狀態","response": "返回結果","title": "插件詳情","tool_call": "工具調用請求"diff --git a/packages/database/src/repositories/search/index.ts b/packages/database/src/repositories/search/index.tsindex 3991e79f99a..d05b35435ae 100644--- a/packages/database/src/repositories/search/index.ts+++ b/packages/database/src/repositories/search/index.ts@@ -9,10 +9,11 @@ export type SearchResultType =| 'agent'| 'topic'| 'file'+ | 'memory'| 'message'| 'mcp'| 'plugin'- | 'assistant';+ | 'communityAgent';export interface BaseSearchResult {// 1=exact, 2=prefix, 3=contains@@ -96,7 +97,7 @@ export interface AssistantSearchResult extends BaseSearchResult {homepage?: string | null;identifier: string;tags?: string[] | null;- type: 'assistant';+ type: 'communityAgent';}export type SearchResult =@@ -150,23 +151,23 @@ export class SearchRepo {// Build queries based on type filterconst queries = [];- if (!type || type === 'agent') {+ if ((!type || type === 'agent') && limits.agent > 0) {queries.push(this.buildAgentQuery(searchTerm, exactQuery, prefixQuery, limits.agent));}- if (!type || type === 'topic') {+ if ((!type || type === 'topic') && limits.topic > 0) {queries.push(this.buildTopicQuery(searchTerm, exactQuery, prefixQuery, limits.topic, agentId),);}- if (!type || type === 'message') {+ if ((!type || type === 'message') && limits.message > 0) {queries.push(this.buildMessageQuery(searchTerm, exactQuery, prefixQuery, limits.message, agentId),);}- if (!type || type === 'file') {+ if ((!type || type === 'file') && limits.file > 0) {queries.push(this.buildFileQuery(searchTerm, exactQuery, prefixQuery, limits.file));}- if (!type || type === 'page') {+ if ((!type || type === 'page') && limits.page > 0) {queries.push(this.buildPageQuery(searchTerm, exactQuery, prefixQuery, limits.page));}diff --git a/src/features/CommandMenu/CommandMenuContext.tsx b/src/features/CommandMenu/CommandMenuContext.tsxnew file mode 100644index 00000000000..aabea779971--- /dev/null+++ b/src/features/CommandMenu/CommandMenuContext.tsx@@ -0,0 +1,90 @@+'use client';++import { type Dispatch, type ReactNode, type SetStateAction, createContext, useContext, useEffect, useState } from 'react';++import type { ValidSearchType } from './utils/queryParser';+import { MenuContext, PageType } from './types';+import { detectContext } from './utils/context';++interface CommandMenuContextValue {+ isAiMode: boolean;+ menuContext: MenuContext;+ mounted: boolean;+ page: PageType | undefined;+ pages: PageType[];+ pathname: string | null;+ search: string;+ setPages: Dispatch<SetStateAction<PageType[]>>;+ setSearch: (search: string) => void;+ setTypeFilter: (typeFilter: ValidSearchType | undefined) => void;+ setViewMode: (viewMode: MenuViewMode) => void;+ typeFilter: ValidSearchType | undefined;+ viewMode: MenuViewMode;+}++type MenuViewMode = 'default' | 'search' | 'ai-chat';++const CommandMenuContext = createContext<CommandMenuContextValue | undefined>(undefined);++interface CommandMenuProviderProps {+ children: ReactNode;+ pathname: string | null;+}++export const CommandMenuProvider = ({ children, pathname }: CommandMenuProviderProps) => {+ const menuContext = detectContext(pathname ?? '/');+ const [viewMode, setViewMode] = useState<MenuViewMode>('default');+ const [pages, setPages] = useState<PageType[]>([]);+ const [search, setSearch] = useState('');+ const [typeFilter, setTypeFilter] = useState<ValidSearchType | undefined>(undefined);+ const [mounted, setMounted] = useState(false);++ // Derived values+ const page = pages.at(-1);+ const isAiMode = page === 'ai-chat';++ // Ensure we're mounted on the client+ useEffect(() => {+ setMounted(true);+ }, []);++ useEffect(() => {+ if (pages.at(-1) === 'ai-chat') {+ setViewMode('ai-chat');+ } else if (search.trim().length > 0) {+ setViewMode('search');+ } else {+ setViewMode('default');+ }+ }, [pages, search]);++ return (+ <CommandMenuContext.Provider+ value={{+ isAiMode,+ menuContext,+ mounted,+ page,+ pages,+ pathname,+ search,+ setPages,+ setSearch,+ setTypeFilter,+ setViewMode,+ typeFilter,+ viewMode,+ }}+ >+ {children}+ </CommandMenuContext.Provider>+ );+};++export const useCommandMenuContext = () => {+ const context = useContext(CommandMenuContext);+ if (context === undefined) {+ throw new Error('useCommandMenuContext must be used within a CommandMenuProvider');+ }+ return context;+};diff --git a/src/features/CommandMenu/ContextCommands.tsx b/src/features/CommandMenu/ContextCommands.tsxindex 8d6c68ab6b8..8b753c43b87 100644--- a/src/features/CommandMenu/ContextCommands.tsx+++ b/src/features/CommandMenu/ContextCommands.tsx@@ -1,58 +1,32 @@import { Command } from 'cmdk';import { ChevronRight } from 'lucide-react';-import { memo } from 'react';+import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';-import type { Context } from './types';+import { useCommandMenuContext } from './CommandMenuContext';+import { CommandItem } from './components';+import { useCommandMenu } from './useCommandMenu';import { getContextCommands } from './utils/contextCommands';-interface ContextCommandsProps {- context: Context;- onNavigate: (path: string) => void;- styles: {- icon: string;- itemContent: string;- itemLabel: string;- };-}--const ContextCommands = memo<ContextCommandsProps>(({ context, onNavigate, styles }) => {+const ContextCommands = memo(() => {const { t } = useTranslation('setting');const { t: tAuth } = useTranslation('auth');const { t: tCommon } = useTranslation('common');- const { t: tChat } = useTranslation('chat');- const commands = getContextCommands(context.type, context.subPath);+ const { handleNavigate } = useCommandMenu();+ const { menuContext, pathname } = useCommandMenuContext();++ // Extract subPath from pathname+ const subPath = useMemo(() => {+ const pathParts = pathname?.split('/').filter(Boolean);+ return pathParts && pathParts.length > 1 ? pathParts[1] : undefined;+ }, [pathname]);++ const commands = getContextCommands(menuContext, subPath);if (commands.length === 0) return null;// Get localized context name- const getContextName = () => {- switch (context.type) {- case 'settings': {- return t('header.title', { defaultValue: context.name });- }- case 'agent': {- return tCommon('cmdk.search.agent', { defaultValue: context.name });- }- case 'group': {- return tChat('group.title', { defaultValue: context.name });- }- case 'page': {- return tCommon('cmdk.pages', { defaultValue: context.name });- }- case 'painting': {- return tCommon('cmdk.painting', { defaultValue: context.name });- }- case 'resource': {- return tCommon('cmdk.resource', { defaultValue: context.name });- }- default: {- return context.name;- }- }- };-- const contextName = getContextName();+ const contextName = tCommon(`cmdk.context.${menuContext}`, { defaultValue: menuContext });return (<Command.Group>@@ -70,24 +44,24 @@ const ContextCommands = memo<ContextCommandsProps>(({ context, onNavigate, styleconst searchValue = `${contextName} ${label} ${cmd.keywords.join(' ')}`;return (- <Command.Item key={cmd.path} onSelect={() => onNavigate(cmd.path)} value={searchValue}>- <Icon className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>- <span style={{ opacity: 0.5 }}>{contextName}</span>- <ChevronRight- size={14}- style={{- display: 'inline',- marginInline: '6px',- opacity: 0.5,- verticalAlign: 'middle',- }}- />- {label}- </div>- </div>- </Command.Item>+ <CommandItem+ icon={<Icon />}+ key={cmd.path}+ onSelect={() => handleNavigate(cmd.path)}+ value={searchValue}+ >+ <span style={{ opacity: 0.5 }}>{contextName}</span>+ <ChevronRight+ size={14}+ style={{+ display: 'inline',+ marginInline: '6px',+ opacity: 0.5,+ verticalAlign: 'middle',+ }}+ />+ {label}+ </CommandItem>);})}</Command.Group>diff --git a/src/features/CommandMenu/MainMenu.tsx b/src/features/CommandMenu/MainMenu.tsxindex 0b41d29feda..b3e477d5c81 100644--- a/src/features/CommandMenu/MainMenu.tsx+++ b/src/features/CommandMenu/MainMenu.tsx@@ -15,143 +15,124 @@ import {import { memo } from 'react';import { useTranslation } from 'react-i18next';+import { SOCIAL_URL } from '@/const/branding';+import { FEEDBACK } from '@/const/url';++import { useCommandMenuContext } from './CommandMenuContext';import ContextCommands from './ContextCommands';-import type { Context } from './types';+import { CommandItem } from './components';+import { useCommandMenu } from './useCommandMenu';-interface MainMenuProps {- context?: Context;- onCreateSession: () => void;- onExternalLink: (url: string) => void;- onNavigate: (path: string) => void;- onNavigateToTheme: () => void;- pathname: string | null;- showCreateSession?: boolean;- styles: {- icon: string;- itemContent: string;- itemLabel: string;- };-}+const MainMenu = memo(() => {+ const { pathname, menuContext, setPages, pages } = useCommandMenuContext();+ const { t } = useTranslation('common');-const MainMenu = memo<MainMenuProps>(- ({- context,- onCreateSession,- onExternalLink,- onNavigate,- onNavigateToTheme,- pathname,- styles,- }) => {- const { t } = useTranslation('common');+ const { handleCreateSession, handleNavigate, handleExternalLink } = useCommandMenu();- return (- <>- {context && <ContextCommands context={context} onNavigate={onNavigate} styles={styles} />}+ return (+ <>+ <ContextCommands />- <Command.Group>- <Command.Item onSelect={onCreateSession} value="create new agent assistant">- <Bot className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.newAgent')}</div>- </div>- </Command.Item>+ <Command.Group>+ <CommandItem+ icon={<Bot />}+ onSelect={handleCreateSession}+ value="create new agent assistant"+ >+ {t('cmdk.newAgent')}+ </CommandItem>- {!pathname?.startsWith('/settings') && (- <Command.Item onSelect={() => onNavigate('/settings')} value="settings">- <Settings className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.settings')}</div>- </div>- </Command.Item>- )}+ {menuContext === 'resource' && (+ <CommandItem icon={<Bot />} onSelect={handleCreateSession} value="create new library">+ {t('cmdk.newLibrary')}+ </CommandItem>+ )}- <Command.Item onSelect={onNavigateToTheme} value="theme">- <Monitor className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.theme')}</div>- </div>- </Command.Item>- </Command.Group>+ {menuContext !== 'settings' && (+ <CommandItem+ icon={<Settings />}+ onSelect={() => handleNavigate('/settings')}+ value="settings"+ >+ {t('cmdk.settings')}+ </CommandItem>+ )}- <Command.Group heading={t('cmdk.navigate')}>- {!pathname?.startsWith('/community') && (- <Command.Item onSelect={() => onNavigate('/community')} value="community">- <Shapes className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.community')}</div>- </div>- </Command.Item>- )}- {!pathname?.startsWith('/image') && (- <Command.Item onSelect={() => onNavigate('/image')} value="painting">- <Image className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.painting')}</div>- </div>- </Command.Item>- )}- {!pathname?.startsWith('/knowledge') && (- <Command.Item onSelect={() => onNavigate('/resource')} value="resource">- <LibraryBig className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.resource')}</div>- </div>- </Command.Item>- )}- {!pathname?.startsWith('/page') && (- <Command.Item onSelect={() => onNavigate('/page')} value="page documents write">- <FilePen className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.pages')}</div>- </div>- </Command.Item>- )}- {!pathname?.startsWith('/memory') && (- <Command.Item onSelect={() => onNavigate('/memory')} value="memory">- <BrainCircuit className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.memory')}</div>- </div>- </Command.Item>- )}- </Command.Group>+ <CommandItem icon={<Monitor />} onSelect={() => setPages([...pages, 'theme'])} value="theme">+ {t('cmdk.theme')}+ </CommandItem>+ </Command.Group>- <Command.Group heading={t('cmdk.about')}>- <Command.Item- onSelect={() =>- onExternalLink('https://github.com/lobehub/lobe-chat/issues/new/choose')- }- value="submit-issue"+ <Command.Group heading={t('cmdk.navigate')}>+ {!pathname?.startsWith('/community') && (+ <CommandItem+ icon={<Shapes />}+ onSelect={() => handleNavigate('/community')}+ value="community">- <Github className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.submitIssue')}</div>- </div>- </Command.Item>- <Command.Item- onSelect={() => onExternalLink('https://github.com/lobehub/lobe-chat')}- value="star-github"+ {t('cmdk.community')}+ </CommandItem>+ )}+ {!pathname?.startsWith('/image') && (+ <CommandItem icon={<Image />} onSelect={() => handleNavigate('/image')} value="painting">+ {t('cmdk.painting')}+ </CommandItem>+ )}+ {!pathname?.startsWith('/knowledge') && (+ <CommandItem+ icon={<LibraryBig />}+ onSelect={() => handleNavigate('/resource')}+ value="resource">- <Star className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.starOnGitHub')}</div>- </div>- </Command.Item>- <Command.Item- onSelect={() => onExternalLink('https://discord.gg/AYFPHvv2jT')}- value="discord"+ {t('cmdk.resource')}+ </CommandItem>+ )}+ {!pathname?.startsWith('/page') && (+ <CommandItem+ icon={<FilePen />}+ onSelect={() => handleNavigate('/page')}+ value="page documents write">- <DiscordIcon className={styles.icon} />- <div className={styles.itemContent}>- <div className={styles.itemLabel}>{t('cmdk.communitySupport')}</div>- </div>- </Command.Item>- </Command.Group>- </>- );- },-);+ {t('cmdk.pages')}+ </CommandItem>+ )}+ {!pathname?.startsWith('/memory') && (+ <CommandItem+ icon={<BrainCircuit />}+ onSelect={() => handleNavigate('/memory')}+ value="memory"+ >+ {t('cmdk.memory')}+ </CommandItem>+ )}+ </Command.Group>++ <Command.Group heading={t('cmdk.about')}>+ <CommandItem+ icon={<Github />}+ onSelect={() => handleExternalLink(FEEDBACK)}+ value="submit-issue"+ >+ {t('cmdk.submitIssue')}+ </CommandItem>+ <CommandItem+ icon={<Star />}+ onSelect={() => handleExternalLink(SOCIAL_URL.github)}+ value="star-github"+ >+ {t('cmdk.starOnGitHub')}+ </CommandItem>+ <CommandItem+ icon={<DiscordIcon />}+ onSelect={() => handleExternalLink(SOCIAL_URL.discord)}+ value="discord"+ >+ {t('cmdk.communitySupport')}+ </CommandItem>+ </Command.Group>+ </>+ );+});MainMenu.displayName = 'MainMenu';diff --git a/src/features/CommandMenu/SearchResults.tsx b/src/features/CommandMenu/SearchResults.tsxindex 5687db348a5..f085c285182 100644--- a/src/features/CommandMenu/SearchResults.tsx+++ b/src/features/CommandMenu/SearchResults.tsx@@ -8,24 +8,29 @@ import { useNavigate } from 'react-router-dom';import type { SearchResult } from '@/database/repositories/search';-import type { Context } from './types';+import { CommandItem } from './components';+import { useCommandMenuContext } from './CommandMenuContext';+import { useStyles } from './styles';+import type { ValidSearchType } from './utils/queryParser';interface SearchResultsProps {- context?: Context;isLoading: boolean;onClose: () => void;+ onSetTypeFilter: (typeFilter: ValidSearchType | undefined) => void;results: SearchResult[];- searchQuery?: string;- styles: any;+ searchQuery: string;+ typeFilter: ValidSearchType | undefined;}/*** Search results from unified search index.*/const SearchResults = memo<SearchResultsProps>(- ({ results, isLoading, onClose, styles, context, searchQuery = '' }) => {+ ({ isLoading, onClose, onSetTypeFilter, results, searchQuery, typeFilter }) => {const { t } = useTranslation('common');const navigate = useNavigate();+ const { styles } = useStyles();+ const { menuContext } = useCommandMenuContext();const handleNavigate = (result: SearchResult) => {switch (result.type) {@@ -76,7 +81,7 @@ const SearchResults = memo<SearchResultsProps>(navigate(`/community/plugins/${result.identifier}`);break;}- case 'assistant': {+ case 'communityAgent': {navigate(`/community/assistant/${result.identifier}`);break;}@@ -107,7 +112,7 @@ const SearchResults = memo<SearchResultsProps>(case 'plugin': {return <Plug size={16} />;}- case 'assistant': {+ case 'communityAgent': {return <Bot size={16} />;}}@@ -136,12 +141,21 @@ const SearchResults = memo<SearchResultsProps>(case 'plugin': {return t('cmdk.search.plugin');}- case 'assistant': {+ case 'communityAgent': {return t('cmdk.search.assistant');}}};+ // Get trailing label for search results (shows "Market" for marketplace items)+ const getTrailingLabel = (type: SearchResult['type']) => {+ // Marketplace items: MCP, plugins, assistants+ if (type === 'mcp' || type === 'plugin' || type === 'communityAgent') {+ return t('cmdk.search.market');+ }+ return getTypeLabel(type);+ };+// eslint-disable-next-line unicorn/consistent-function-scopingconst getItemValue = (result: SearchResult) => {const meta = [result.title, result.description].filter(Boolean).join(' ');@@ -176,6 +190,30 @@ const SearchResults = memo<SearchResultsProps>(return description;};+ const handleSearchMore = (type: ValidSearchType) => {+ onSetTypeFilter(type);+ };++ // Helper to render "Search More" button+ const renderSearchMore = (type: ValidSearchType, count: number) => {+ // Don't show if already filtering by this type+ if (typeFilter) return null;++ // Show if there are results (might have more)+ if (count === 0) return null;++ return (+ <CommandItem+ forceMount+ icon={getIcon(type)}+ onSelect={() => handleSearchMore(type)}+ title={t('cmdk.search.searchMore', { type: getTypeLabel(type) })}+ value={`action-show-more-results-for-type-${type}`}+ variant="detailed"+ />+ );+ };+const hasResults = results.length > 0;// Group results by type@@ -186,11 +224,11 @@ const SearchResults = memo<SearchResultsProps>(const pageResults = results.filter((r) => r.type === 'page');const mcpResults = results.filter((r) => r.type === 'mcp');const pluginResults = results.filter((r) => r.type === 'plugin');- const assistantResults = results.filter((r) => r.type === 'assistant');+ const assistantResults = results.filter((r) => r.type === 'communityAgent');// Detect context types- const isResourceContext = context?.type === 'resource';- const isPageContext = context?.type === 'page';+ const isResourceContext = menuContext === 'resource';+ const isPageContext = menuContext === 'page';// Don't render anything if no results and not loadingif (!hasResults && !isLoading) {@@ -203,23 +241,18 @@ const SearchResults = memo<SearchResultsProps>({hasResults && isPageContext && pageResults.length > 0 && (<Command.Group heading={t('cmdk.search.pages')} key="pages-page-context">{pageResults.map((result) => (- <Command.Item+ <CommandItem+ description={result.description}+ icon={getIcon(result.type)}key={`page-page-context-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {result.description && (- <div className={styles.itemDescription}>{result.description}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('page', pageResults.length)}</Command.Group>)}@@ -227,92 +260,72 @@ const SearchResults = memo<SearchResultsProps>({hasResults && isPageContext && fileResults.length > 0 && (<Command.Group heading={t('cmdk.search.files')}>{fileResults.map((result) => (- <Command.Item+ <CommandItem+ description={result.type === 'file' ? result.fileType : undefined}+ icon={getIcon(result.type)}key={`file-page-context-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {result.type === 'file' && (- <div className={styles.itemDescription}>{result.fileType}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('file', fileResults.length)}</Command.Group>)}{hasResults && isPageContext && agentResults.length > 0 && (<Command.Group heading={t('cmdk.search.agents')}>{agentResults.map((result) => (- <Command.Item+ <CommandItem+ description={getDescription(result)}+ icon={getIcon(result.type)}key={`agent-page-context-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getDescription(result) && (- <div className={styles.itemDescription}>{getDescription(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('agent', agentResults.length)}</Command.Group>)}{hasResults && isPageContext && topicResults.length > 0 && (<Command.Group heading={t('cmdk.search.topics')}>{topicResults.map((result) => (- <Command.Item+ <CommandItem+ description={getSubtitle(result)}+ icon={getIcon(result.type)}key={`topic-page-context-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getSubtitle(result) && (- <div className={styles.itemDescription}>{getSubtitle(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('topic', topicResults.length)}</Command.Group>)}{hasResults && isPageContext && messageResults.length > 0 && (<Command.Group heading={t('cmdk.search.messages')}>{messageResults.map((result) => (- <Command.Item+ <CommandItem+ description={getSubtitle(result)}+ icon={getIcon(result.type)}key={`message-page-context-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getSubtitle(result) && (- <div className={styles.itemDescription}>{getSubtitle(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('message', messageResults.length)}</Command.Group>)}@@ -320,23 +333,18 @@ const SearchResults = memo<SearchResultsProps>({hasResults && isResourceContext && pageResults.length > 0 && (<Command.Group heading={t('cmdk.search.pages')} key="pages-resource">{pageResults.map((result) => (- <Command.Item+ <CommandItem+ description={result.description}+ icon={getIcon(result.type)}key={`page-resource-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {result.description && (- <div className={styles.itemDescription}>{result.description}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('page', pageResults.length)}</Command.Group>)}@@ -344,92 +352,72 @@ const SearchResults = memo<SearchResultsProps>({hasResults && isResourceContext && fileResults.length > 0 && (<Command.Group heading={t('cmdk.search.files')}>{fileResults.map((result) => (- <Command.Item+ <CommandItem+ description={result.type === 'file' ? result.fileType : undefined}+ icon={getIcon(result.type)}key={`file-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {result.type === 'file' && (- <div className={styles.itemDescription}>{result.fileType}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('file', fileResults.length)}</Command.Group>)}- {hasResults && messageResults.length > 0 && (+ {hasResults && !isPageContext && !isResourceContext && messageResults.length > 0 && (<Command.Group heading={t('cmdk.search.messages')}>{messageResults.map((result) => (- <Command.Item+ <CommandItem+ description={getSubtitle(result)}+ icon={getIcon(result.type)}key={`message-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getSubtitle(result) && (- <div className={styles.itemDescription}>{getSubtitle(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('message', messageResults.length)}</Command.Group>)}- {hasResults && agentResults.length > 0 && (+ {hasResults && !isPageContext && agentResults.length > 0 && (<Command.Group heading={t('cmdk.search.agents')}>{agentResults.map((result) => (- <Command.Item+ <CommandItem+ description={getDescription(result)}+ icon={getIcon(result.type)}key={`agent-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getDescription(result) && (- <div className={styles.itemDescription}>{getDescription(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('agent', agentResults.length)}</Command.Group>)}- {hasResults && topicResults.length > 0 && (+ {hasResults && !isPageContext && topicResults.length > 0 && (<Command.Group heading={t('cmdk.search.topics')}>{topicResults.map((result) => (- <Command.Item+ <CommandItem+ description={getSubtitle(result)}+ icon={getIcon(result.type)}key={`topic-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getSubtitle(result) && (- <div className={styles.itemDescription}>{getSubtitle(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('topic', topicResults.length)}</Command.Group>)}@@ -437,23 +425,18 @@ const SearchResults = memo<SearchResultsProps>({hasResults && !isResourceContext && !isPageContext && pageResults.length > 0 && (<Command.Group heading={t('cmdk.search.pages')} key="pages-normal">{pageResults.map((result) => (- <Command.Item+ <CommandItem+ description={result.description}+ icon={getIcon(result.type)}key={`page-normal-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {result.description && (- <div className={styles.itemDescription}>{result.description}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('page', pageResults.length)}</Command.Group>)}@@ -461,92 +444,72 @@ const SearchResults = memo<SearchResultsProps>({hasResults && !isResourceContext && !isPageContext && fileResults.length > 0 && (<Command.Group heading={t('cmdk.search.files')}>{fileResults.map((result) => (- <Command.Item+ <CommandItem+ description={result.type === 'file' ? result.fileType : undefined}+ icon={getIcon(result.type)}key={`file-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {result.type === 'file' && (- <div className={styles.itemDescription}>{result.fileType}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('file', fileResults.length)}</Command.Group>)}{hasResults && mcpResults.length > 0 && (<Command.Group heading={t('cmdk.search.mcps')}>{mcpResults.map((result) => (- <Command.Item+ <CommandItem+ description={getDescription(result)}+ icon={getIcon(result.type)}key={`mcp-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getDescription(result) && (- <div className={styles.itemDescription}>{getDescription(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('mcp', mcpResults.length)}</Command.Group>)}{hasResults && pluginResults.length > 0 && (<Command.Group heading={t('cmdk.search.plugins')}>{pluginResults.map((result) => (- <Command.Item+ <CommandItem+ description={getDescription(result)}+ icon={getIcon(result.type)}key={`plugin-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getDescription(result) && (- <div className={styles.itemDescription}>{getDescription(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('plugin', pluginResults.length)}</Command.Group>)}{hasResults && assistantResults.length > 0 && (<Command.Group heading={t('cmdk.search.assistants')}>{assistantResults.map((result) => (- <Command.Item+ <CommandItem+ description={getDescription(result)}+ icon={getIcon(result.type)}key={`assistant-${result.id}`}onSelect={() => handleNavigate(result)}+ title={result.title}+ trailingLabel={getTrailingLabel(result.type)}value={getItemValue(result)}- >- <div className={styles.itemContent}>- <div className={styles.itemIcon}>{getIcon(result.type)}</div>- <div className={styles.itemDetails}>- <div className={styles.itemTitle}>{result.title}</div>- {getDescription(result) && (- <div className={styles.itemDescription}>{getDescription(result)}</div>- )}- </div>- <div className={styles.itemType}>{getTypeLabel(result.type)}</div>- </div>- </Command.Item>+ variant="detailed"+ />))}+ {renderSearchMore('communityAgent', assistantResults.length)}</Command.Group>)}diff --git a/src/features/CommandMenu/ThemeMenu.tsx b/src/features/CommandMenu/ThemeMenu.tsxindex 31105ef82ca..f1a1ed12725 100644--- a/src/features/CommandMenu/ThemeMenu.tsx+++ b/src/features/CommandMenu/ThemeMenu.tsx@@ -3,35 +3,29 @@ import { Monitor, Moon, Sun } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';-import type { ThemeMode } from './types';+import { useCommandMenu } from './useCommandMenu';+import { useStyles } from './styles';-interface ThemeMenuProps {- onThemeChange: (theme: ThemeMode) => void;- styles: {- icon: string;- itemContent: string;- itemLabel: string;- };-}--const ThemeMenu = memo<ThemeMenuProps>(({ onThemeChange, styles }) => {+const ThemeMenu = memo(() => {const { t } = useTranslation('common');+ const { handleThemeChange } = useCommandMenu();+ const { styles } = useStyles();return (<>- <Command.Item onSelect={() => onThemeChange('light')} value="theme-light">+ <Command.Item onSelect={() => handleThemeChange('light')} value="theme-light"><Sun className={styles.icon} /><div className={styles.itemContent}><div className={styles.itemLabel}>{t('cmdk.themeLight')}</div></div></Command.Item>- <Command.Item onSelect={() => onThemeChange('dark')} value="theme-dark">+ <Command.Item onSelect={() => handleThemeChange('dark')} value="theme-dark"><Moon className={styles.icon} /><div className={styles.itemContent}><div className={styles.itemLabel}>{t('cmdk.themeDark')}</div></div></Command.Item>- <Command.Item onSelect={() => onThemeChange('auto')} value="theme-auto">+ <Command.Item onSelect={() => handleThemeChange('auto')} value="theme-auto"><Monitor className={styles.icon} /><div className={styles.itemContent}><div className={styles.itemLabel}>{t('cmdk.themeAuto')}</div>diff --git a/src/features/CommandMenu/components/CommandInput.tsx b/src/features/CommandMenu/components/CommandInput.tsxindex 7e2af3a8828..51db4e23806 100644--- a/src/features/CommandMenu/components/CommandInput.tsx+++ b/src/features/CommandMenu/components/CommandInput.tsx@@ -1,11 +1,13 @@import { Tag } from '@lobehub/ui';import { createStyles } from 'antd-style';import { Command } from 'cmdk';-import { ArrowLeft } from 'lucide-react';+import { ArrowLeft, X } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';-import type { Context } from '../types';+import { useCommandMenuContext } from '../CommandMenuContext';+import { useCommandMenu } from '../useCommandMenu';+import type { ValidSearchType } from '../utils/queryParser';const useStyles = createStyles(({ css, token }) => ({backTag: css`@@ -20,6 +22,8 @@ const useStyles = createStyles(({ css, token }) => ({user-select: none;`,contextWrapper: css`+ display: flex;+ gap: 8px;padding-block: 12px 6px;padding-inline: 16px;`,@@ -33,83 +37,63 @@ const useStyles = createStyles(({ css, token }) => ({`,}));-interface CommandInputProps {- context?: Context;- hasPages: boolean;- isAiMode: boolean;- onBack: () => void;- onValueChange: (value: string) => void;- search: string;-}+const CommandInput = memo(() => {+ const { t } = useTranslation('common');+ const { styles } = useStyles();-const CommandInput = memo<CommandInputProps>(- ({ context, hasPages, isAiMode, onBack, onValueChange, search }) => {- const { t } = useTranslation('common');- const { t: tSetting } = useTranslation('setting');- const { t: tChat } = useTranslation('chat');- const { styles } = useStyles();+ const { handleBack } = useCommandMenu();+ const { menuContext, viewMode, pages, search, setSearch, typeFilter, setTypeFilter } =+ useCommandMenuContext();- // Get localized context name- const getContextName = () => {- if (!context) return undefined;+ const hasPages = pages.length > 0;- switch (context.type) {- case 'settings': {- return tSetting('header.title', { defaultValue: context.name });- }- case 'agent': {- return t('cmdk.search.agent', { defaultValue: context.name });- }- case 'group': {- return tChat('group.title', { defaultValue: context.name });- }- case 'page': {- return t('cmdk.pages', { defaultValue: context.name });- }- case 'painting': {- return t('cmdk.painting', { defaultValue: context.name });- }- case 'resource': {- return t('cmdk.resource', { defaultValue: context.name });- }- default: {- return context.name;- }- }- };+ // Get localized context name+ const contextName = t(`cmdk.context.${menuContext}`, { defaultValue: menuContext });- const contextName = getContextName();+ const getTypeLabel = (type: ValidSearchType) => {+ return t(`cmdk.search.${type}`);+ };- return (- <>- {context && !hasPages && (- <div className={styles.contextWrapper}>- <Tag className={styles.contextTag}>{contextName}</Tag>- </div>- )}- <div className={styles.inputWrapper}>- {hasPages && (- <Tag className={styles.backTag} icon={<ArrowLeft size={12} />} onClick={onBack} />- )}- <Command.Input- autoFocus- onValueChange={onValueChange}- placeholder={isAiMode ? t('cmdk.aiModePlaceholder') : t('cmdk.searchPlaceholder')}- value={search}- />- {!isAiMode && search.trim() ? (- <>- <span style={{ fontSize: '14px', opacity: 0.6 }}>Ask AI</span>- <Tag>Tab</Tag>- </>- ) : (- <Tag>ESC</Tag>+ return (+ <>+ {(menuContext !== 'general' || typeFilter) && !hasPages && (+ <div className={styles.contextWrapper}>+ {menuContext !== 'general' && <Tag className={styles.contextTag}>{contextName}</Tag>}+ {typeFilter && (+ <Tag+ className={styles.backTag}+ icon={<X size={12} />}+ onClick={() => setTypeFilter(undefined)}+ >+ {getTypeLabel(typeFilter)}+ </Tag>)}</div>- </>- );- },-);+ )}+ <div className={styles.inputWrapper}>+ {hasPages && (+ <Tag className={styles.backTag} icon={<ArrowLeft size={12} />} onClick={handleBack} />+ )}+ <Command.Input+ autoFocus+ onValueChange={setSearch}+ placeholder={+ viewMode === 'ai-chat' ? t('cmdk.aiModePlaceholder') : t('cmdk.searchPlaceholder')+ }+ value={search}+ />+ {viewMode !== 'ai-chat' && search.trim() ? (+ <>+ <span style={{ fontSize: '14px', opacity: 0.6 }}>Ask AI</span>+ <Tag>Tab</Tag>+ </>+ ) : (+ <Tag>ESC</Tag>+ )}+ </div>+ </>+ );+});CommandInput.displayName = 'CommandInput';diff --git a/src/features/CommandMenu/components/CommandItem.tsx b/src/features/CommandMenu/components/CommandItem.tsxnew file mode 100644index 00000000000..3f9981dc063--- /dev/null+++ b/src/features/CommandMenu/components/CommandItem.tsx@@ -0,0 +1,68 @@+import { Command } from 'cmdk';+import type { ComponentProps, ReactNode } from 'react';+import { cloneElement, isValidElement, memo } from 'react';++import { useStyles } from '../styles';++type BaseCommandItemProps = Omit<ComponentProps<typeof Command.Item>, 'children'>;++type SimpleCommandItemProps = BaseCommandItemProps & {+ children: ReactNode;+ icon: ReactNode;+ variant?: 'simple';+};++type DetailedCommandItemProps = BaseCommandItemProps & {+ description?: ReactNode;+ icon: ReactNode;+ title: ReactNode;+ trailingLabel?: ReactNode;+ variant: 'detailed';+};++type CommandItemProps = SimpleCommandItemProps | DetailedCommandItemProps;++/**+ * Wrapper component for Command.Item that centralizes style management+ */+const CommandItem = memo<CommandItemProps>((props) => {+ const { styles } = useStyles();++ if (props.variant === 'detailed') {+ const { icon, title, description, trailingLabel, ...itemProps } = props;+ return (+ <Command.Item {...itemProps}>+ <div className={styles.itemContent}>+ <div className={styles.itemIcon}>{icon}</div>+ <div className={styles.itemDetails}>+ <div className={styles.itemTitle}>{title}</div>+ {description && <div className={styles.itemDescription}>{description}</div>}+ </div>+ {trailingLabel && <div className={styles.itemType}>{trailingLabel}</div>}+ </div>+ </Command.Item>+ );+ }++ // Simple variant (default)+ const { icon, children, ...itemProps } = props;++ // Clone the icon element and add the icon className if it's a valid React element+ const iconWithClass =+ isValidElement(icon) && typeof icon.type !== 'string'+ ? cloneElement(icon, { className: styles.icon } as never)+ : icon;++ return (+ <Command.Item {...itemProps}>+ {iconWithClass}+ <div className={styles.itemContent}>+ <div className={styles.itemLabel}>{children}</div>+ </div>+ </Command.Item>+ );+});++CommandItem.displayName = 'CommandItem';++export default CommandItem;diff --git a/src/features/CommandMenu/components/index.ts b/src/features/CommandMenu/components/index.tsnew file mode 100644index 00000000000..7078b2fc932--- /dev/null+++ b/src/features/CommandMenu/components/index.ts@@ -0,0 +1,3 @@+export { default as CommandFooter } from './CommandFooter';+export { default as CommandInput } from './CommandInput';+export { default as CommandItem } from './CommandItem';diff --git a/src/features/CommandMenu/index.tsx b/src/features/CommandMenu/index.tsxindex 3d488c81b7c..59d1c07b568 100644--- a/src/features/CommandMenu/index.tsx+++ b/src/features/CommandMenu/index.tsx@@ -1,10 +1,14 @@'use client';import { Command } from 'cmdk';-import { memo } from 'react';+import { memo, useEffect, useState } from 'react';import { createPortal } from 'react-dom';import { useTranslation } from 'react-i18next';+import { useLocation } from 'react-router-dom';+import { useGlobalStore } from '@/store/global';++import { CommandMenuProvider, useCommandMenuContext } from './CommandMenuContext';import MainMenu from './MainMenu';import SearchResults from './SearchResults';import ThemeMenu from './ThemeMenu';@@ -13,57 +17,42 @@ import CommandInput from './components/CommandInput';import { useStyles } from './styles';import { useCommandMenu } from './useCommandMenu';-// type MenuViewMode = 'default' | 'search' | 'ai-chat';-/**- * CMDK Menu.- *- * Search everything in LobeHub.+ * Inner component that uses the context*/-const CommandMenu = memo(() => {+const CommandMenuContent = memo(() => {const { t } = useTranslation('common');const { styles } = useStyles();const {closeCommandMenu,- context,- handleAskAI,handleAskAISubmit,handleBack,- handleCreateSession,- handleExternalLink,- handleNavigate,- handleThemeChange,hasSearch,isAiMode,isSearching,- mounted,- navigateToPage,- open,- page,- pages,- pathname,- search,+ searchQuery,searchResults,- setPages,- setSearch,} = useCommandMenu();- if (!mounted || !open) return null;+ const { viewMode, setPages, page, pages, search, setTypeFilter, typeFilter } =+ useCommandMenuContext();- return createPortal(+ return (<div className={styles.overlay} onClick={closeCommandMenu}><div onClick={(e) => e.stopPropagation()}><CommandclassName={styles.commandRoot}onKeyDown={(e) => {// Tab key to ask AI when not in AI mode- if (e.key === 'Tab' && !isAiMode) {+ if (e.key === 'Tab' && viewMode !== 'ai-chat') {e.preventDefault();- handleAskAI();++ setPages([...pages, 'ai-chat']);+return;}// Enter key in AI mode to submit- if (e.key === 'Enter' && isAiMode) {+ if (e.key === 'Enter' && viewMode === 'ai-chat') {e.preventDefault();handleAskAISubmit();return;@@ -83,42 +72,26 @@ const CommandMenu = memo(() => {setPages((prev) => prev.slice(0, -1));}}}- shouldFilter={!isAiMode}+ shouldFilter={viewMode !== 'ai-chat'}>- <CommandInput- context={context}- hasPages={pages.length > 0}- isAiMode={isAiMode}- onBack={handleBack}- onValueChange={setSearch}- search={search}- />+ <CommandInput /><Command.List>{!isAiMode && !isSearching && <Command.Empty>{t('cmdk.noResults')}</Command.Empty>}+ {isAiMode && <Command.Empty>{t('cmdk.aiModeHint')}</Command.Empty>}- {!page && (- <MainMenu- context={context}- onCreateSession={handleCreateSession}- onExternalLink={handleExternalLink}- onNavigate={handleNavigate}- onNavigateToTheme={() => navigateToPage('theme')}- pathname={pathname}- styles={styles}- />- )}+ {!page && <MainMenu />}- {page === 'theme' && <ThemeMenu onThemeChange={handleThemeChange} styles={styles} />}+ {page === 'theme' && <ThemeMenu />}{!page && hasSearch && !isAiMode && (<SearchResults- context={context}isLoading={isSearching}onClose={closeCommandMenu}+ onSetTypeFilter={setTypeFilter}results={searchResults}- searchQuery={search}- styles={styles}+ searchQuery={searchQuery}+ typeFilter={typeFilter}/>)}</Command.List>@@ -126,7 +99,34 @@ const CommandMenu = memo(() => {<CommandFooter /></Command></div>- </div>,+ </div>+ );+});++CommandMenuContent.displayName = 'CommandMenuContent';++/**+ * CMDK Menu.+ *+ * Search everything in LobeHub.+ */+const CommandMenu = memo(() => {+ const [open] = useGlobalStore((s) => [s.status.showCommandMenu]);+ const [mounted, setMounted] = useState(false);+ const location = useLocation();+ const pathname = location.pathname;++ // Ensure we're mounted on the client+ useEffect(() => {+ setMounted(true);+ }, []);++ if (!mounted || !open) return null;++ return createPortal(+ <CommandMenuProvider pathname={pathname}>+ <CommandMenuContent />+ </CommandMenuProvider>,document.body,);});diff --git a/src/features/CommandMenu/types.ts b/src/features/CommandMenu/types.tsindex 5bc920068ab..4b9d742c8e1 100644--- a/src/features/CommandMenu/types.ts+++ b/src/features/CommandMenu/types.ts@@ -11,7 +11,18 @@ export type PageType = 'theme' | 'ai-chat' | string;export interface Context {name: string;subPath?: string;- type: ContextType;+ type: MenuContext;}-export type ContextType = 'agent' | 'group' | 'painting' | 'settings' | 'resource' | 'page';+export type MenuContext =+ | 'general'+ | 'agent'+ | 'group'+ | 'resource'+ | 'settings'+ | 'memory'+ | 'community'+ | 'page'+ | 'painting';++export type ContextType = Extract<MenuContext, 'agent' | 'group' | 'resource' | 'settings' | 'page' | 'painting'>;diff --git a/src/features/CommandMenu/useCommandMenu.ts b/src/features/CommandMenu/useCommandMenu.tsindex 75d6eb4175a..57f43160473 100644--- a/src/features/CommandMenu/useCommandMenu.ts+++ b/src/features/CommandMenu/useCommandMenu.ts@@ -1,5 +1,5 @@import { useDebounce } from 'ahooks';-import { useEffect, useMemo, useState } from 'react';+import { useEffect, useMemo } from 'react';import { useLocation, useNavigate } from 'react-router-dom';import useSWR from 'swr';@@ -11,33 +11,39 @@ import { useGlobalStore } from '@/store/global';import { globalHelpers } from '@/store/global/helpers';import { useHomeStore } from '@/store/home';+import { useCommandMenuContext } from './CommandMenuContext';import type { ThemeMode } from './types';-import { detectContext } from './utils/context';+/**+ * Shared methods for CommandMenu+ */export const useCommandMenu = () => {const [open, setOpen] = useGlobalStore((s) => [s.status.showCommandMenu, s.updateSystemStatus]);- const [mounted, setMounted] = useState(false);- const [search, setSearch] = useState('');- const [pages, setPages] = useState<string[]>([]);+ const {+ mounted,+ search,+ setSearch,+ pages,+ setPages,+ typeFilter,+ setTypeFilter,+ page,+ isAiMode,+ menuContext: context,+ pathname,+ } = useCommandMenuContext();const navigate = useNavigate();const location = useLocation();- const pathname = location.pathname;const switchThemeMode = useGlobalStore((s) => s.switchThemeMode);const createAgent = useAgentStore((s) => s.createAgent);const refreshAgentList = useHomeStore((s) => s.refreshAgentList);const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);- const page = pages.at(-1);- const isAiMode = page === 'ai-chat';-- // Detect context based on current pathname- const context = useMemo(() => detectContext(pathname), [pathname]);-// Extract agentId from pathname when in agent contextconst agentId = useMemo(() => {- if (context?.type === 'agent') {- const match = pathname.match(/^\/agent\/([^/?]+)/);+ if (context === 'agent') {+ const match = pathname?.match(/^\/agent\/([^/?]+)/);return match?.[1] || undefined;}return undefined;@@ -51,10 +57,16 @@ export const useCommandMenu = () => {const searchQuery = debouncedSearch.trim();const { data: searchResults, isLoading: isSearching } = useSWR<SearchResult[]>(- hasSearch && !isAiMode ? ['search', searchQuery, agentId] : null,+ hasSearch && !isAiMode ? ['search', searchQuery, agentId, typeFilter] : null,async () => {const locale = globalHelpers.getCurrentLanguage();- return lambdaClient.search.query.query({ agentId, locale, query: searchQuery });+ return lambdaClient.search.query.query({+ agentId,+ limitPerType: typeFilter ? 50 : 5, // Show more results when filtering by type+ locale,+ query: searchQuery,+ type: typeFilter,+ });},{revalidateOnFocus: false,@@ -62,11 +74,6 @@ export const useCommandMenu = () => {},);- // Ensure we're mounted on the client- useEffect(() => {- setMounted(true);- }, []);-// Close on Escape key and prevent body scrolluseEffect(() => {if (open) {@@ -79,14 +86,6 @@ export const useCommandMenu = () => {}}, [open]);- // Reset pages and search when opening/closing- useEffect(() => {- if (open) {- setPages([]);- setSearch('');- }- }, [open]);-const closeCommandMenu = () => {setOpen({ showCommandMenu: false });};@@ -106,11 +105,6 @@ export const useCommandMenu = () => {closeCommandMenu();};- const handleAskAI = () => {- // Enter AI mode without adding messages- setPages([...pages, 'ai-chat']);- };-const handleAskAISubmit = () => {// Navigate to inbox agent with the message query parameterif (inboxAgentId && search.trim()) {@@ -136,14 +130,8 @@ export const useCommandMenu = () => {closeCommandMenu();};- const navigateToPage = (pageName: string) => {- setPages([...pages, pageName]);- };-return {closeCommandMenu,- context,- handleAskAI,handleAskAISubmit,handleBack,handleCreateSession,@@ -154,14 +142,15 @@ export const useCommandMenu = () => {isAiMode,isSearching,mounted,- navigateToPage,open,page,pages,pathname,search,+ searchQuery,searchResults: searchResults || ([] as SearchResult[]),- setPages,setSearch,+ setTypeFilter,+ typeFilter,};};diff --git a/src/features/CommandMenu/utils/context.ts b/src/features/CommandMenu/utils/context.tsindex 4db5a0d1d06..3b7620ad67e 100644--- a/src/features/CommandMenu/utils/context.ts+++ b/src/features/CommandMenu/utils/context.ts@@ -1,4 +1,4 @@-import type { Context, ContextType } from '../types';+import type { Context, MenuContext } from '../types';/*** Configuration for context detection@@ -7,7 +7,7 @@ interface ContextConfig {captureSubPath?: boolean;matcher: RegExp;name: string;- type: ContextType;+ type: MenuContext;}/**@@ -35,6 +35,12 @@ const CONTEXT_CONFIGS: ContextConfig[] = [name: 'Settings',type: 'settings',},+ {+ captureSubPath: true,+ matcher: /^\/memory(?:\/([^/]+))?/,+ name: 'Memory',+ type: 'memory',+ },{captureSubPath: true,matcher: /^\/resource(?:\/([^/]+))?/,@@ -54,7 +60,7 @@ const CONTEXT_CONFIGS: ContextConfig[] = [* @param pathname - The current pathname from react-router* @returns Context object if detected, undefined otherwise*/-export const detectContext = (pathname: string): Context | undefined => {+export const detectContext = (pathname: string): MenuContext => {for (const config of CONTEXT_CONFIGS) {const match = pathname.match(config.matcher);@@ -69,9 +75,9 @@ export const detectContext = (pathname: string): Context | undefined => {context.subPath = match[1];}- return context;+ return context.type;}}- return undefined;+ return 'general';};diff --git a/src/features/CommandMenu/utils/contextCommands.ts b/src/features/CommandMenu/utils/contextCommands.tsindex 0e020115588..8315923f774 100644--- a/src/features/CommandMenu/utils/contextCommands.ts+++ b/src/features/CommandMenu/utils/contextCommands.ts@@ -11,7 +11,7 @@ import {UserCircle,} from 'lucide-react';-import type { ContextType } from '../types';+import type { ContextType, MenuContext } from '../types';export interface ContextCommand {icon: LucideIcon;@@ -122,10 +122,10 @@ export const CONTEXT_COMMANDS: Record<ContextType, ContextCommand[]> = {* Filters out the current page from the list*/export const getContextCommands = (- contextType: ContextType,+ contextType: MenuContext,currentSubPath?: string,): ContextCommand[] => {- const commands = CONTEXT_COMMANDS[contextType] || [];+ const commands = CONTEXT_COMMANDS[contextType as ContextType] || [];// Filter out the current pagereturn commands.filter((cmd) => cmd.subPath !== currentSubPath);diff --git a/src/features/CommandMenu/utils/queryParser.test.ts b/src/features/CommandMenu/utils/queryParser.test.tsnew file mode 100644index 00000000000..49f8c67e6b0--- /dev/null+++ b/src/features/CommandMenu/utils/queryParser.test.ts@@ -0,0 +1,120 @@+import { describe, expect, it } from 'vitest';++import { buildQueryWithType, parseSearchQuery } from './queryParser';++describe('parseSearchQuery', () => {+ it('should parse query without type filter', () => {+ const result = parseSearchQuery('regular search');+ expect(result).toEqual({+ cleanQuery: 'regular search',+ typeFilter: undefined,+ });+ });++ it('should parse query with type: prefix', () => {+ const result = parseSearchQuery('type:agent my search');+ expect(result).toEqual({+ cleanQuery: 'my search',+ typeFilter: 'agent',+ });+ });++ it('should parse query with is: prefix', () => {+ const result = parseSearchQuery('is:message hello world');+ expect(result).toEqual({+ cleanQuery: 'hello world',+ typeFilter: 'message',+ });+ });++ it('should handle type filter at the end of query', () => {+ const result = parseSearchQuery('my search type:topic');+ expect(result).toEqual({+ cleanQuery: 'my search',+ typeFilter: 'topic',+ });+ });++ it('should handle type filter in the middle of query', () => {+ const result = parseSearchQuery('hello type:file world');+ expect(result).toEqual({+ cleanQuery: 'hello world',+ typeFilter: 'file',+ });+ });++ it('should handle case-insensitive type values', () => {+ const result = parseSearchQuery('type:AGENT search');+ expect(result).toEqual({+ cleanQuery: 'search',+ typeFilter: 'agent',+ });+ });++ it('should ignore invalid type values', () => {+ const result = parseSearchQuery('type:invalid search');+ expect(result).toEqual({+ cleanQuery: 'type:invalid search',+ typeFilter: undefined,+ });+ });++ it('should handle empty query', () => {+ const result = parseSearchQuery('');+ expect(result).toEqual({+ cleanQuery: '',+ typeFilter: undefined,+ });+ });++ it('should handle only type filter', () => {+ const result = parseSearchQuery('type:page');+ expect(result).toEqual({+ cleanQuery: '',+ typeFilter: 'page',+ });+ });++ it('should handle all valid types', () => {+ const types = ['agent', 'topic', 'message', 'file', 'page', 'mcp', 'plugin', 'assistant'];++ for (const type of types) {+ const result = parseSearchQuery(`type:${type} search`);+ expect(result.typeFilter).toBe(type);+ expect(result.cleanQuery).toBe('search');+ }+ });++ it('should trim whitespace from clean query', () => {+ const result = parseSearchQuery(' type:agent my search ');+ expect(result).toEqual({+ cleanQuery: 'my search',+ typeFilter: 'agent',+ });+ });++ it('should handle multiple spaces in query', () => {+ const result = parseSearchQuery('type:agent multiple spaces');+ expect(result).toEqual({+ cleanQuery: 'multiple spaces',+ typeFilter: 'agent',+ });+ });+});++describe('buildQueryWithType', () => {+ it('should build query with type filter', () => {+ const result = buildQueryWithType('my search', 'agent');+ expect(result).toBe('type:agent my search');+ });++ it('should handle empty query', () => {+ const result = buildQueryWithType('', 'agent');+ expect(result).toBe('type:agent');+ });++ it('should trim query', () => {+ const result = buildQueryWithType(' my search ', 'topic');+ expect(result).toBe('type:topic my search');+ });+});diff --git a/src/features/CommandMenu/utils/queryParser.ts b/src/features/CommandMenu/utils/queryParser.tsnew file mode 100644index 00000000000..0a3621fcbbf--- /dev/null+++ b/src/features/CommandMenu/utils/queryParser.ts@@ -0,0 +1,93 @@+export interface ParsedQuery {+ /**+ * The cleaned query string without modifiers+ */+ cleanQuery: string;+ /**+ * The detected type filter (if any)+ */+ typeFilter?: ValidSearchType;+}++// Valid types for search filtering+// Note: 'pageContent' is excluded as it's not yet integrated in the backend+const VALID_TYPES = [+ 'agent',+ 'topic',+ 'message',+ 'file',+ 'page',+ 'mcp',+ 'plugin',+ 'communityAgent',+] as const;++export type ValidSearchType = (typeof VALID_TYPES)[number];++/**+ * Parse search query to extract type filters and clean query+ *+ * Supported syntax:+ * - `type:agent search query` - Filter by type+ * - `is:agent search query` - Alternative syntax (GitHub-style)+ *+ * @param query - The raw search query+ * @returns Parsed query with type filter and cleaned query string+ *+ * @example+ * parseSearchQuery('type:agent my search')+ * // => { cleanQuery: 'my search', typeFilter: 'agent' }+ *+ * @example+ * parseSearchQuery('is:message hello')+ * // => { cleanQuery: 'hello', typeFilter: 'message' }+ *+ * @example+ * parseSearchQuery('regular search')+ * // => { cleanQuery: 'regular search', typeFilter: undefined }+ */+export function parseSearchQuery(query: string): ParsedQuery {+ if (!query || typeof query !== 'string') {+ return { cleanQuery: '' };+ }++ let cleanQuery = query.trim();+ let typeFilter: ValidSearchType | undefined;++ // Match type:xxx or is:xxx patterns+ const typePattern = /(?:^|\s)(type|is):(\w+)(?:\s|$)/i;+ const match = cleanQuery.match(typePattern);++ if (match) {+ const [fullMatch, , typeValue] = match;+ const normalizedType = typeValue.toLowerCase();++ // Validate type+ if (VALID_TYPES.includes(normalizedType as ValidSearchType)) {+ typeFilter = normalizedType as ValidSearchType;+ // Remove the type filter from the query+ cleanQuery = cleanQuery.replace(fullMatch, ' ').trim();+ }+ }++ return {+ cleanQuery,+ typeFilter,+ };+}++/**+ * Build a search query string with a type filter+ *+ * @param query - The search query+ * @param type - The type filter to apply+ * @returns Query string with type filter+ *+ * @example+ * buildQueryWithType('my search', 'agent')+ * // => 'type:agent my search'+ */+export function buildQueryWithType(query: string, type: ValidSearchType): string {+ const cleanQuery = query.trim();+ return cleanQuery ? `type:${type} ${cleanQuery}` : `type:${type}`;+}diff --git a/src/features/PageEditor/PageEditor.tsx b/src/features/PageEditor/PageEditor.tsxindex e21e4188d9a..bdf5749a462 100644--- a/src/features/PageEditor/PageEditor.tsx+++ b/src/features/PageEditor/PageEditor.tsx@@ -3,7 +3,7 @@import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';import { Flexbox } from '@lobehub/ui';import { useTheme } from 'antd-style';-import { memo } from 'react';+import { type FC, memo } from 'react';import Loading from '@/components/Loading/BrandTextLoading';import WideScreenContainer from '@/features/WideScreenContainer';@@ -71,30 +71,35 @@ const PageEditorCanvas = memo(() => {** A reusable component. Should NOT depend on context.*/-const PageEditor = memo<PageEditorProps>(- ({ pageId, knowledgeBaseId, onDocumentIdChange, onSave, onDelete, onBack }) => {- const useInitBuiltinAgent = useAgentStore((s) => s.useInitBuiltinAgent);- const pageAgentId = useAgentStore(builtinAgentSelectors.pageAgentId);- useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.pageAgent);+const PageEditor: FC<PageEditorProps> = ({+ pageId,+ knowledgeBaseId,+ onDocumentIdChange,+ onSave,+ onDelete,+ onBack,+}) => {+ const useInitBuiltinAgent = useAgentStore((s) => s.useInitBuiltinAgent);+ const pageAgentId = useAgentStore(builtinAgentSelectors.pageAgentId);+ useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.pageAgent);- if (!pageAgentId) return <Loading debugId="PageEditor > PageAgent Init" />;+ if (!pageAgentId) return <Loading debugId="PageEditor > PageAgent Init" />;- return (- <PageAgentProvider pageAgentId={pageAgentId}>- <PageEditorProvider- key={pageId}- knowledgeBaseId={knowledgeBaseId}- onBack={onBack}- onDelete={onDelete}- onDocumentIdChange={onDocumentIdChange}- onSave={onSave}- pageId={pageId}- >- <PageEditorCanvas />- </PageEditorProvider>- </PageAgentProvider>- );- },-);+ return (+ <PageAgentProvider pageAgentId={pageAgentId}>+ <PageEditorProvider+ key={pageId}+ knowledgeBaseId={knowledgeBaseId}+ onBack={onBack}+ onDelete={onDelete}+ onDocumentIdChange={onDocumentIdChange}+ onSave={onSave}+ pageId={pageId}+ >+ <PageEditorCanvas />+ </PageEditorProvider>+ </PageAgentProvider>+ );+};export default PageEditor;diff --git a/src/features/ResourceManager/components/Editor/index.tsx b/src/features/ResourceManager/components/Editor/index.tsxindex ba9fcb9290a..c1e1ff3a2ae 100644--- a/src/features/ResourceManager/components/Editor/index.tsx+++ b/src/features/ResourceManager/components/Editor/index.tsx@@ -2,7 +2,7 @@import { ActionIcon, Flexbox } from '@lobehub/ui';import { useTheme } from 'antd-style';-import { XIcon } from 'lucide-react';+import { ArrowLeftIcon } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';@@ -39,26 +39,22 @@ const FileEditor = memo(() => {<Flexbox height={'100%'}><NavHeaderleft={- <Flexbox align={'center'} gap={4} horizontal style={{ minHeight: 32 }}>- <Flexbox align={'center'} style={{ marginLeft: 8 }}>- <Breadcrumb- category={category}- fileName={fileDetail?.name}- knowledgeBaseId={libraryId}- />- </Flexbox>- </Flexbox>- }- right={<Flexbox align={'center'} gap={4} horizontal style={{ minHeight: 32 }}><ActionIcon- icon={XIcon}+ icon={ArrowLeftIcon}onClick={() => {setMode('explorer');setCurrentViewItemId(undefined);}}title={t('back')}/>+ <Flexbox align={'center'} style={{ marginLeft: 8 }}>+ <Breadcrumb+ category={category}+ fileName={fileDetail?.name}+ knowledgeBaseId={libraryId}+ />+ </Flexbox></Flexbox>}style={{diff --git a/src/features/ResourceManager/components/Header/AddButton.tsx b/src/features/ResourceManager/components/Header/AddButton.tsxindex 052141c5bf7..e168b8750df 100644--- a/src/features/ResourceManager/components/Header/AddButton.tsx+++ b/src/features/ResourceManager/components/Header/AddButton.tsx@@ -203,9 +203,13 @@ const AddButton = () => {return (<>- <Dropdown menu={{ items }} placement="bottomRight">+ <Dropdown menu={{ items }} placement="bottomRight" trigger={['hover', 'click']}><Buttonicon={Plus}+ onClick={(e) => {+ // Prevent default button behavior that might interfere with dropdown+ e.stopPropagation();+ }}size={'small'}style={{ borderRadius: 8, fontSize: 13, height: 32, paddingRight: 12 }}type="primary"diff --git a/src/locales/default/common.ts b/src/locales/default/common.tsindex a5247e699b2..45f3c5d83f3 100644--- a/src/locales/default/common.ts+++ b/src/locales/default/common.ts@@ -141,13 +141,26 @@ export default {cmdk: {about: '关于',aiModeEmptyState: '在上方输入框中输入你的问题,开始与 AI 对话',+ aiModeHint: 'Enter to ask Lobe AI',aiModePlaceholder: '向 AI 提问...',community: '社区',communitySupport: '社区支持',+ context: {+ agent: '助手',+ community: '社区',+ general: '通用',+ group: '群组',+ memory: '记忆',+ page: '文稿',+ painting: '绘画',+ resource: '资源',+ settings: '设置',+ },discover: '发现',memory: '记忆',navigate: '导航',newAgent: '新建助手',+ newLibrary: '新建库',noResults: '未找到相关结果',openSettings: '打开设置',pages: '文稿',@@ -158,9 +171,11 @@ export default {agents: '助手',assistant: 'AI 助手',assistants: 'AI 助手',+ communityAgent: '社区助手',file: '文件',files: '文件',loading: '搜索中...',+ market: '社区',mcp: 'MCP 服务器',mcps: 'MCP 服务器',message: '对话',@@ -169,6 +184,7 @@ export default {pages: '文稿',plugin: '插件',plugins: '插件',+ searchMore: '搜索更多{{type}}',searching: '搜索结果',topic: '话题',topics: '话题',diff --git a/src/server/routers/lambda/search.ts b/src/server/routers/lambda/search.tsindex 339b8cea661..4755e3f21ac 100644--- a/src/server/routers/lambda/search.ts+++ b/src/server/routers/lambda/search.ts@@ -45,7 +45,7 @@ export const searchRouter = router({offset: z.number().optional(),query: z.string(),type: z- .enum(['agent', 'topic', 'file', 'message', 'mcp', 'plugin', 'assistant'])+ .enum(['agent', 'topic', 'file', 'message', 'page', 'mcp', 'plugin', 'communityAgent']).optional(),}),)@@ -58,8 +58,8 @@ export const searchRouter = router({// Build search promises based on type filterconst searchPromises: Promise<any>[] = [];- // Database searches (agent, topic, file, message)- if (!type || ['agent', 'topic', 'file', 'message'].includes(type)) {+ // Database searches (agent, topic, file, message, page)+ if (!type || ['agent', 'topic', 'file', 'message', 'page'].includes(type)) {searchPromises.push(ctx.searchRepo.search(input));}@@ -132,7 +132,7 @@ export const searchRouter = router({);}- if (!type || type === 'assistant') {+ if (!type || type === 'communityAgent') {searchPromises.push(ctx.discoverService.getAssistantList({