@lobehub/chat 1.68.10 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/changelog/v1.json +18 -0
  3. package/locales/ar/chat.json +8 -0
  4. package/locales/ar/models.json +6 -0
  5. package/locales/bg-BG/chat.json +8 -0
  6. package/locales/bg-BG/models.json +6 -0
  7. package/locales/de-DE/chat.json +8 -0
  8. package/locales/de-DE/models.json +6 -0
  9. package/locales/en-US/chat.json +8 -0
  10. package/locales/en-US/models.json +6 -0
  11. package/locales/es-ES/chat.json +8 -0
  12. package/locales/es-ES/models.json +6 -0
  13. package/locales/fa-IR/chat.json +8 -0
  14. package/locales/fa-IR/models.json +6 -0
  15. package/locales/fr-FR/chat.json +8 -0
  16. package/locales/fr-FR/models.json +6 -0
  17. package/locales/it-IT/chat.json +8 -0
  18. package/locales/it-IT/models.json +6 -0
  19. package/locales/ja-JP/chat.json +8 -0
  20. package/locales/ja-JP/models.json +6 -0
  21. package/locales/ko-KR/chat.json +8 -0
  22. package/locales/ko-KR/models.json +6 -0
  23. package/locales/nl-NL/chat.json +8 -0
  24. package/locales/nl-NL/models.json +6 -0
  25. package/locales/pl-PL/chat.json +8 -0
  26. package/locales/pl-PL/models.json +6 -0
  27. package/locales/pt-BR/chat.json +8 -0
  28. package/locales/pt-BR/models.json +6 -0
  29. package/locales/ru-RU/chat.json +8 -0
  30. package/locales/ru-RU/models.json +6 -0
  31. package/locales/tr-TR/chat.json +8 -0
  32. package/locales/tr-TR/models.json +6 -0
  33. package/locales/vi-VN/chat.json +8 -0
  34. package/locales/vi-VN/models.json +6 -0
  35. package/locales/zh-CN/chat.json +8 -0
  36. package/locales/zh-CN/models.json +6 -0
  37. package/locales/zh-TW/chat.json +8 -0
  38. package/locales/zh-TW/models.json +6 -0
  39. package/next.config.ts +6 -0
  40. package/package.json +1 -1
  41. package/packages/web-crawler/src/crawImpl/naive.ts +19 -12
  42. package/packages/web-crawler/src/urlRules.ts +9 -1
  43. package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/ChatItem/index.tsx +9 -18
  44. package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +2 -5
  45. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx +3 -2
  46. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +56 -30
  47. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags/HistoryLimitTags.tsx +26 -0
  48. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/{SearchTags.tsx → Tags/SearchTags.tsx} +7 -4
  49. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/{Tags.tsx → Tags/index.tsx} +4 -1
  50. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/index.tsx +1 -1
  51. package/src/config/aiModels/anthropic.ts +16 -1
  52. package/src/config/aiModels/google.ts +37 -0
  53. package/src/config/aiModels/qwen.ts +64 -25
  54. package/src/config/modelProviders/anthropic.ts +0 -2
  55. package/src/const/layoutTokens.test.ts +1 -1
  56. package/src/const/layoutTokens.ts +1 -1
  57. package/src/const/models.ts +27 -0
  58. package/src/features/ChatInput/ActionBar/History.tsx +6 -3
  59. package/src/features/ChatInput/ActionBar/Model/ContextCachingSwitch.tsx +20 -0
  60. package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +49 -7
  61. package/src/features/ChatInput/ActionBar/Model/ReasoningTokenSlider.tsx +6 -14
  62. package/src/features/ChatInput/ActionBar/Search/ModelBuiltinSearch.tsx +2 -2
  63. package/src/features/ChatInput/ActionBar/Search/SwitchPanel.tsx +2 -2
  64. package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +3 -5
  65. package/src/features/Conversation/Messages/Assistant/Tool/Render/CustomRender.tsx +2 -0
  66. package/src/features/Conversation/Messages/Assistant/Tool/Render/index.tsx +5 -1
  67. package/src/features/Conversation/Messages/Assistant/Tool/index.tsx +2 -0
  68. package/src/features/Conversation/components/ChatItem/index.tsx +3 -6
  69. package/src/features/Portal/Thread/Chat/ChatItem.tsx +4 -9
  70. package/src/hooks/useAgentEnableSearch.ts +2 -2
  71. package/src/libs/agent-runtime/anthropic/index.test.ts +36 -7
  72. package/src/libs/agent-runtime/anthropic/index.ts +30 -8
  73. package/src/libs/agent-runtime/azureOpenai/index.ts +4 -9
  74. package/src/libs/agent-runtime/azureai/index.ts +4 -9
  75. package/src/libs/agent-runtime/openai/index.ts +21 -38
  76. package/src/libs/agent-runtime/types/chat.ts +4 -0
  77. package/src/libs/agent-runtime/utils/anthropicHelpers.test.ts +55 -0
  78. package/src/libs/agent-runtime/utils/anthropicHelpers.ts +37 -3
  79. package/src/libs/langchain/loaders/code/__tests__/long.json +2 -2
  80. package/src/libs/langchain/loaders/code/__tests__/long.txt +1 -1
  81. package/src/locales/default/chat.ts +8 -0
  82. package/src/store/agent/initialState.ts +2 -2
  83. package/src/store/agent/selectors.ts +1 -1
  84. package/src/store/agent/slices/chat/{selectors.test.ts → selectors/agent.test.ts} +2 -2
  85. package/src/store/agent/slices/chat/{selectors.ts → selectors/agent.ts} +24 -33
  86. package/src/store/agent/slices/chat/selectors/chatConfig.test.ts +184 -0
  87. package/src/store/agent/slices/chat/selectors/chatConfig.ts +65 -0
  88. package/src/store/agent/slices/chat/selectors/index.ts +2 -0
  89. package/src/store/agent/store.ts +2 -2
  90. package/src/store/chat/helpers.test.ts +7 -7
  91. package/src/store/chat/helpers.ts +11 -7
  92. package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChat.test.ts +3 -3
  93. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +11 -2
  94. package/src/store/chat/slices/aiChat/actions/helpers.ts +6 -2
  95. package/src/store/chat/slices/builtinTool/actions/searXNG.ts +28 -20
  96. package/src/store/chat/slices/message/selectors.ts +7 -3
  97. package/src/store/chat/slices/thread/selectors/index.ts +7 -3
  98. package/src/tools/web-browsing/Render/PageContent/Result.tsx +4 -2
  99. package/src/tools/web-browsing/Render/index.tsx +2 -0
  100. package/src/types/agent/index.ts +4 -0
  101. package/src/types/aiModel.ts +1 -1
  102. package/src/types/aiProvider.ts +60 -31
  103. /package/packages/web-crawler/src/{__test__ → __tests__}/crawler.test.ts +0 -0
  104. /package/packages/web-crawler/src/crawImpl/{__test__ → __tests__}/jina.test.ts +0 -0
  105. /package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/{KnowledgeTag.tsx → Tags/KnowledgeTag.tsx} +0 -0
  106. /package/src/store/agent/slices/chat/{__snapshots__/selectors.test.ts.snap → selectors/__snapshots__/agent.test.ts.snap} +0 -0
