🎨 chore: files feature pre-commit to reduce code update (#3488)

* 🎨 chore: pre commit to reduce code update

* 🎨 chore: pre commit to reduce code update

* 🎨 chore: pre commit to reduce code update

*  test: fix test

* 🚚 refactor: move image files to chat

*  test: add tests

*  test: add tests
This commit is contained in:
Arvin Xu 2024-08-17 22:29:05 +08:00 committed by GitHub
parent 96c34790c1
commit 811e571fe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 353 additions and 122 deletions

1
.npmrc
View file

@ -16,3 +16,4 @@ public-hoist-pattern[]=*stylelint*
public-hoist-pattern[]=@auth/core
public-hoist-pattern[]=@clerk/backend
public-hoist-pattern[]=@clerk/types
public-hoist-pattern[]=pdfjs-dist

2
.nvmrc
View file

@ -1 +1 @@
lts/hydrogen
lts/iron

View file

@ -13,6 +13,7 @@
"autoGenerate": "توليد تلقائي",
"autoGenerateTooltip": "إكمال تلقائي بناءً على الكلمات المقترحة لوصف المساعد",
"autoGenerateTooltipDisabled": "الرجاء إدخال كلمة تلميح قبل تفعيل وظيفة الإكمال التلقائي",
"batchDelete": "حذف دفعة",
"blog": "مدونة المنتجات",
"cancel": "إلغاء",
"changelog": "سجل التغييرات",
@ -31,6 +32,7 @@
"defaultSession": "جلسة افتراضية",
"delete": "حذف",
"document": "وثيقة الاستخدام",
"download": "تحميل",
"duplicate": "إنشاء نسخة",
"edit": "تحرير",
"export": "تصدير الإعدادات",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "الدردشة",
"files": "ملفات",
"market": "الاكتشاف",
"me": "أنا",
"setting": "الإعدادات"

View file

@ -372,6 +372,11 @@
"modelDesc": "يحدد النموذج المستخدم لإنشاء اسم المساعد ووصفه وصورته وعلامته",
"title": "توليد معلومات المساعد تلقائيًا"
},
"queryRewrite": {
"label": "نموذج إعادة صياغة الأسئلة",
"modelDesc": "نموذج مخصص لتحسين أسئلة المستخدمين",
"title": "قاعدة المعرفة"
},
"title": "مساعد النظام",
"topic": {
"label": "نموذج تسمية الموضوع",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Автоматично генериране",
"autoGenerateTooltip": "Автоматично генериране на описание на агент въз основа на подкани",
"autoGenerateTooltipDisabled": "Моля, попълнете подсказката, за да използвате функцията за автоматично допълване",
"batchDelete": "Пакетно изтриване",
"blog": "Продуктов блог",
"cancel": "Отказ",
"changelog": "Дневник на промените",
@ -31,6 +32,7 @@
"defaultSession": "Агент по подразбиране",
"delete": "Изтрий",
"document": "Ръководство за потребителя",
"download": "Изтегляне",
"duplicate": "Създай дубликат",
"edit": "Редактирай",
"export": "Експортирай конфигурация",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Чат",
"files": "Файлове",
"market": "Открий",
"me": "аз",
"setting": "Настройки"

View file

@ -372,6 +372,11 @@
"modelDesc": "Модел, определен за генериране на име, описание, профилна снимка и етикети на помощник",
"title": "Автоматично генериране на информация за помощник"
},
"queryRewrite": {
"label": "Модел за пренаписване на запитвания",
"modelDesc": "Определя модел за оптимизиране на запитванията на потребителите",
"title": "База знания"
},
"title": "Системен асистент",
"topic": {
"label": "Модел за именуване на теми",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Automatisch generieren",
"autoGenerateTooltip": "Assistentenbeschreibung automatisch auf Basis von Vorschlägen vervollständigen",
"autoGenerateTooltipDisabled": "Bitte geben Sie einen Hinweis ein, um die automatische Vervollständigung zu aktivieren",
"batchDelete": "Massenlöschung",
"blog": "Produkt-Blog",
"cancel": "Abbrechen",
"changelog": "Änderungsprotokoll",
@ -31,6 +32,7 @@
"defaultSession": "Standardassistent",
"delete": "Löschen",
"document": "Dokumentation",
"download": "Herunterladen",
"duplicate": "Duplikat erstellen",
"edit": "Bearbeiten",
"export": "Exportieren",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Chat",
"files": "Dateien",
"market": "Entdecken",
"me": "Ich",
"setting": "Einstellung"

View file

@ -372,6 +372,11 @@
"modelDesc": "Das Modell, das zur Generierung von Assistentennamen, -beschreibungen, -avatars und -tags verwendet wird",
"title": "Automatische Generierung von Assistenteninformationen"
},
"queryRewrite": {
"label": "Fragenumformulierung Modell",
"modelDesc": "Modell zur Optimierung der Benutzeranfragen",
"title": "Wissensdatenbank"
},
"title": "Systemassistent",
"topic": {
"label": "Themenbenennungsmodell",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Auto Generate",
"autoGenerateTooltip": "Auto-generate assistant description based on prompts",
"autoGenerateTooltipDisabled": "Please enter a tooltip before using the autocomplete feature",
"batchDelete": "Batch Delete",
"blog": "Product Blog",
"cancel": "Cancel",
"changelog": "Changelog",
@ -31,6 +32,7 @@
"defaultSession": "Default Assistant",
"delete": "Delete",
"document": "User Manual",
"download": "Download",
"duplicate": "Create Duplicate",
"edit": "Edit",
"export": "Export Configuration",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Chat",
"files": "Files",
"market": "Discover",
"me": "Me",
"setting": "Settings"

View file

@ -372,6 +372,11 @@
"modelDesc": "Model designated for generating assistant name, description, avatar, and tags",
"title": "Automatically Generate Assistant Information"
},
"queryRewrite": {
"label": "Question Rewriting Model",
"modelDesc": "Specify the model used to optimize user inquiries",
"title": "Knowledge Base"
},
"title": "System Assistants",
"topic": {
"label": "Topic Naming Model",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Generación automática",
"autoGenerateTooltip": "Completar automáticamente la descripción del asistente basándose en las sugerencias",
"autoGenerateTooltipDisabled": "Por favor, complete la palabra clave antes de usar la función de autocompletar",
"batchDelete": "Eliminar en lote",
"blog": "Blog de productos",
"cancel": "Cancelar",
"changelog": "Registro de cambios",
@ -31,6 +32,7 @@
"defaultSession": "Sesión predeterminada",
"delete": "Eliminar",
"document": "Documento de uso",
"download": "Descargar",
"duplicate": "Duplicar",
"edit": "Editar",
"export": "Exportar configuración",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Chat",
"files": "Archivos",
"market": "Descubrir",
"me": "Yo",
"setting": "Configuración"

View file

@ -372,6 +372,11 @@
"modelDesc": "Modelo designado para generar el nombre, descripción, avatar y etiquetas del asistente",
"title": "Generación automática de información del asistente"
},
"queryRewrite": {
"label": "Modelo de reescritura de preguntas",
"modelDesc": "Modelo designado para optimizar las preguntas de los usuarios",
"title": "Base de conocimientos"
},
"title": "Asistente del sistema",
"topic": {
"label": "Modelo de nombramiento de temas",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Générer automatiquement",
"autoGenerateTooltip": "Générer automatiquement la description de l'agent basée sur les suggestions",
"autoGenerateTooltipDisabled": "Veuillez saisir un mot-clé avant d'activer la fonction de complétion automatique",
"batchDelete": "Suppression en masse",
"blog": "Blog des produits",
"cancel": "Annuler",
"changelog": "Journal des modifications",
@ -31,6 +32,7 @@
"defaultSession": "Session par défaut",
"delete": "Supprimer",
"document": "Document d'utilisation",
"download": "Télécharger",
"duplicate": "Dupliquer",
"edit": "Modifier",
"export": "Exporter",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Conversation",
"files": "Fichiers",
"market": "Découvrir",
"me": "moi",
"setting": "Paramètre"

View file

@ -372,6 +372,11 @@
"modelDesc": "Modèle spécifié pour générer le nom, la description, l'avatar et les balises de l'assistant",
"title": "Génération automatique des informations de l'assistant"
},
"queryRewrite": {
"label": "Modèle de reformulation des questions",
"modelDesc": "Modèle utilisé pour optimiser les questions des utilisateurs",
"title": "Base de connaissances"
},
"title": "Agent système",
"topic": {
"label": "Modèle de nommage des sujets",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Generazione automatica",
"autoGenerateTooltip": "Completamento automatico basato su suggerimenti",
"autoGenerateTooltipDisabled": "Si prega di compilare il campo suggerimento per abilitare la funzione di completamento automatico",
"batchDelete": "Elimina in batch",
"blog": "Blog sui prodotti",
"cancel": "Annulla",
"changelog": "Registro modifiche",
@ -31,6 +32,7 @@
"defaultSession": "Sessione predefinita",
"delete": "Elimina",
"document": "Documento di utilizzo",
"download": "Scarica",
"duplicate": "Duplicato",
"edit": "Modifica",
"export": "Esporta configurazione",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Chat",
"files": "File",
"market": "Scopri",
"me": "io",
"setting": "Impostazioni"

View file

@ -372,6 +372,11 @@
"modelDesc": "Modello specificato per generare nome, descrizione, avatar e etichetta dell'assistente",
"title": "Genera automaticamente informazioni sull'assistente"
},
"queryRewrite": {
"label": "Modello di riscrittura delle domande",
"modelDesc": "Modello specificato per ottimizzare le domande degli utenti",
"title": "Banca dati"
},
"title": "Assistente di sistema",
"topic": {
"label": "Modello di denominazione degli argomenti",

View file

@ -13,6 +13,7 @@
"autoGenerate": "自動生成",
"autoGenerateTooltip": "ヒントに基づいてエージェントの説明を自動生成します",
"autoGenerateTooltipDisabled": "ツールチップを入力してから自動生成機能を使用してください",
"batchDelete": "バッチ削除",
"blog": "製品ブログ",
"cancel": "キャンセル",
"changelog": "変更履歴",
@ -31,6 +32,7 @@
"defaultSession": "デフォルトセッション",
"delete": "削除",
"document": "ドキュメント",
"download": "ダウンロード",
"duplicate": "コピーを作成する",
"edit": "編集",
"export": "エクスポート",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "チャット",
"files": "ファイル",
"market": "探す",
"me": "私",
"setting": "設定"

View file

@ -372,6 +372,11 @@
"modelDesc": "アシスタントの名前、説明、アバター、ラベルを生成するために指定されたモデル",
"title": "アシスタント情報の自動生成"
},
"queryRewrite": {
"label": "質問リライトモデル",
"modelDesc": "ユーザーの質問を最適化するために指定されたモデル",
"title": "知識ベース"
},
"title": "システムアシスタント",
"topic": {
"label": "トピックネーミングモデル",

View file

@ -13,6 +13,7 @@
"autoGenerate": "자동 생성",
"autoGenerateTooltip": "힌트 단어를 기반으로 에이전트 설명을 자동으로 완성합니다",
"autoGenerateTooltipDisabled": "자동 완성 기능을 사용하려면 툴팁을 입력하십시오",
"batchDelete": "일괄 삭제",
"blog": "제품 블로그",
"cancel": "취소",
"changelog": "변경 로그",
@ -31,6 +32,7 @@
"defaultSession": "기본 세션",
"delete": "삭제",
"document": "사용 설명서",
"download": "다운로드",
"duplicate": "복제품 만들기",
"edit": "편집",
"export": "내보내기",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "채팅",
"files": "파일",
"market": "발견",
"me": "나",
"setting": "설정"

View file

@ -372,6 +372,11 @@
"modelDesc": "어시스턴트 이름, 설명, 프로필 이미지, 레이블을 생성하는 데 사용되는 모델을 지정합니다.",
"title": "어시스턴트 정보 자동 생성"
},
"queryRewrite": {
"label": "질문 재작성 모델",
"modelDesc": "사용자의 질문을 최적화하는 데 사용되는 모델 지정",
"title": "지식 베이스"
},
"title": "시스템 도우미",
"topic": {
"label": "주제 명명 모델",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Automatisch genereren",
"autoGenerateTooltip": "Automatisch assistentbeschrijving genereren op basis van suggesties",
"autoGenerateTooltipDisabled": "Schakel de automatische aanvulling in nadat u een suggestiewoord heeft ingevoerd",
"batchDelete": "Batch verwijderen",
"blog": "Product Blog",
"cancel": "Annuleren",
"changelog": "Wijzigingslogboek",
@ -31,6 +32,7 @@
"defaultSession": "Standaard assistent",
"delete": "Verwijderen",
"document": "Gebruiksaanwijzing",
"download": "Downloaden",
"duplicate": "Dupliceren",
"edit": "Bewerken",
"export": "Exporteren",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Chat",
"files": "Bestanden",
"market": "Ontdekken",
"me": "Ik",
"setting": "Instellingen"

View file

@ -372,6 +372,11 @@
"modelDesc": "Model voor het genereren van assistentnaam, beschrijving, profielfoto en labels",
"title": "Automatisch assistentinformatie genereren"
},
"queryRewrite": {
"label": "Vraag herschrijvingsmodel",
"modelDesc": "Model dat is opgegeven voor het optimaliseren van gebruikersvragen",
"title": "Kennisbank"
},
"title": "Systeemassistent",
"topic": {
"label": "Onderwerp Naamgevingsmodel",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Automatyczne generowanie",
"autoGenerateTooltip": "Automatyczne uzupełnianie opisu asystenta na podstawie sugestii",
"autoGenerateTooltipDisabled": "Proszę wprowadzić słowo kluczowe przed użyciem funkcji automatycznego uzupełniania",
"batchDelete": "Usuń wiele",
"blog": "Blog produktowy",
"cancel": "Anuluj",
"changelog": "Dziennik zmian",
@ -31,6 +32,7 @@
"defaultSession": "Domyślna sesja",
"delete": "Usuń",
"document": "Dokumentacja",
"download": "Pobierz",
"duplicate": "Utwórz kopię",
"edit": "Edytuj",
"export": "Eksportuj ustawienia",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Czat",
"files": "Pliki",
"market": "Odkrywaj",
"me": "ja",
"setting": "Ustawienia"

View file

@ -372,6 +372,11 @@
"modelDesc": "Określa model używany do generowania nazwy, opisu, awatara i etykiety asystenta",
"title": "Automatyczne generowanie informacji o asystencie"
},
"queryRewrite": {
"label": "Model przekształcania zapytań",
"modelDesc": "Model używany do optymalizacji zapytań użytkowników",
"title": "Baza wiedzy"
},
"title": "Asystent Systemowy",
"topic": {
"label": "Model nazewnictwa tematów",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Auto completar",
"autoGenerateTooltip": "Auto completar descrição do assistente com base em sugestões",
"autoGenerateTooltipDisabled": "Por favor, preencha a dica antes de usar a função de preenchimento automático",
"batchDelete": "Excluir em massa",
"blog": "Blog de Produtos",
"cancel": "Cancelar",
"changelog": "Registro de alterações",
@ -31,6 +32,7 @@
"defaultSession": "Sessão padrão",
"delete": "Excluir",
"document": "Documento de Uso",
"download": "Baixar",
"duplicate": "Duplicar",
"edit": "Editar",
"export": "Exportar configuração",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Chat",
"files": "Arquivos",
"market": "Descobrir",
"me": "eu",
"setting": "Configuração"

View file

@ -372,6 +372,11 @@
"modelDesc": "Especifica o modelo usado para gerar o nome, descrição, avatar e tags do assistente",
"title": "Geração Automática de Informações do Assistente"
},
"queryRewrite": {
"label": "Modelo de Reescrita de Perguntas",
"modelDesc": "Modelo designado para otimizar as perguntas dos usuários",
"title": "Base de Conhecimento"
},
"title": "Assistente do Sistema",
"topic": {
"label": "Modelo de Nomeação de Tópicos",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Автозаполнение",
"autoGenerateTooltip": "Автоматическое дополнение описания агента на основе подсказок",
"autoGenerateTooltipDisabled": "Пожалуйста, введите подсказку перед использованием функции автозаполнения",
"batchDelete": "Пакетное удаление",
"blog": "Блог о продуктах",
"cancel": "Отмена",
"changelog": "История изменений",
@ -31,6 +32,7 @@
"defaultSession": "Пользовательский агент",
"delete": "Удалить",
"document": "Документация",
"download": "Скачать",
"duplicate": "Создать копию",
"edit": "Редактировать",
"export": "Экспорт настроек",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Чат",
"files": "Файлы",
"market": "Обзор",
"me": "я",
"setting": "Настройки"

View file

@ -372,6 +372,11 @@
"modelDesc": "Модель, используемая для генерации имени агента, описания, аватара и меток",
"title": "Автоматическое создание информации об агенте"
},
"queryRewrite": {
"label": "Модель переформулирования вопросов",
"modelDesc": "Модель, предназначенная для оптимизации вопросов пользователей",
"title": "База знаний"
},
"title": "Системный агент",
"topic": {
"label": "Модель именования тем",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Otomatik Oluştur",
"autoGenerateTooltip": "Auto-generate agent description based on prompts",
"autoGenerateTooltipDisabled": "Otomatik tamamlama işlevini kullanmadan önce ipucu kelimesini girin",
"batchDelete": "Toplu Sil",
"blog": "Ürün Blogu",
"cancel": "İptal",
"changelog": "Changelog",
@ -31,6 +32,7 @@
"defaultSession": "Varsayılan Asistan",
"delete": "Sil",
"document": "Belge",
"download": "İndir",
"duplicate": "Kopya oluştur",
"edit": "Düzenle",
"export": "Dışa Aktar",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Chat",
"files": "Dosyalar",
"market": "Keşfet",
"me": "ben",
"setting": "Ayarlar"

View file

@ -372,6 +372,11 @@
"modelDesc": "Asistan adı, açıklaması, avatar ve etiket oluşturmak için belirlenen model",
"title": "Asistan Bilgilerini Otomatik Oluştur"
},
"queryRewrite": {
"label": "Soru Yeniden Yazım Modeli",
"modelDesc": "Kullanıcı sorularını optimize etmek için kullanılan model",
"title": "Bilgi Tabanı"
},
"title": "Sistem Asistanı",
"topic": {
"label": "Konu Adlandırma Modeli",

View file

@ -13,6 +13,7 @@
"autoGenerate": "Tự động tạo",
"autoGenerateTooltip": "Tự động hoàn thành mô tả trợ lý dựa trên từ gợi ý",
"autoGenerateTooltipDisabled": "Vui lòng nhập từ gợi ý trước khi sử dụng tính năng tự động hoàn thành",
"batchDelete": "Xóa hàng loạt",
"blog": "Blog sản phẩm",
"cancel": "Hủy",
"changelog": "Nhật ký cập nhật",
@ -31,6 +32,7 @@
"defaultSession": "Phiên mặc định",
"delete": "Xóa",
"document": "Tài Liệu Sử Dụng",
"download": "Tải xuống",
"duplicate": "Tạo bản sao",
"edit": "Chỉnh sửa",
"export": "Xuất cấu hình",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "Trò chuyện",
"files": "Tệp",
"market": "Thị trường",
"me": "Tôi",
"setting": "Cài đặt"

View file

@ -372,6 +372,11 @@
"modelDesc": "Xác định mô hình được sử dụng để tạo tên, mô tả, hình đại diện, nhãn cho trợ lý",
"title": "Tự động tạo thông tin trợ lý"
},
"queryRewrite": {
"label": "Mô hình viết lại câu hỏi",
"modelDesc": "Mô hình được chỉ định để tối ưu hóa câu hỏi của người dùng",
"title": "Kho tri thức"
},
"title": "Trợ lý hệ thống",
"topic": {
"label": "Mô hình đặt tên chủ đề",

View file

@ -13,6 +13,7 @@
"autoGenerate": "自动补全",
"autoGenerateTooltip": "基于提示词自动补全助手描述",
"autoGenerateTooltipDisabled": "请填写提示词后使用自动补全功能",
"batchDelete": "批量删除",
"blog": "产品博客",
"cancel": "取消",
"changelog": "更新日志",
@ -31,6 +32,7 @@
"defaultSession": "自定义助手",
"delete": "删除",
"document": "使用文档",
"download": "下载",
"duplicate": "创建副本",
"edit": "编辑",
"export": "导出配置",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "会话",
"files": "文件",
"market": "发现",
"me": "我",
"setting": "设置"

View file

@ -60,7 +60,7 @@
"PluginManifestNotFound": "很抱歉,服务器没有找到该插件的描述清单 (manifest.json),请检查插件描述文件地址是否正确",
"PluginManifestInvalid": "很抱歉,该插件的描述清单校验未通过,请检查描述清单格式是否规范",
"PluginApiNotFound": "很抱歉,插件描述清单中不存在该 API ,请检查你的请求方法与插件清单 API 是否匹配",
"PluginApiParamsError": "很抱歉,该插件请求的入参校验未通过,请检查入参与 API 描述信息是否匹配",
"PluginApiParamsError": "很抱歉,该插件请求的入参校验未通过,请检查入参与 Api 描述信息是否匹配",
"PluginSettingsInvalid": "该插件需要正确配置后才可以使用,请检查你的配置是否正确",
"PluginServerError": "插件服务端请求返回出错,请检查根据下面的报错信息检查你的插件描述文件、插件配置或服务端实现",
"PluginGatewayError": "很抱歉,插件网关出现错误,请检查插件网关配置是否正确",

View file

@ -51,7 +51,7 @@
},
"checker": {
"button": "检查",
"desc": "测试 API Key 与代理地址是否正确填写",
"desc": "测试 Api Key 与代理地址是否正确填写",
"pass": "检查通过",
"title": "连通性检查"
},
@ -372,6 +372,11 @@
"modelDesc": "指定用于生成助理名称、描述、头像、标签的模型",
"title": "自动生成助理信息"
},
"queryRewrite": {
"label": "提问重写模型",
"modelDesc": "指定用于优化用户提问的模型",
"title": "知识库"
},
"title": "系统助手",
"topic": {
"label": "话题命名模型",

View file

@ -13,6 +13,7 @@
"autoGenerate": "自動生成",
"autoGenerateTooltip": "基於提示詞自動生成助手描述",
"autoGenerateTooltipDisabled": "請填寫提示詞後使用自動補全功能",
"batchDelete": "批次刪除",
"blog": "產品部落格",
"cancel": "取消",
"changelog": "變更日誌",
@ -31,6 +32,7 @@
"defaultSession": "預設助手",
"delete": "刪除",
"document": "使用說明文件",
"download": "下載",
"duplicate": "建立副本",
"edit": "編輯",
"export": "匯出設定",
@ -192,6 +194,7 @@
},
"tab": {
"chat": "對話",
"files": "檔案",
"market": "發現",
"me": "我",
"setting": "設定"

View file

@ -372,6 +372,11 @@
"modelDesc": "指定用於生成助理名稱、描述、頭像、標籤的模型",
"title": "自動生成助理資訊"
},
"queryRewrite": {
"label": "提問重寫模型",
"modelDesc": "指定用於優化用戶提問的模型",
"title": "知識庫"
},
"title": "系統助手",
"topic": {
"label": "話題命名模型",

View file

@ -12,8 +12,8 @@ const basePath = process.env.NEXT_PUBLIC_BASE_PATH;
/** @type {import('next').NextConfig} */
const nextConfig = {
compress: isProd,
basePath,
compress: isProd,
experimental: {
optimizePackageImports: [
'emoji-mart',
@ -28,21 +28,98 @@ const nextConfig = {
webVitalsAttribution: ['CLS', 'LCP'],
},
output: buildWithDocker ? 'standalone' : undefined,
async headers() {
return [
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/icons/(.*).(png|jpe?g|gif|svg|ico|webp)',
},
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/images/(.*).(png|jpe?g|gif|svg|ico|webp)',
},
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/videos/(.*).(mp4|webm|ogg|avi|mov|wmv|flv|mkv)',
},
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/screenshots/(.*).(png|jpe?g|gif|svg|ico|webp)',
},
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/og/(.*).(png|jpe?g|gif|svg|ico|webp)',
},
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/favicon.ico',
},
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/favicon-32x32.ico',
},
{
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
source: '/apple-touch-icon.png',
},
];
},
output: buildWithDocker ? 'standalone' : undefined,
reactStrictMode: true,
redirects: async () => [
{
source: '/settings',
permanent: true,
destination: '/settings/common',
permanent: true,
source: '/settings',
},
],
rewrites: async () => [
// due to google api not work correct in some countries
// we need a proxy to bypass the restriction
{ source: '/api/chat/google', destination: `${API_PROXY_ENDPOINT}/api/chat/google` },
{ destination: `${API_PROXY_ENDPOINT}/api/chat/google`, source: '/api/chat/google' },
],
reactStrictMode: true,
webpack(config) {
config.experiments = {
@ -53,94 +130,19 @@ const nextConfig = {
// to fix shikiji compile error
// refs: https://github.com/antfu/shikiji/issues/23
config.module.rules.push({
test: /\.m?js$/,
type: 'javascript/auto',
resolve: {
fullySpecified: false,
},
test: /\.m?js$/,
type: 'javascript/auto',
});
// https://github.com/pinojs/pino/issues/688#issuecomment-637763276
config.externals.push('pino-pretty');
return config;
},
config.resolve.alias.canvas = false;
async headers() {
return [
{
source: '/icons/(.*).(png|jpe?g|gif|svg|ico|webp)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/images/(.*).(png|jpe?g|gif|svg|ico|webp)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/videos/(.*).(mp4|webm|ogg|avi|mov|wmv|flv|mkv)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/screenshots/(.*).(png|jpe?g|gif|svg|ico|webp)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/og/(.*).(png|jpe?g|gif|svg|ico|webp)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/favicon.ico',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/favicon-32x32.ico',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/apple-touch-icon.png',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
];
return config;
},
};
@ -165,20 +167,26 @@ const withSentry =
withSentryConfig(
c,
{
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
// Suppresses source map uploading logs during build
silent: true,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Enables automatic instrumentation of Vercel Cron Monitors.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,
@ -188,19 +196,12 @@ const withSentry =
// side errors will fail.
tunnelRoute: '/monitoring',
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
// Enables automatic instrumentation of Vercel Cron Monitors.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
},
)
: noWrapper;
export default withBundleAnalyzer(withPWA(withSentry(nextConfig)));
export default withBundleAnalyzer(withPWA(withSentry(nextConfig)));

View file

@ -32,12 +32,12 @@
"build-sitemap": "next-sitemap --config next-sitemap.config.mjs",
"build:analyze": "ANALYZE=true next build",
"build:docker": "DOCKER=true next build && npm run build-sitemap",
"db:generate": "drizzle-kit generate -- dotenv_config_path='.env'",
"db:generate": "drizzle-kit generate",
"db:migrate": "MIGRATION_DB=1 tsx scripts/migrateServerDB/index.ts",
"db:push": "drizzle-kit push -- dotenv_config_path='.env'",
"db:push-test": "NODE_ENV=test drizzle-kit push -- dotenv_config_path='.env'",
"db:push": "drizzle-kit push",
"db:push-test": "NODE_ENV=test drizzle-kit push",
"db:studio": "drizzle-kit studio",
"db:z-pull": "drizzle-kit introspect -- dotenv_config_path='.env'",
"db:z-pull": "drizzle-kit introspect",
"dev": "next dev -p 3010",
"dev:clerk-proxy": "ngrok http http://localhost:3011",
"docs:i18n": "lobe-i18n md && npm run lint:mdx",
@ -110,14 +110,16 @@
"@clerk/localizations": "2.0.0",
"@clerk/nextjs": "^5.2.14",
"@clerk/themes": "^2.1.10",
"@cyntler/react-doc-viewer": "^1.16.6",
"@google/generative-ai": "^0.16.0",
"@icons-pack/react-simple-icons": "9.6.0",
"@khmyznikov/pwa-install": "^0.3.9",
"@langchain/community": "^0.2.27",
"@lobehub/chat-plugin-sdk": "^1.32.4",
"@lobehub/chat-plugins-gateway": "^1.9.0",
"@lobehub/icons": "^1.28.0",
"@lobehub/tts": "^1.24.3",
"@lobehub/ui": "^1.147.0",
"@lobehub/ui": "^1.149.2",
"@microsoft/fetch-event-source": "^2.0.1",
"@neondatabase/serverless": "^0.9.4",
"@next/third-parties": "^14.2.4",
@ -129,10 +131,11 @@
"@trpc/react-query": "next",
"@trpc/server": "next",
"@vercel/analytics": "^1.3.1",
"@vercel/edge-config": "^1.2.1",
"@vercel/speed-insights": "^1.0.12",
"ahooks": "^3.8.0",
"ai": "^3.2.16",
"antd": "^5.19.1",
"antd": "5.20.0",
"antd-style": "^3.6.2",
"brotli-wasm": "^3.0.1",
"chroma-js": "^2.4.2",
@ -143,6 +146,7 @@
"drizzle-orm": "^0.32.0",
"drizzle-zod": "^0.5.1",
"fast-deep-equal": "^3.1.3",
"file-type": "^19.4.1",
"gpt-tokenizer": "^2.1.2",
"i18next": "^23.11.5",
"i18next-browser-languagedetector": "^7.2.1",
@ -151,10 +155,13 @@
"immer": "^10.1.1",
"ip": "^2.0.1",
"jose": "^5.6.3",
"js-sha256": "^0.11.0",
"langchain": "^0.2.16",
"langfuse": "^3.14.0",
"langfuse-core": "^3.14.0",
"lodash-es": "^4.17.21",
"lucide-react": "latest",
"mammoth": "^1.8.0",
"modern-screenshot": "^4.4.39",
"nanoid": "^5.0.7",
"next": "^14.2.4",
@ -162,9 +169,12 @@
"next-sitemap": "^4.2.3",
"numeral": "^2.0.6",
"nuqs": "^1.17.4",
"officeparser": "^4.1.1",
"ollama": "^0.5.8",
"openai": "~4.54.0",
"partial-json": "^0.1.7",
"pdf-parse": "^1.1.1",
"pdfjs-dist": "4.4.168",
"pg": "^8.12.0",
"pino": "^9.2.0",
"polished": "^4.3.1",
@ -179,6 +189,7 @@
"react-i18next": "14.0.2",
"react-layout-kit": "^1.9.0",
"react-lazy-load": "^4.0.1",
"react-pdf": "^9.1.0",
"react-virtuoso": "^4.7.11",
"react-wrap-balancer": "^1.1.1",
"remark": "^14.0.3",
@ -194,6 +205,7 @@
"systemjs": "^6.15.1",
"ts-md5": "^1.3.1",
"ua-parser-js": "^1.0.38",
"unstructured-client": "^0.11.3",
"url-join": "^5.0.0",
"use-merge-value": "^1.2.0",
"utility-types": "^3.11.0",
@ -211,7 +223,7 @@
"@commitlint/cli": "^19.3.0",
"@ducanh2912/next-pwa": "^10.2.7",
"@edge-runtime/vm": "^4.0.0",
"@lobehub/i18n-cli": "^1.18.1",
"@lobehub/i18n-cli": "^1.19.1",
"@lobehub/lint": "^1.24.3",
"@lobehub/seo-cli": "^1.4.1",
"@next/bundle-analyzer": "^14.2.4",

View file

@ -71,6 +71,17 @@ describe('TopActions', () => {
expect(screen.queryByText('tab.market')).not.toBeInTheDocument();
});
it('should render File icon when `-knowledge_base` is set', () => {
act(() => {
createServerConfigStore().setState({ featureFlags: { knowledge_base: false } });
});
renderTopActions();
expect(screen.getByText('tab.chat')).toBeInTheDocument();
expect(screen.queryByText('tab.files')).not.toBeInTheDocument();
});
it('should switch back to previous active session', () => {
act(() => {
useSessionStore.setState({ activeId: '1' });

View file

@ -1,5 +1,5 @@
import { ActionIcon } from '@lobehub/ui';
import { Compass, MessageSquare } from 'lucide-react';
import { Compass, FolderClosed, MessageSquare } from 'lucide-react';
import Link from 'next/link';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@ -17,6 +17,7 @@ const TopActions = memo<TopActionProps>(({ tab }) => {
const { t } = useTranslation('common');
const switchBackToChat = useGlobalStore((s) => s.switchBackToChat);
const { showMarket } = useServerConfigStore(featureFlagsSelectors);
const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors);
return (
<>
@ -36,6 +37,17 @@ const TopActions = memo<TopActionProps>(({ tab }) => {
title={t('tab.chat')}
/>
</Link>
{enableKnowledgeBase && (
<Link aria-label={t('tab.files')} href={'/files'}>
<ActionIcon
active={tab === SidebarTabKey.Files}
icon={FolderClosed}
placement={'right'}
size="large"
title={t('tab.files')}
/>
</Link>
)}
{showMarket && (
<Link aria-label={t('tab.market')} href={'/market'}>
<ActionIcon

View file

@ -23,6 +23,8 @@ export const FeatureFlagsSchema = z.object({
market: z.boolean().optional(),
speech_to_text: z.boolean().optional(),
knowledge_base: z.boolean().optional(),
});
// TypeScript 类型,从 Zod schema 生成
@ -44,6 +46,8 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
check_updates: true,
welcome_suggest: true,
knowledge_base: false,
clerk_sign_up: true,
cloud_promotion: false,
@ -70,6 +74,8 @@ export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
enableClerkSignUp: config.clerk_sign_up,
enableKnowledgeBase: config.knowledge_base,
showCloudPromotion: config.cloud_promotion,
showMarket: config.market,

View file

@ -10,6 +10,9 @@ export const getFileConfig = () => {
NEXT_PUBLIC_S3_FILE_PATH: z.string().optional(),
},
runtimeEnv: {
CHUNKS_AUTO_EMBEDDING: process.env.CHUNKS_AUTO_EMBEDDING !== '0',
CHUNKS_AUTO_GEN_METADATA: process.env.CHUNKS_AUTO_GEN_METADATA !== '0',
NEXT_PUBLIC_S3_DOMAIN: process.env.NEXT_PUBLIC_S3_DOMAIN,
NEXT_PUBLIC_S3_FILE_PATH: process.env.NEXT_PUBLIC_S3_FILE_PATH || DEFAULT_S3_FILE_PATH,
@ -21,6 +24,9 @@ export const getFileConfig = () => {
S3_SET_ACL: process.env.S3_SET_ACL !== '0',
},
server: {
CHUNKS_AUTO_EMBEDDING: z.boolean(),
CHUNKS_AUTO_GEN_METADATA: z.boolean(),
// S3
S3_ACCESS_KEY_ID: z.string().optional(),
S3_BUCKET: z.string().optional(),

17
src/config/knowledge.ts Normal file
View file

@ -0,0 +1,17 @@
import { createEnv } from '@t3-oss/env-nextjs';
import { z } from 'zod';
export const getKnowledgeConfig = () => {
return createEnv({
runtimeEnv: {
UNSTRUCTURED_API_KEY: process.env.UNSTRUCTURED_API_KEY,
UNSTRUCTURED_SERVER_URL: process.env.UNSTRUCTURED_SERVER_URL,
},
server: {
UNSTRUCTURED_API_KEY: z.string().optional(),
UNSTRUCTURED_SERVER_URL: z.string().optional(),
},
});
};
export const knowledgeEnv = getKnowledgeConfig();

View file

@ -122,5 +122,6 @@ export const DEFAULT_LLM_CONFIG: UserModelProviderConfig = {
};
export const DEFAULT_MODEL = 'gpt-4o-mini';
export const DEFAULT_EMBEDDING_MODEL = 'text-embedding-3-small';
export const DEFAULT_PROVIDER = ModelProvider.OpenAI;

View file

@ -9,6 +9,7 @@ export const DEFAULT_SYSTEM_AGENT_ITEM: SystemAgentItem = {
export const DEFAULT_SYSTEM_AGENT_CONFIG: UserSystemAgentConfig = {
agentMeta: DEFAULT_SYSTEM_AGENT_ITEM,
queryRewrite: DEFAULT_SYSTEM_AGENT_ITEM,
topic: DEFAULT_SYSTEM_AGENT_ITEM,
translation: DEFAULT_SYSTEM_AGENT_ITEM,
};

View file

@ -14,6 +14,7 @@ export default {
autoGenerate: '自动补全',
autoGenerateTooltip: '基于提示词自动补全助手描述',
autoGenerateTooltipDisabled: '请填写提示词后使用自动补全功能',
batchDelete: '批量删除',
blog: '产品博客',
cancel: '取消',
changelog: '更新日志',
@ -32,6 +33,7 @@ export default {
defaultSession: '自定义助手',
delete: '删除',
document: '使用文档',
download: '下载',
duplicate: '创建副本',
edit: '编辑',
export: '导出配置',
@ -185,6 +187,7 @@ export default {
},
tab: {
chat: '会话',
files: '文件',
market: '发现',
me: '我',
setting: '设置',

View file

@ -375,6 +375,11 @@ export default {
modelDesc: '指定用于生成助理名称、描述、头像、标签的模型',
title: '自动生成助理信息',
},
queryRewrite: {
label: '提问重写模型',
modelDesc: '指定用于优化用户提问的模型',
title: '知识库',
},
title: '系统助手',
topic: {
label: '话题命名模型',

View file

@ -1,4 +1,4 @@
import { ImageFileState, initialImageFileState } from './slices/images';
import { ImageFileState, initialImageFileState } from './slices/chat';
export type FilesStoreState = ImageFileState;

View file

@ -1,4 +1,4 @@
import { filesSelectors as imageFilesSelectors } from './slices/images';
import { filesSelectors as imageFilesSelectors } from './slices/chat';
import { ttsFilesSelectors } from './slices/tts';
export const filesSelectors = {

View file

@ -4,7 +4,7 @@ import { StateCreator } from 'zustand/vanilla';
import { createDevtools } from '../middleware/createDevtools';
import { FilesStoreState, initialState } from './initialState';
import { FileAction, createFileSlice } from './slices/images';
import { FileAction, createFileSlice } from './slices/chat';
import { TTSFileAction, createTTSFileSlice } from './slices/tts';
// =============== 聚合 createStoreFn ============ //

View file

@ -5,6 +5,7 @@ import { AsyncLocalStorage } from '@/utils/localStorage';
export enum SidebarTabKey {
Chat = 'chat',
Files = 'files',
Market = 'market',
Me = 'me',
Setting = 'settings',
@ -32,12 +33,14 @@ export enum SettingsTabs {
export interface SystemStatus {
// which sessionGroup should expand
expandSessionGroupKeys: string[];
filePanelWidth: number;
hidePWAInstaller?: boolean;
inputHeight: number;
mobileShowPortal?: boolean;
mobileShowTopic?: boolean;
sessionsWidth: number;
showChatSideBar?: boolean;
showFilePanel?: boolean;
showSessionPanel?: boolean;
showSystemRole?: boolean;
}
@ -55,11 +58,13 @@ export interface GlobalState {
export const INITIAL_STATUS = {
expandSessionGroupKeys: [SessionDefaultGroup.Pinned, SessionDefaultGroup.Default],
filePanelWidth: 320,
hidePWAInstaller: false,
inputHeight: 200,
mobileShowTopic: false,
sessionsWidth: 320,
showChatSideBar: true,
showFilePanel: true,
showSessionPanel: true,
showSystemRole: false,
} satisfies SystemStatus;

View file

@ -10,12 +10,15 @@ const mobileShowTopic = (s: GlobalStore) => s.status.mobileShowTopic;
const mobileShowPortal = (s: GlobalStore) => s.status.mobileShowPortal;
const showChatSideBar = (s: GlobalStore) => s.status.showChatSideBar;
const showSessionPanel = (s: GlobalStore) => s.status.showSessionPanel;
const showFilePanel = (s: GlobalStore) => s.status.showFilePanel;
const hidePWAInstaller = (s: GlobalStore) => s.status.hidePWAInstaller;
const sessionWidth = (s: GlobalStore) => s.status.sessionsWidth;
const filePanelWidth = (s: GlobalStore) => s.status.filePanelWidth;
const inputHeight = (s: GlobalStore) => s.status.inputHeight;
export const systemStatusSelectors = {
filePanelWidth,
hidePWAInstaller,
inputHeight,
mobileShowPortal,
@ -23,6 +26,7 @@ export const systemStatusSelectors = {
sessionGroupKeys,
sessionWidth,
showChatSideBar,
showFilePanel,
showSessionPanel,
showSystemRole,
};

View file

@ -21,6 +21,7 @@ describe('featureFlagsSelectors', () => {
isAgentEditable: false,
showCreateSession: true,
showDalle: true,
enableKnowledgeBase: false,
showLLM: false,
showCloudPromotion: false,
showOpenAIApiKey: true,

View file

@ -1,4 +1,5 @@
import { DeepPartial } from 'utility-types';
import { z } from 'zod';
import { UserSettings } from '@/types/user/settings';
@ -12,17 +13,24 @@ export interface LobeUser {
username?: string | null;
}
export interface UserGuide {
export const UserGuideSchema = z.object({
/**
* Move the settings button to the avatar dropdown
*/
moveSettingsToAvatar?: boolean;
moveSettingsToAvatar: z.boolean().optional(),
/**
* Topic Guide
*/
topic?: boolean;
}
topic: z.boolean().optional(),
/**
* tell user that uploaded files can be found in knowledge base
*/
uploadFileInKnowledgeBase: z.boolean().optional(),
});
export type UserGuide = z.infer<typeof UserGuideSchema>;
export interface UserPreference {
guide?: UserGuide;

View file

@ -5,6 +5,7 @@ export interface SystemAgentItem {
export interface UserSystemAgentConfig {
agentMeta: SystemAgentItem;
queryRewrite: SystemAgentItem;
topic: SystemAgentItem;
translation: SystemAgentItem;
}