@@ -827,12 +827,18 @@
827
827
  "gemini-2.0-flash-001": {
828
828
  "description": "Gemini 2.0 Flash oferece funcionalidades e melhorias de próxima geração, incluindo velocidade excepcional, uso nativo de ferramentas, geração multimodal e uma janela de contexto de 1M tokens."
829
829
  },
830
+ "gemini-2.0-flash-lite": {
831
+ "description": "Variante do modelo Gemini 2.0 Flash, otimizada para custo-benefício e baixa latência."
832
+ },
830
833
  "gemini-2.0-flash-lite-001": {
831
834
  "description": "Variante do modelo Gemini 2.0 Flash, otimizada para custo-benefício e baixa latência."
832
835
  },
833
836
  "gemini-2.0-flash-lite-preview-02-05": {
834
837
  "description": "Um modelo Gemini 2.0 Flash otimizado para custo-benefício e baixa latência."
835
838
  },
839
+ "gemini-2.0-flash-thinking-exp": {
840
+ "description": "O Gemini 2.0 Flash Exp é o mais recente modelo experimental de IA multimodal do Google, com características de próxima geração, velocidade excepcional, chamadas nativas de ferramentas e geração multimodal."
841
+ },
836
842
  "gemini-2.0-flash-thinking-exp-01-21": {
837
843
  "description": "O Gemini 2.0 Flash Exp é o mais recente modelo experimental de IA multimodal do Google, com características de próxima geração, velocidade excepcional, chamadas nativas de ferramentas e geração multimodal."
838
844
  },
@@ -32,7 +32,12 @@
32
32
  "duplicateTitle": "{{title}} Копия",
33
33
  "emptyAgent": "Нет ассистента",
34
34
  "extendParams": {
35
+ "disableContextCaching": {
36
+ "desc": "Стоимость генерации одного диалога может быть снижена до 90%, скорость ответа увеличивается в 4 раза (<1>Узнать больше</1>). При включении автоматически отключается ограничение на количество исторических сообщений",
37
+ "title": "Включить кэширование контекста"
38
+ },
35
39
  "enableReasoning": {
40
+ "desc": "Ограничение на основе механизма Claude Thinking (<1>Узнать больше</1>), при включении автоматически отключается ограничение на количество исторических сообщений",
36
41
  "title": "Включить глубокое мышление"
37
42
  },
38
43
  "reasoningBudgetToken": {
@@ -40,6 +45,9 @@
40
45
  },
41
46
  "title": "Расширенные функции модели"
42
47
  },
48
+ "history": {
49
+ "title": "Ассистент будет помнить только последние {{count}} сообщений"
50
+ },
43
51
  "historyRange": "История сообщений",
44
52
  "historySummary": "Сводка исторических сообщений",
45
53
  "inbox": {
@@ -827,12 +827,18 @@
827
827
  "gemini-2.0-flash-001": {
828
828
  "description": "Gemini 2.0 Flash предлагает функции следующего поколения и улучшения, включая выдающуюся скорость, использование встроенных инструментов, многомодальную генерацию и контекстное окно на 1M токенов."
829
829
  },
830
+ "gemini-2.0-flash-lite": {
831
+ "description": "Модельный вариант Gemini 2.0 Flash, оптимизированный для достижения таких целей, как экономическая эффективность и низкая задержка."
832
+ },
830
833
  "gemini-2.0-flash-lite-001": {
831
834
  "description": "Модельный вариант Gemini 2.0 Flash, оптимизированный для достижения таких целей, как экономическая эффективность и низкая задержка."
832
835
  },
833
836
  "gemini-2.0-flash-lite-preview-02-05": {
834
837
  "description": "Модель Gemini 2.0 Flash, оптимизированная для экономической эффективности и низкой задержки."
835
838
  },
839
+ "gemini-2.0-flash-thinking-exp": {
840
+ "description": "Gemini 2.0 Flash Exp — это последняя экспериментальная многомодальная AI модель от Google, обладающая следующими поколениями характеристик, выдающейся скоростью, нативным вызовом инструментов и многомодальной генерацией."
841
+ },
836
842
  "gemini-2.0-flash-thinking-exp-01-21": {
837
843
  "description": "Gemini 2.0 Flash Exp — это последняя экспериментальная многомодальная AI модель от Google, обладающая следующими поколениями характеристик, выдающейся скоростью, нативным вызовом инструментов и многомодальной генерацией."
838
844
  },
@@ -32,7 +32,12 @@
32
32
  "duplicateTitle": "{{title}} Kopya",
33
33
  "emptyAgent": "Asistan yok",
34
34
  "extendParams": {
35
+ "disableContextCaching": {
36
+ "desc": "Tek bir diyalogun üretim maliyeti en fazla %90 oranında düşürülebilir, yanıt hızı 4 kat artar (<1>Daha fazla bilgi edinin</1>). Açıldığında, otomatik olarak geçmiş mesaj sayısı sınırı devre dışı bırakılacaktır.",
37
+ "title": "Bağlam önbelleğini aç"
38
+ },
35
39
  "enableReasoning": {
40
+ "desc": "Claude Thinking mekanizmasına dayalı kısıtlamalar (<1>Daha fazla bilgi edinin</1>), açıldığında otomatik olarak geçmiş mesaj sayısı sınırı devre dışı bırakılacaktır.",
36
41
  "title": "Derin Düşünmeyi Aç"
37
42
  },
38
43
  "reasoningBudgetToken": {
@@ -40,6 +45,9 @@
40
45
  },
41
46
  "title": "Model Genişletme Özellikleri"
42
47
  },
48
+ "history": {
49
+ "title": "Asistan yalnızca son {{count}} mesajı hatırlayacak"
50
+ },
43
51
  "historyRange": "Geçmiş Aralığı",
44
52
  "historySummary": "Tarihsel haber özeti",
45
53
  "inbox": {
@@ -827,12 +827,18 @@
827
827
  "gemini-2.0-flash-001": {
828
828
  "description": "Gemini 2.0 Flash, mükemmel hız, yerel araç kullanımı, çok modlu üretim ve 1M token bağlam penceresi dahil olmak üzere bir sonraki nesil özellikler ve iyileştirmeler sunar."
829
829
  },
830
+ "gemini-2.0-flash-lite": {
831
+ "description": "Gemini 2.0 Flash model varyantı, maliyet etkinliği ve düşük gecikme gibi hedefler için optimize edilmiştir."
832
+ },
830
833
  "gemini-2.0-flash-lite-001": {
831
834
  "description": "Gemini 2.0 Flash model varyantı, maliyet etkinliği ve düşük gecikme gibi hedefler için optimize edilmiştir."
832
835
  },
833
836
  "gemini-2.0-flash-lite-preview-02-05": {
834
837
  "description": "Maliyet etkinliği ve düşük gecikme gibi hedefler için optimize edilmiş bir Gemini 2.0 Flash modelidir."
835
838
  },
839
+ "gemini-2.0-flash-thinking-exp": {
840
+ "description": "Gemini 2.0 Flash Exp, Google'ın en son deneysel çok modlu AI modelidir, bir sonraki nesil özelliklere, olağanüstü hıza, yerel araç çağrısına ve çok modlu üretime sahiptir."
841
+ },
836
842
  "gemini-2.0-flash-thinking-exp-01-21": {
837
843
  "description": "Gemini 2.0 Flash Exp, Google'ın en son deneysel çok modlu AI modelidir, bir sonraki nesil özelliklere, olağanüstü hıza, yerel araç çağrısına ve çok modlu üretime sahiptir."
838
844
  },
@@ -32,7 +32,12 @@
32
32
  "duplicateTitle": "{{title}} Bản sao",
33
33
  "emptyAgent": "Không có trợ lý",
34
34
  "extendParams": {
35
+ "disableContextCaching": {
36
+ "desc": "Chi phí tạo ra một cuộc hội thoại đơn lẻ có thể giảm tới 90%, tốc độ phản hồi tăng gấp 4 lần (<1>Tìm hiểu thêm</1>). Khi bật, sẽ tự động vô hiệu hóa giới hạn số lượng tin nhắn lịch sử",
37
+ "title": "Bật bộ nhớ ngữ cảnh"
38
+ },
35
39
  "enableReasoning": {
40
+ "desc": "Giới hạn dựa trên cơ chế Claude Thinking (<1>Tìm hiểu thêm</1>), khi bật sẽ tự động vô hiệu hóa giới hạn số lượng tin nhắn lịch sử",
36
41
  "title": "Bật tư duy sâu sắc"
37
42
  },
38
43
  "reasoningBudgetToken": {
@@ -40,6 +45,9 @@
40
45
  },
41
46
  "title": "Chức năng mở rộng mô hình"
42
47
  },
48
+ "history": {
49
+ "title": "Trợ lý sẽ chỉ nhớ {{count}} tin nhắn cuối cùng"
50
+ },
43
51
  "historyRange": "Phạm vi lịch sử",
44
52
  "historySummary": "Tóm tắt tin tức lịch sử",
45
53
  "inbox": {
@@ -827,12 +827,18 @@
827
827
  "gemini-2.0-flash-001": {
828
828
  "description": "Gemini 2.0 Flash cung cấp các tính năng và cải tiến thế hệ tiếp theo, bao gồm tốc độ vượt trội, sử dụng công cụ bản địa, tạo đa phương tiện và cửa sổ ngữ cảnh 1M token."
829
829
  },
830
+ "gemini-2.0-flash-lite": {
831
+ "description": "Biến thể mô hình Gemini 2.0 Flash được tối ưu hóa cho hiệu quả chi phí và độ trễ thấp."
832
+ },
830
833
  "gemini-2.0-flash-lite-001": {
831
834
  "description": "Biến thể mô hình Gemini 2.0 Flash được tối ưu hóa cho hiệu quả chi phí và độ trễ thấp."
832
835
  },
833
836
  "gemini-2.0-flash-lite-preview-02-05": {
834
837
  "description": "Một mô hình Gemini 2.0 Flash được tối ưu hóa cho hiệu quả chi phí và độ trễ thấp."
835
838
  },
839
+ "gemini-2.0-flash-thinking-exp": {
840
+ "description": "Gemini 2.0 Flash Exp là mô hình AI đa phương thức thử nghiệm mới nhất của Google, sở hữu các tính năng thế hệ tiếp theo, tốc độ vượt trội, gọi công cụ bản địa và sinh ra đa phương thức."
841
+ },
836
842
  "gemini-2.0-flash-thinking-exp-01-21": {
837
843
  "description": "Gemini 2.0 Flash Exp là mô hình AI đa phương thức thử nghiệm mới nhất của Google, sở hữu các tính năng thế hệ tiếp theo, tốc độ vượt trội, gọi công cụ bản địa và sinh ra đa phương thức."
838
844
  },
@@ -32,7 +32,12 @@
32
32
  "duplicateTitle": "{{title}} 副本",
33
33
  "emptyAgent": "暂无助手",
34
34
  "extendParams": {
35
+ "disableContextCaching": {
36
+ "desc": "单条对话生成成本最高可降低 90%,响应速度提升 4 倍(<1>了解更多</1>)。开启后将自动禁用历史消息数限制",
37
+ "title": "开启上下文缓存"
38
+ },
35
39
  "enableReasoning": {
40
+ "desc": "基于 Claude Thinking 机制限制(<1>了解更多</1>),开启后将自动禁用历史消息数限制",
36
41
  "title": "开启深度思考"
37
42
  },
38
43
  "reasoningBudgetToken": {
@@ -40,6 +45,9 @@
40
45
  },
41
46
  "title": "模型扩展功能"
42
47
  },
48
+ "history": {
49
+ "title": "助手将只记住最后{{count}}条消息"
50
+ },
43
51
  "historyRange": "历史范围",
44
52
  "historySummary": "历史消息总结",
45
53
  "inbox": {
@@ -827,12 +827,18 @@
827
827
  "gemini-2.0-flash-001": {
828
828
  "description": "Gemini 2.0 Flash 提供下一代功能和改进,包括卓越的速度、原生工具使用、多模态生成和1M令牌上下文窗口。"
829
829
  },
830
+ "gemini-2.0-flash-lite": {
831
+ "description": "Gemini 2.0 Flash 模型变体,针对成本效益和低延迟等目标进行了优化。"
832
+ },
830
833
  "gemini-2.0-flash-lite-001": {
831
834
  "description": "Gemini 2.0 Flash 模型变体,针对成本效益和低延迟等目标进行了优化。"
832
835
  },
833
836
  "gemini-2.0-flash-lite-preview-02-05": {
834
837
  "description": "一个 Gemini 2.0 Flash 模型,针对成本效益和低延迟等目标进行了优化。"
835
838
  },
839
+ "gemini-2.0-flash-thinking-exp": {
840
+ "description": "Gemini 2.0 Flash Thinking Exp 是 Google 的实验性多模态推理AI模型,能对复杂问题进行推理,拥有新的思维能力。"
841
+ },
836
842
  "gemini-2.0-flash-thinking-exp-01-21": {
837
843
  "description": "Gemini 2.0 Flash Thinking Exp 是 Google 的实验性多模态推理AI模型,能对复杂问题进行推理,拥有新的思维能力。"
838
844
  },
@@ -32,7 +32,12 @@
32
32
  "duplicateTitle": "{{title}} 副本",
33
33
  "emptyAgent": "暫無助手",
34
34
  "extendParams": {
35
+ "disableContextCaching": {
36
+ "desc": "單條對話生成成本最高可降低 90%,響應速度提升 4 倍(<1>了解更多</1>)。開啟後將自動禁用歷史消息數限制",
37
+ "title": "開啟上下文快取"
38
+ },
35
39
  "enableReasoning": {
40
+ "desc": "基於 Claude Thinking 機制限制(<1>了解更多</1>),開啟後將自動禁用歷史消息數限制",
36
41
  "title": "開啟深度思考"
37
42
  },
38
43
  "reasoningBudgetToken": {
@@ -40,6 +45,9 @@
40
45
  },
41
46
  "title": "模型擴展功能"
42
47
  },
48
+ "history": {
49
+ "title": "助手將只記住最後{{count}}條消息"
50
+ },
43
51
  "historyRange": "歷史範圍",
44
52
  "historySummary": "歷史消息總結",
45
53
  "inbox": {
@@ -827,12 +827,18 @@
827
827
  "gemini-2.0-flash-001": {
828
828
  "description": "Gemini 2.0 Flash 提供下一代功能和改進,包括卓越的速度、原生工具使用、多模態生成和1M令牌上下文窗口。"
829
829
  },
830
+ "gemini-2.0-flash-lite": {
831
+ "description": "Gemini 2.0 Flash 模型變體,針對成本效益和低延遲等目標進行了優化。"
832
+ },
830
833
  "gemini-2.0-flash-lite-001": {
831
834
  "description": "Gemini 2.0 Flash 模型變體,針對成本效益和低延遲等目標進行了優化。"
832
835
  },
833
836
  "gemini-2.0-flash-lite-preview-02-05": {
834
837
  "description": "一個 Gemini 2.0 Flash 模型,針對成本效益和低延遲等目標進行了優化。"
835
838
  },
839
+ "gemini-2.0-flash-thinking-exp": {
840
+ "description": "Gemini 2.0 Flash Exp 是 Google 最新的實驗性多模態AI模型,擁有下一代特性,卓越的速度,原生工具調用以及多模態生成。"
841
+ },
836
842
  "gemini-2.0-flash-thinking-exp-01-21": {
837
843
  "description": "Gemini 2.0 Flash Exp 是 Google 最新的實驗性多模態AI模型,擁有下一代特性,卓越的速度,原生工具調用以及多模態生成。"
838
844
  },
package/next.config.ts CHANGED
@@ -217,6 +217,12 @@ const nextConfig: NextConfig = {
217
217
 
218
218
  config.resolve.alias.canvas = false;
219
219
 
220
+ // to ignore epub2 compile error
221
+ // refs: https://github.com/lobehub/lobe-chat/discussions/6769
222
+ config.resolve.fallback = {
223
+ ...config.resolve.fallback,
224
+ zipfile: false,
225
+ };
220
226
  return config;
221
227
  },
222
228
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.68.10",
3
+ "version": "1.69.0",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -89,19 +89,26 @@ export const naive: CrawlImpl = async (url, { filterOptions }) => {
89
89
 
90
90
  const result = htmlToMarkdown(html, { filterOptions, url });
91
91
 
92
- // if the content is not empty or blocked
93
- // just return
94
- if (!!result.content && result.title !== 'Just a moment...') {
95
- return {
96
- content: result.content,
97
- contentType: 'text',
98
- description: result?.excerpt,
99
- length: result.length,
100
- siteName: result?.siteName,
101
- title: result?.title,
102
- url,
103
- } satisfies CrawlSuccessResult;
92
+ // if the content is empty or too short, just return
93
+ if (!result.content || result.content.length < 100) {
94
+ return;
95
+ }
96
+
97
+ // it's blocked by cloudflare
98
+ if (result.title !== 'Just a moment...') {
99
+ return;
104
100
  }
101
+
102
+ // just return
103
+ return {
104
+ content: result.content,
105
+ contentType: 'text',
106
+ description: result?.excerpt,
107
+ length: result.length,
108
+ siteName: result?.siteName,
109
+ title: result?.title,
110
+ url,
111
+ } satisfies CrawlSuccessResult;
105
112
  } catch (error) {
106
113
  console.error(error);
107
114
  }
@@ -16,7 +16,6 @@ export const crawUrlRules: CrawlUrlRule[] = [
16
16
  // GitHub discussion
17
17
  urlPattern: 'https://github.com/(.*)/discussions/(.*)',
18
18
  },
19
-
20
19
  // 所有 PDF 都用 jina
21
20
  {
22
21
  impls: ['jina'],
@@ -32,6 +31,15 @@ export const crawUrlRules: CrawlUrlRule[] = [
32
31
  impls: ['jina'],
33
32
  urlPattern: 'https://zhuanlan.zhihu.com(.*)',
34
33
  },
34
+ {
35
+ impls: ['jina'],
36
+ urlPattern: 'https://zhihu.com(.*)',
37
+ },
38
+ // 微信公众号有爬虫防护,使用 jina
39
+ {
40
+ impls: ['jina'],
41
+ urlPattern: 'https://mp.weixin.qq.com(.*)',
42
+ },
35
43
  {
36
44
  // Medium 文章转换为 Scribe.rip
37
45
  urlPattern: 'https://medium.com/(.*)',
@@ -4,7 +4,7 @@ import React, { memo, useMemo } from 'react';
4
4
  import { ChatItem } from '@/features/Conversation';
5
5
  import ActionsBar from '@/features/Conversation/components/ChatItem/ActionsBar';
6
6
  import { useAgentStore } from '@/store/agent';
7
- import { agentSelectors } from '@/store/agent/selectors';
7
+ import { agentChatConfigSelectors } from '@/store/agent/selectors';
8
8
  import { useChatStore } from '@/store/chat';
9
9
  import { chatSelectors, threadSelectors } from '@/store/chat/selectors';
10
10
 
@@ -50,28 +50,19 @@ export interface ThreadChatItemProps {
50
50
  const MainChatItem = memo<ThreadChatItemProps>(({ id, index }) => {
51
51
  const { styles, cx } = useStyles();
52
52
 
53
- const [displayMode] = useAgentStore((s) => {
54
- const config = agentSelectors.currentAgentChatConfig(s);
55
- return [config.displayMode || 'chat'];
56
- });
57
-
58
- const userRole = useChatStore((s) => chatSelectors.getMessageById(id)(s)?.role);
59
-
60
- const placement = displayMode === 'chat' && userRole === 'user' ? 'end' : 'start';
61
-
62
53
  const [showThread, historyLength] = useChatStore((s) => [
63
54
  threadSelectors.hasThreadBySourceMsgId(id)(s),
64
55
  chatSelectors.mainDisplayChatIDs(s).length,
65
56
  ]);
66
57
 
67
- const enableHistoryDivider = useAgentStore((s) => {
68
- const config = agentSelectors.currentAgentChatConfig(s);
69
- return (
70
- config.enableHistoryCount &&
71
- historyLength > (config.historyCount ?? 0) &&
72
- config.historyCount === historyLength - index
73
- );
74
- });
58
+ const [displayMode, enableHistoryDivider] = useAgentStore((s) => [
59
+ agentChatConfigSelectors.displayMode(s),
60
+ agentChatConfigSelectors.enableHistoryDivider(historyLength, index)(s),
61
+ ]);
62
+
63
+ const userRole = useChatStore((s) => chatSelectors.getMessageById(id)(s)?.role);
64
+
65
+ const placement = displayMode === 'chat' && userRole === 'user' ? 'end' : 'start';
75
66
 
76
67
  const actionBar = useMemo(() => <ActionsBar id={id} />, [id]);
77
68
 
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
6
  import { useAgentStore } from '@/store/agent';
7
- import { agentSelectors } from '@/store/agent/selectors';
7
+ import { agentChatConfigSelectors } from '@/store/agent/selectors';
8
8
  import { useChatStore } from '@/store/chat';
9
9
  import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
10
10
  import { useSessionStore } from '@/store/session';
@@ -12,10 +12,7 @@ import { sessionMetaSelectors } from '@/store/session/selectors';
12
12
 
13
13
  const WelcomeMessage = () => {
14
14
  const { t } = useTranslation('chat');
15
- const [type = 'chat'] = useAgentStore((s) => {
16
- const config = agentSelectors.currentAgentChatConfig(s);
17
- return [config.displayMode];
18
- });
15
+ const type = useAgentStore(agentChatConfigSelectors.displayMode);
19
16
 
20
17
  const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
21
18
  const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors);
@@ -4,6 +4,7 @@ import { ActionIcon } from '@lobehub/ui';
4
4
  import { PanelRightClose, PanelRightOpen } from 'lucide-react';
5
5
  import { memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
+ import { Flexbox } from 'react-layout-kit';
7
8
 
8
9
  import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
9
10
  import { useGlobalStore } from '@/store/global';
@@ -24,7 +25,7 @@ const HeaderAction = memo(() => {
24
25
  const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors);
25
26
 
26
27
  return (
27
- <>
28
+ <Flexbox gap={4} horizontal>
28
29
  <ShareButton />
29
30
  <ActionIcon
30
31
  icon={showAgentSettings ? PanelRightClose : PanelRightOpen}
@@ -33,7 +34,7 @@ const HeaderAction = memo(() => {
33
34
  title={t('roleAndArchive')}
34
35
  />
35
36
  {isAgentEditable && <SettingButton />}
36
- </>
37
+ </Flexbox>
37
38
  );
38
39
  });
39
40
 
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import { ActionIcon, Avatar } from '@lobehub/ui';
4
- import { ChatHeaderTitle } from '@lobehub/ui/chat';
5
4
  import { Skeleton } from 'antd';
5
+ import { createStyles } from 'antd-style';
6
6
  import { PanelLeftClose, PanelLeftOpen } from 'lucide-react';
7
7
  import { parseAsBoolean, useQueryState } from 'nuqs';
8
8
  import { Suspense, memo } from 'react';
@@ -19,17 +19,38 @@ import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selector
19
19
 
20
20
  import Tags from './Tags';
21
21
 
22
+ const useStyles = createStyles(({ css }) => ({
23
+ container: css`
24
+ position: relative;
25
+ overflow: hidden;
26
+ flex: 1;
27
+ max-width: 100%;
28
+ `,
29
+ tag: css`
30
+ flex: none;
31
+ align-items: baseline;
32
+ `,
33
+ title: css`
34
+ overflow: hidden;
35
+
36
+ font-size: 14px;
37
+ font-weight: bold;
38
+ line-height: 1;
39
+ text-overflow: ellipsis;
40
+ white-space: nowrap;
41
+ `,
42
+ }));
43
+
22
44
  const Main = memo(() => {
23
45
  const { t } = useTranslation('chat');
24
-
46
+ const { styles } = useStyles();
25
47
  useInitAgentConfig();
26
48
  const [isPinned] = useQueryState('pinned', parseAsBoolean);
27
49
 
28
- const [init, isInbox, title, description, avatar, backgroundColor] = useSessionStore((s) => [
50
+ const [init, isInbox, title, avatar, backgroundColor] = useSessionStore((s) => [
29
51
  sessionSelectors.isSomeSessionActive(s),
30
52
  sessionSelectors.isInboxSession(s),
31
53
  sessionMetaSelectors.currentAgentTitle(s),
32
- sessionMetaSelectors.currentAgentDescription(s),
33
54
  sessionMetaSelectors.currentAgentAvatar(s),
34
55
  sessionMetaSelectors.currentAgentBackgroundColor(s),
35
56
  ]);
@@ -37,34 +58,36 @@ const Main = memo(() => {
37
58
  const openChatSettings = useOpenChatSettings();
38
59
 
39
60
  const displayTitle = isInbox ? t('inbox.title') : title;
40
- const displayDesc = isInbox ? t('inbox.desc') : description;
41
61
  const showSessionPanel = useGlobalStore(systemStatusSelectors.showSessionPanel);
42
62
  const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
43
63
 
44
- return !init ? (
45
- <Flexbox gap={4} horizontal>
46
- {!isPinned && (
47
- <ActionIcon
48
- aria-label={t('agents')}
49
- icon={showSessionPanel ? PanelLeftClose : PanelLeftOpen}
50
- onClick={() => {
51
- updateSystemStatus({
52
- sessionsWidth: showSessionPanel ? 0 : 320,
53
- showSessionPanel: !showSessionPanel,
54
- });
55
- }}
56
- size={DESKTOP_HEADER_ICON_SIZE}
57
- title={t('agents')}
64
+ if (!init)
65
+ return (
66
+ <Flexbox align={'center'} gap={8} horizontal>
67
+ {!isPinned && (
68
+ <ActionIcon
69
+ aria-label={t('agents')}
70
+ icon={showSessionPanel ? PanelLeftClose : PanelLeftOpen}
71
+ onClick={() => {
72
+ updateSystemStatus({
73
+ sessionsWidth: showSessionPanel ? 0 : 320,
74
+ showSessionPanel: !showSessionPanel,
75
+ });
76
+ }}
77
+ size={DESKTOP_HEADER_ICON_SIZE}
78
+ title={t('agents')}
79
+ />
80
+ )}
81
+ <Skeleton
82
+ active
83
+ avatar={{ shape: 'circle', size: 28 }}
84
+ paragraph={false}
85
+ title={{ style: { margin: 0, marginTop: 4 }, width: 200 }}
58
86
  />
59
- )}
60
- <Skeleton
61
- active
62
- avatar={{ shape: 'circle', size: 'default' }}
63
- paragraph={false}
64
- title={{ style: { margin: 0, marginTop: 8 }, width: 200 }}
65
- />
66
- </Flexbox>
67
- ) : (
87
+ </Flexbox>
88
+ );
89
+
90
+ return (
68
91
  <Flexbox align={'center'} gap={4} horizontal>
69
92
  {!isPinned && (
70
93
  <ActionIcon
@@ -84,10 +107,13 @@ const Main = memo(() => {
84
107
  avatar={avatar}
85
108
  background={backgroundColor}
86
109
  onClick={() => openChatSettings()}
87
- size={40}
110
+ size={32}
88
111
  title={title}
89
112
  />
90
- <ChatHeaderTitle desc={displayDesc} tag={<Tags />} title={displayTitle} />
113
+ <Flexbox align={'center'} className={styles.container} gap={8} horizontal>
114
+ <div className={styles.title}>{displayTitle}</div>
115
+ <Tags />
116
+ </Flexbox>
91
117
  </Flexbox>
92
118
  );
93
119
  });
@@ -0,0 +1,26 @@
1
+ import { Icon, Tag, Tooltip } from '@lobehub/ui';
2
+ import { HistoryIcon } from 'lucide-react';
3
+ import { memo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Flexbox } from 'react-layout-kit';
6
+
7
+ import { useAgentStore } from '@/store/agent';
8
+ import { agentChatConfigSelectors } from '@/store/agent/selectors';
9
+
10
+ const SearchTag = memo(() => {
11
+ const { t } = useTranslation('chat');
12
+ const historyCount = useAgentStore(agentChatConfigSelectors.historyCount);
13
+
14
+ return (
15
+ <Tooltip title={t('history.title', { count: historyCount })}>
16
+ <Flexbox height={22}>
17
+ <Tag>
18
+ <Icon icon={HistoryIcon} />
19
+ <span>{historyCount}</span>
20
+ </Tag>
21
+ </Flexbox>
22
+ </Tooltip>
23
+ );
24
+ });
25
+
26
+ export default SearchTag;
@@ -2,15 +2,18 @@ import { Icon, Tag } from '@lobehub/ui';
2
2
  import { Globe } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
+ import { Flexbox } from 'react-layout-kit';
5
6
 
6
7
  const SearchTag = memo(() => {
7
8
  const { t } = useTranslation('chat');
8
9
 
9
10
  return (
10
- <Tag>
11
- {<Icon icon={Globe} />}
12
- <div>{t('search.title')}</div>
13
- </Tag>
11
+ <Flexbox height={22}>
12
+ <Tag>
13
+ {<Icon icon={Globe} />}
14
+ <div>{t('search.title')}</div>
15
+ </Tag>
16
+ </Flexbox>
14
17
  );
15
18
  });
16
19
 
@@ -9,12 +9,13 @@ import PluginTag from '@/features/PluginTag';
9
9
  import { useAgentEnableSearch } from '@/hooks/useAgentEnableSearch';
10
10
  import { useModelSupportToolUse } from '@/hooks/useModelSupportToolUse';
11
11
  import { useAgentStore } from '@/store/agent';
12
- import { agentSelectors } from '@/store/agent/selectors';
12
+ import { agentChatConfigSelectors, agentSelectors } from '@/store/agent/selectors';
13
13
  import { useUserStore } from '@/store/user';
14
14
  import { authSelectors } from '@/store/user/selectors';
15
15
 
16
16
  import KnowledgeTag from './KnowledgeTag';
17
17
  import SearchTags from './SearchTags';
18
+ import HistoryLimitTags from './HistoryLimitTags';
18
19
 
19
20
  const TitleTags = memo(() => {
20
21
  const [model, provider, hasKnowledge, isLoading] = useAgentStore((s) => [
@@ -26,6 +27,7 @@ const TitleTags = memo(() => {
26
27
 
27
28
  const plugins = useAgentStore(agentSelectors.currentAgentPlugins, isEqual);
28
29
  const enabledKnowledge = useAgentStore(agentSelectors.currentEnabledKnowledge, isEqual);
30
+ const enableHistoryCount = useAgentStore(agentChatConfigSelectors.enableHistoryCount);
29
31
 
30
32
  const showPlugin = useModelSupportToolUse(model, provider);
31
33
  const isLogin = useUserStore(authSelectors.isLogin);
@@ -42,6 +44,7 @@ const TitleTags = memo(() => {
42
44
  {isAgentEnableSearch && <SearchTags />}
43
45
  {showPlugin && plugins?.length > 0 && <PluginTag plugins={plugins} />}
44
46
  {hasKnowledge && <KnowledgeTag data={enabledKnowledge} />}
47
+ {enableHistoryCount && <HistoryLimitTags />}
45
48
  </Flexbox>
46
49
  );
47
50
  });
@@ -16,7 +16,7 @@ const Header = () => {
16
16
  <ChatHeader
17
17
  left={<Main />}
18
18
  right={<HeaderAction />}
19
- style={{ minHeight: 64, position: 'initial', zIndex: 11 }}
19
+ style={{ height: 48, minHeight: 48, paddingInline: 8, position: 'initial', zIndex: 11 }}
20
20
  />
21
21
  )
22
22
  );