@lobehub/chat 0.135.4 → 0.137.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 (83) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +8 -8
  3. package/README.zh-CN.md +8 -8
  4. package/docs/self-hosting/advanced/authentication.mdx +14 -81
  5. package/docs/self-hosting/advanced/authentication.zh-CN.mdx +14 -75
  6. package/docs/self-hosting/advanced/sso-providers/auth0.mdx +91 -0
  7. package/docs/self-hosting/advanced/sso-providers/auth0.zh-CN.mdx +85 -0
  8. package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.mdx +69 -0
  9. package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.zh-CN.mdx +75 -0
  10. package/docs/self-hosting/environment-variables/basic.mdx +37 -1
  11. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +36 -1
  12. package/docs/self-hosting/environment-variables/model-provider.mdx +0 -2
  13. package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +0 -1
  14. package/docs/self-hosting/start.mdx +1 -9
  15. package/docs/usage/features/agent-market.mdx +1 -1
  16. package/docs/usage/features/tts.mdx +0 -3
  17. package/docs/usage/features/vision.mdx +0 -1
  18. package/docs/usage/providers/ollama/gemma.mdx +0 -1
  19. package/docs/usage/providers/ollama.mdx +0 -3
  20. package/docs/usage/start.mdx +1 -1
  21. package/docs/usage/start.zh-CN.mdx +1 -1
  22. package/locales/ar/error.json +8 -0
  23. package/locales/ar/setting.json +9 -1
  24. package/locales/de-DE/error.json +8 -0
  25. package/locales/de-DE/setting.json +9 -1
  26. package/locales/en-US/error.json +8 -0
  27. package/locales/en-US/setting.json +9 -1
  28. package/locales/es-ES/error.json +8 -0
  29. package/locales/es-ES/setting.json +9 -1
  30. package/locales/fr-FR/error.json +8 -0
  31. package/locales/fr-FR/setting.json +9 -1
  32. package/locales/it-IT/error.json +8 -0
  33. package/locales/it-IT/setting.json +9 -1
  34. package/locales/ja-JP/error.json +8 -0
  35. package/locales/ja-JP/setting.json +9 -1
  36. package/locales/ko-KR/error.json +8 -0
  37. package/locales/ko-KR/setting.json +9 -1
  38. package/locales/nl-NL/error.json +8 -0
  39. package/locales/nl-NL/setting.json +9 -1
  40. package/locales/pl-PL/error.json +8 -0
  41. package/locales/pl-PL/setting.json +9 -1
  42. package/locales/pt-BR/error.json +8 -0
  43. package/locales/pt-BR/setting.json +9 -1
  44. package/locales/ru-RU/error.json +8 -0
  45. package/locales/ru-RU/setting.json +9 -1
  46. package/locales/tr-TR/error.json +8 -0
  47. package/locales/tr-TR/setting.json +9 -1
  48. package/locales/vi-VN/error.json +8 -0
  49. package/locales/vi-VN/setting.json +9 -1
  50. package/locales/zh-CN/error.json +8 -0
  51. package/locales/zh-CN/setting.json +9 -1
  52. package/locales/zh-TW/error.json +8 -0
  53. package/locales/zh-TW/setting.json +9 -1
  54. package/package.json +3 -2
  55. package/src/app/api/auth/next-auth.ts +39 -12
  56. package/src/app/api/config/route.ts +3 -2
  57. package/src/app/api/errorResponse.ts +2 -1
  58. package/src/app/settings/common/Common.tsx +1 -1
  59. package/src/app/settings/llm/Ollama/Checker.tsx +73 -0
  60. package/src/app/settings/llm/Ollama/index.tsx +2 -4
  61. package/src/app/settings/llm/components/Checker.tsx +23 -17
  62. package/src/components/ModelIcon/index.tsx +2 -0
  63. package/src/components/ModelTag/ModelIcon.tsx +2 -0
  64. package/src/config/modelProviders/ollama.ts +14 -0
  65. package/src/config/server/app.ts +4 -0
  66. package/src/config/server/provider.ts +2 -0
  67. package/src/features/Conversation/Error/InvalidOllamaModel/index.tsx +138 -0
  68. package/src/features/Conversation/Error/InvalidOllamaModel/useDownloadMonitor.ts +48 -0
  69. package/src/features/Conversation/Error/OAuthForm.tsx +1 -1
  70. package/src/features/Conversation/Error/OllamaBizError.tsx +34 -0
  71. package/src/features/Conversation/Error/index.tsx +5 -0
  72. package/src/features/Conversation/Error/style.tsx +2 -2
  73. package/src/locales/default/error.ts +8 -0
  74. package/src/locales/default/setting.ts +9 -1
  75. package/src/services/__tests__/ollama.test.ts +26 -0
  76. package/src/services/ollama.ts +64 -0
  77. package/src/store/global/slices/settings/selectors/modelProvider.ts +11 -10
  78. package/src/store/middleware/createHyperStorage/index.ts +1 -2
  79. package/src/store/middleware/createHyperStorage/indexedDB.ts +1 -1
  80. package/src/store/middleware/createHyperStorage/localStorage.ts +1 -1
  81. package/src/store/middleware/createHyperStorage/urlStorage.ts +1 -1
  82. package/src/types/fetch.ts +1 -0
  83. package/tsconfig.json +1 -1
@@ -53,6 +53,7 @@
53
53
  "MoonshotBizError": "请求月球AI服务出错,请根据以下信息排查或重试",
54
54
  "NoOpenAIAPIKey": "OpenAI API-sleutel ontbreekt. Voeg een aangepaste OpenAI API-sleutel toe",
55
55
  "OllamaBizError": "Fout bij het aanroepen van de Ollama-service, controleer de onderstaande informatie en probeer opnieuw",
56
+ "OllamaServiceUnavailable": "Ollama 服务不可用,请检查是否已正常启动",
56
57
  "OpenAIBizError": "Fout bij het aanvragen van OpenAI-service. Controleer de onderstaande informatie voor probleemoplossing of probeer opnieuw",
57
58
  "PerplexityBizError": "Er is een fout opgetreden bij het aanvragen van de Perplexity AI-service. Controleer de onderstaande informatie en probeer het opnieuw.",
58
59
  "PluginApiNotFound": "Sorry, de API van de plug-inbeschrijvingslijst bestaat niet. Controleer of uw verzoeksmethode overeenkomt met de plug-inbeschrijvingslijst API",
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "Sluit bericht",
116
117
  "confirm": "Bevestigen en opnieuw proberen",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "下载",
121
+ "description": "输入您的 Ollama 模型标签,完成后即可继续会话",
122
+ "title": "下载指定的 Ollama 模型"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "De beheerder heeft een uniforme aanmeldingsverificatie ingeschakeld. Klik op de onderstaande knop om in te loggen en de app te ontgrendelen.",
119
127
  "success": "Succesvol ingelogd",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "Meer modellen worden <1>gepland om te worden toegevoegd</1>, dus blijf op de hoogte ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama is bezig met het downloaden van dit model. Gelieve deze pagina niet te sluiten. Het downloaden zal worden hervat vanaf het onderbroken punt als u opnieuw begint te downloaden.",
199
+ "remainingTime": "Resterende tijd",
200
+ "speed": "Downloadsnelheid",
201
+ "title": "Model {{model}} wordt gedownload"
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "Voeg aangepaste plug-in toe",
198
206
  "clearDeprecated": "Verwijder verouderde plug-ins",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "Uitbreidingsgereedschap"
430
438
  }
431
- }
439
+ }
@@ -53,6 +53,7 @@
53
53
  "MoonshotBizError": "请求月球AI服务出错,请根据以下信息排查或重试",
54
54
  "NoOpenAIAPIKey": "Klucz API OpenAI jest pusty. Proszę dodać niestandardowy klucz API OpenAI",
55
55
  "OllamaBizError": "Błąd usługi Ollama, sprawdź poniższe informacje lub spróbuj ponownie",
56
+ "OllamaServiceUnavailable": "Usługa Ollama jest niedostępna. Sprawdź, czy została poprawnie uruchomiona.",
56
57
  "OpenAIBizError": "Błąd żądania usługi OpenAI. Proszę sprawdź poniższe informacje i spróbuj ponownie",
57
58
  "PerplexityBizError": "Błąd biznesowy podczas żądania usługi Perplexity AI. Sprawdź poniższe informacje lub spróbuj ponownie.",
58
59
  "PluginApiNotFound": "Przepraszamy, w manifestach wtyczki nie istnieje to API. Proszę sprawdź, czy metoda żądania jest zgodna z API w manifestach wtyczki",
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "Zamknij komunikat",
116
117
  "confirm": "Potwierdź i spróbuj ponownie",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "Pobierz",
121
+ "description": "Wprowadź etykietę modelu Ollama, aby kontynuować sesję.",
122
+ "title": "Pobierz określony model Ollama"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "Administrator włączył jednolite uwierzytelnianie logowania. Kliknij poniższy przycisk, aby się zalogować i odblokować aplikację.",
119
127
  "success": "Zalogowano pomyślnie",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "Więcej modeli jest obecnie w <1>planach dołączenia</1>, prosimy o cierpliwość ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama pobiera ten model. Prosimy nie zamykać tej strony. Gdy pobieranie zostanie wznowione, będzie kontynuowane od miejsca przerwania.",
199
+ "remainingTime": "Czas pozostały",
200
+ "speed": "Prędkość pobierania",
201
+ "title": "Pobieranie modelu {{model}}"
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "Dodaj niestandardowy dodatek",
198
206
  "clearDeprecated": "Usuń przestarzałe dodatki",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "Narzędzia rozszerzeń"
430
438
  }
431
- }
439
+ }
@@ -53,6 +53,7 @@
53
53
  "MoonshotBizError": "O serviço Moonshot na face oculta da lua encontrou um erro. Por favor, verifique as informações abaixo ou tente novamente.",
54
54
  "NoOpenAIAPIKey": "A chave de API do OpenAI está em branco. Adicione uma chave de API personalizada do OpenAI",
55
55
  "OllamaBizError": "Erro de negócio ao solicitar o serviço Ollama, verifique as informações a seguir ou tente novamente",
56
+ "OllamaServiceUnavailable": "O serviço Ollama não está disponível, verifique se está iniciado corretamente",
56
57
  "OpenAIBizError": "Erro ao solicitar o serviço OpenAI. Verifique ou tente novamente com base nas informações abaixo",
57
58
  "PerplexityBizError": "Erro de negócios ao solicitar o serviço de IA Perplexity, verifique as informações a seguir ou tente novamente",
58
59
  "PluginApiNotFound": "Desculpe, o API especificado não existe no manifesto do plugin. Verifique se o método de solicitação corresponde ao API do manifesto do plugin",
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "Fechar mensagem",
116
117
  "confirm": "Confirmar e tentar novamente",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "Baixar",
121
+ "description": "Digite as tags do seu modelo Ollama para continuar a sessão",
122
+ "title": "Baixar o modelo Ollama especificado"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "O administrador ativou a autenticação de login unificado. Clique no botão abaixo para fazer login e desbloquear o aplicativo.",
119
127
  "success": "Login bem-sucedido",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "Mais modelos estão sendo <1>planejados para serem adicionados</1>, aguarde ansiosamente ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama está baixando este modelo. Por favor, evite fechar esta página. O download será retomado do ponto em que parou, caso seja reiniciado.",
199
+ "remainingTime": "Tempo restante",
200
+ "speed": "Velocidade de download",
201
+ "title": "Baixando modelo {{model}}"
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "Adicionar plug-in personalizado",
198
206
  "clearDeprecated": "Remover plug-ins inválidos",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "Ferramentas de Extensão"
430
438
  }
431
- }
439
+ }
@@ -53,6 +53,7 @@
53
53
  "MoonshotBizError": "请求月球暗面服务出错,请根据以下信息排查或重试",
54
54
  "NoOpenAIAPIKey": "Ключ OpenAI API пуст, пожалуйста, добавьте свой собственный ключ OpenAI API",
55
55
  "OllamaBizError": "Ошибка обращения к сервису Ollama, пожалуйста, проверьте следующую информацию или повторите попытку",
56
+ "OllamaServiceUnavailable": "Сервис Ollama недоступен. Пожалуйста, проверьте, запущен ли он корректно.",
56
57
  "OpenAIBizError": "Ошибка запроса службы OpenAI. Устраните неполадку или повторите попытку, основываясь на следующей информации.",
57
58
  "PerplexityBizError": "Ошибка обращения к сервису Perplexity AI. Пожалуйста, проверьте информацию ниже или повторите попытку",
58
59
  "PluginApiNotFound": "К сожалению, API не существует в манифесте плагина. Пожалуйста, проверьте, соответствует ли ваш метод запроса API манифеста плагина",
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "Закрыть сообщение",
116
117
  "confirm": "Подтвердить и повторить попытку",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "Скачать",
121
+ "description": "Введите метку вашей модели Ollama, чтобы продолжить сеанс",
122
+ "title": "Скачать указанную модель Ollama"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "Администратор включил единую систему аутентификации. Нажмите кнопку ниже, чтобы войти и разблокировать приложение.",
119
127
  "success": "Успешный вход",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "Больше моделей доступно в <1>плане подключения</1>, ожидайте ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama загружает эту модель. Пожалуйста, не закрывайте эту страницу. Загрузка будет возобновлена с того же места, если вы решите начать её заново.",
199
+ "remainingTime": "Оставшееся время",
200
+ "speed": "Скорость загрузки",
201
+ "title": "Загрузка модели {{model}}"
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "Добавить настраиваемый плагин",
198
206
  "clearDeprecated": "Удалить устаревшие плагины",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "Дополнительные инструменты"
430
438
  }
431
- }
439
+ }
@@ -53,6 +53,7 @@
53
53
  "MoonshotBizError": "Moonshot hizmetinde bir hata oluştu, lütfen aşağıdaki bilgilere göre sorunu giderin veya tekrar deneyin",
54
54
  "NoOpenAIAPIKey": "OpenAI API Anahtarı boş, lütfen özel bir OpenAI API Anahtarı ekleyin",
55
55
  "OllamaBizError": "Ollama servisine yapılan istekte hata oluştu, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin",
56
+ "OllamaServiceUnavailable": "Ollama 服务不可用,请检查是否已正常启动",
56
57
  "OpenAIBizError": "OpenAI hizmeti talep ederken hata oluştu. Aşağıdaki bilgilere dayanarak sorun giderin veya tekrar deneyin.",
57
58
  "PerplexityBizError": "Perplexity AI hizmetine yapılan istekte hata oluştu, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin",
58
59
  "PluginApiNotFound": "Üzgünüm, eklentinin bildiriminde API mevcut değil. Lütfen istek yönteminizin eklenti bildirim API'sı ile eşleşip eşleşmediğini kontrol edin",
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "Mesajı kapat",
116
117
  "confirm": "Onayla ve Yeniden Dene",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "下载",
121
+ "description": "Ollama model etiketinizi girin ve devam etmek için tamamlayın",
122
+ "title": "Belirli Ollama modelini indir"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "Yönetici, tek oturum açma kimlik doğrulamasını etkinleştirdi. Aşağıdaki düğmeye tıklayarak giriş yapabilir ve uygulamayı kilidini açabilirsiniz.",
119
127
  "success": "Giriş başarılı",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "Daha fazla model eklenmesi planlanıyor ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama bu modeli indiriyor, lütfen bu sayfayı kapatmamaya çalışın. Yeniden indirme durumunda kaldığı yerden devam edecektir.",
199
+ "remainingTime": "Kalan Zaman",
200
+ "speed": "İndirme Hızı",
201
+ "title": "{{model}} Modeli İndiriliyor"
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "Eklenti Ekle",
198
206
  "clearDeprecated": "Kullanım Dışı Eklentileri Kaldır",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "Uzantı Araçları"
430
438
  }
431
- }
439
+ }
@@ -53,6 +53,7 @@
53
53
  "MoonshotBizError": "Yêu cầu dịch vụ Mặt Trăng Tối gặp sự cố, vui lòng kiểm tra thông tin dưới đây hoặc thử lại",
54
54
  "NoOpenAIAPIKey": "Khóa API OpenAI trống, vui lòng thêm Khóa API OpenAI tùy chỉnh",
55
55
  "OllamaBizError": "Yêu cầu dịch vụ Ollama gặp lỗi, vui lòng kiểm tra thông tin dưới đây hoặc thử lại",
56
+ "OllamaServiceUnavailable": "Dịch vụ Ollama không khả dụng, vui lòng kiểm tra xem nó đã được khởi động chưa",
56
57
  "OpenAIBizError": "Yêu cầu dịch vụ OpenAI gặp lỗi, vui lòng xác minh hoặc thử lại dựa trên thông tin dưới đây",
57
58
  "PerplexityBizError": "Yêu cầu dịch vụ AI Perplexity gặp lỗi, vui lòng kiểm tra thông tin dưới đây hoặc thử lại sau",
58
59
  "PluginApiNotFound": "Xin lỗi, không có API nào trong tệp mô tả plugin, vui lòng kiểm tra phương thức yêu cầu của bạn có khớp với API mô tả plugin không",
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "Đóng thông báo",
116
117
  "confirm": "Xác nhận và thử lại",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "Tải xuống",
121
+ "description": "Nhập nhãn mô hình Ollama của bạn để tiếp tục cuộc trò chuyện",
122
+ "title": "Tải xuống mô hình Ollama cụ thể"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "Quản trị viên đã mở tính năng xác thực đăng nhập thống nhất. Nhấn vào nút bên dưới để đăng nhập và mở khóa ứng dụng",
119
127
  "success": "Đăng nhập thành công",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "Có thêm mô hình đang <1>được lên kế hoạch tích hợp</1>, hãy chờ đợi ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama đang tải xuống mô hình này, vui lòng không đóng trang này. Quá trình tải xuống sẽ tiếp tục từ nơi đã bị gián đoạn khi tải lại",
199
+ "remainingTime": "Thời gian còn lại",
200
+ "speed": "Tốc độ tải xuống",
201
+ "title": "Đang tải xuống mô hình {{model}}"
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "Thêm tiện ích",
198
206
  "clearDeprecated": "Xóa tiện ích không còn hỗ trợ",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "Công cụ mở rộng"
430
438
  }
431
- }
439
+ }
@@ -67,6 +67,7 @@
67
67
  "AnthropicBizError": "请求 Anthropic AI 服务出错,请根据以下信息排查或重试",
68
68
  "InvalidOllamaArgs": "Ollama 配置不正确,请检查 Ollama 配置后重试",
69
69
  "OllamaBizError": "请求 Ollama 服务出错,请根据以下信息排查或重试",
70
+ "OllamaServiceUnavailable": "未检测到 Ollama 服务,请检查是否正常启动",
70
71
  "AgentRuntimeError": "Lobe 语言模型运行时执行出错,请根据以下信息排查或重试"
71
72
  },
72
73
  "stt": {
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "关闭提示",
116
117
  "confirm": "确认并重试",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "下载",
121
+ "description": "输入你的 Ollama 模型标签,完成即可继续会话",
122
+ "title": "下载指定的 Ollama 模型"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "管理员已开启统一登录认证,点击下方按钮登录,即可解锁应用",
119
127
  "success": "登录成功",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "更多模型正在 <1>计划接入</1> 中,敬请期待 ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama 正在下载该模型,请尽量不要关闭本页面。重新下载时将会中断处继续",
199
+ "remainingTime": "剩余时间",
200
+ "speed": "下载速度",
201
+ "title": "正在下载模型 {{model}} "
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "自定义插件",
198
206
  "clearDeprecated": "移除无效插件",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "扩展插件"
430
438
  }
431
- }
439
+ }
@@ -53,6 +53,7 @@
53
53
  "MoonshotBizError": "請求月球背面服務出錯,請根據以下信息排查或重試",
54
54
  "NoOpenAIAPIKey": "OpenAI API 金鑰為空,請添加自訂 OpenAI API 金鑰",
55
55
  "OllamaBizError": "請求 Ollama 服務出錯,請根據以下資訊排查或重試",
56
+ "OllamaServiceUnavailable": "未偵測到 Ollama 服務,請檢查是否正常啟動",
56
57
  "OpenAIBizError": "請求 OpenAI 服務出錯。請根據以下資訊進行排查或重試。",
57
58
  "PerplexityBizError": "請求 Perplexity AI 服務出錯,請根據以下信息排查或重試",
58
59
  "PluginApiNotFound": "抱歉,外掛描述檔案中不存在該 API。請檢查您的請求方法與外掛清單 API 是否相符",
@@ -114,6 +115,13 @@
114
115
  },
115
116
  "closeMessage": "關閉提示",
116
117
  "confirm": "確認並重試",
118
+ "model": {
119
+ "Ollama": {
120
+ "confirm": "下載",
121
+ "description": "輸入你的 Ollama 模型標籤,完成即可繼續會話",
122
+ "title": "下載指定的 Ollama 模型"
123
+ }
124
+ },
117
125
  "oauth": {
118
126
  "description": "管理員已開啟統一登錄認證,點擊下方按鈕登錄,即可解鎖應用",
119
127
  "success": "登錄成功",
@@ -193,6 +193,14 @@
193
193
  },
194
194
  "waitingForMore": "更多模型正在 <1>計劃接入</1> 中,敬請期待 ✨"
195
195
  },
196
+ "ollama": {
197
+ "download": {
198
+ "desc": "Ollama 正在下載該模型,請儘量不要關閉本頁面。重新下載時將會中斷處繼續",
199
+ "remainingTime": "剩餘時間",
200
+ "speed": "下載速度",
201
+ "title": "正在下載模型 {{model}}"
202
+ }
203
+ },
196
204
  "plugin": {
197
205
  "addTooltip": "新增自訂外掛程式",
198
206
  "clearDeprecated": "清除已棄用的外掛",
@@ -428,4 +436,4 @@
428
436
  },
429
437
  "title": "擴展工具"
430
438
  }
431
- }
439
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.135.4",
3
+ "version": "0.137.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",
@@ -120,6 +120,7 @@
120
120
  "next-sitemap": "^4",
121
121
  "numeral": "^2",
122
122
  "nuqs": "^1",
123
+ "ollama": "^0.5.0",
123
124
  "openai": "^4.22",
124
125
  "polished": "^4",
125
126
  "posthog-js": "^1",
@@ -169,7 +170,7 @@
169
170
  "@types/lodash-es": "^4",
170
171
  "@types/node": "^20",
171
172
  "@types/numeral": "^2",
172
- "@types/react": "18.2.65",
173
+ "@types/react": "^18",
173
174
  "@types/react-dom": "^18",
174
175
  "@types/rtl-detect": "^1",
175
176
  "@types/semver": "^7",
@@ -1,10 +1,20 @@
1
1
  import NextAuth from 'next-auth';
2
2
  import Auth0 from 'next-auth/providers/auth0';
3
+ import AzureAd from 'next-auth/providers/azure-ad';
3
4
 
4
5
  import { getServerConfig } from '@/config/server';
5
6
 
6
- const { AUTH0_CLIENT_ID, ENABLE_OAUTH_SSO, AUTH0_CLIENT_SECRET, AUTH0_ISSUER, NEXTAUTH_SECRET } =
7
- getServerConfig();
7
+ const {
8
+ ENABLE_OAUTH_SSO,
9
+ SSO_PROVIDERS,
10
+ AUTH0_CLIENT_ID,
11
+ AUTH0_CLIENT_SECRET,
12
+ AUTH0_ISSUER,
13
+ AZURE_AD_CLIENT_ID,
14
+ AZURE_AD_CLIENT_SECRET,
15
+ AZURE_AD_TENANT_ID,
16
+ NEXTAUTH_SECRET,
17
+ } = getServerConfig();
8
18
 
9
19
  declare module '@auth/core/jwt' {
10
20
  // Returned by the `jwt` callback and `auth`, when using JWT sessions
@@ -33,16 +43,33 @@ const nextAuth = NextAuth({
33
43
  },
34
44
  },
35
45
  providers: ENABLE_OAUTH_SSO
36
- ? [
37
- Auth0({
38
- // Specify auth scope, at least include 'openid email'
39
- // all scopes in Auth0 ref: https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes#standard-claims
40
- authorization: { params: { scope: 'openid email profile' } },
41
- clientId: AUTH0_CLIENT_ID,
42
- clientSecret: AUTH0_CLIENT_SECRET,
43
- issuer: AUTH0_ISSUER,
44
- }),
45
- ]
46
+ ? SSO_PROVIDERS.split(/[,,]/).map((provider) => {
47
+ switch (provider) {
48
+ case 'auth0': {
49
+ return Auth0({
50
+ // Specify auth scope, at least include 'openid email'
51
+ // all scopes in Auth0 ref: https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes#standard-claims
52
+ authorization: { params: { scope: 'openid email profile' } },
53
+ clientId: AUTH0_CLIENT_ID,
54
+ clientSecret: AUTH0_CLIENT_SECRET,
55
+ issuer: AUTH0_ISSUER,
56
+ });
57
+ }
58
+ case 'azure-ad': {
59
+ return AzureAd({
60
+ // Specify auth scope, at least include 'openid email'
61
+ // all scopes in Azure AD ref: https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc#openid-connect-scopes
62
+ authorization: { params: { scope: 'openid email profile' } },
63
+ clientId: AZURE_AD_CLIENT_ID,
64
+ clientSecret: AZURE_AD_CLIENT_SECRET,
65
+ tenantId: AZURE_AD_TENANT_ID,
66
+ });
67
+ }
68
+ default: {
69
+ throw new Error(`[NextAuth] provider ${provider} is not supported`);
70
+ }
71
+ }
72
+ })
46
73
  : [],
47
74
  secret: NEXTAUTH_SECRET,
48
75
  trustHost: true,
@@ -10,6 +10,7 @@ export const runtime = 'edge';
10
10
  */
11
11
  export const GET = async () => {
12
12
  const {
13
+ ENABLE_LANGFUSE,
13
14
  CUSTOM_MODELS,
14
15
  ENABLED_MOONSHOT,
15
16
  ENABLED_ZHIPU,
@@ -21,7 +22,7 @@ export const GET = async () => {
21
22
  ENABLED_ANTHROPIC,
22
23
  ENABLED_MISTRAL,
23
24
  DEFAULT_AGENT_CONFIG,
24
- ENABLE_LANGFUSE,
25
+ OLLAMA_CUSTOM_MODELS,
25
26
  } = getServerConfig();
26
27
 
27
28
  const config: GlobalServerConfig = {
@@ -37,7 +38,7 @@ export const GET = async () => {
37
38
  google: { enabled: ENABLED_GOOGLE },
38
39
  mistral: { enabled: ENABLED_MISTRAL },
39
40
  moonshot: { enabled: ENABLED_MOONSHOT },
40
- ollama: { enabled: ENABLE_OLLAMA },
41
+ ollama: { customModelName: OLLAMA_CUSTOM_MODELS, enabled: ENABLE_OLLAMA },
41
42
  perplexity: { enabled: ENABLED_PERPLEXITY },
42
43
  zhipu: { enabled: ENABLED_ZHIPU },
43
44
  },
@@ -1,5 +1,5 @@
1
1
  import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/agent-runtime';
2
- import { ErrorResponse, ErrorType } from '@/types/fetch';
2
+ import { ChatErrorType, ErrorResponse, ErrorType } from '@/types/fetch';
3
3
 
4
4
  const getStatus = (errorType: ILobeAgentRuntimeErrorType | ErrorType) => {
5
5
  // InvalidAccessCode / InvalidAzureAPIKey / InvalidOpenAIAPIKey / InvalidZhipuAPIKey ....
@@ -37,6 +37,7 @@ const getStatus = (errorType: ILobeAgentRuntimeErrorType | ErrorType) => {
37
37
  case AgentRuntimeErrorType.MoonshotBizError: {
38
38
  return 476;
39
39
  }
40
+ case ChatErrorType.OllamaServiceUnavailable:
40
41
  case AgentRuntimeErrorType.OllamaBizError: {
41
42
  return 478;
42
43
  }
@@ -58,7 +58,7 @@ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin
58
58
  }, []);
59
59
 
60
60
  const handleSignIn = useCallback(() => {
61
- signIn('auth0');
61
+ signIn();
62
62
  }, []);
63
63
 
64
64
  const handleReset = useCallback(() => {
@@ -0,0 +1,73 @@
1
+ import { CheckCircleFilled } from '@ant-design/icons';
2
+ import { Alert, Highlighter } from '@lobehub/ui';
3
+ import { Button } from 'antd';
4
+ import { useTheme } from 'antd-style';
5
+ import { ListResponse } from 'ollama/browser';
6
+ import { memo } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { Flexbox } from 'react-layout-kit';
9
+ import useSWR from 'swr';
10
+
11
+ import { useIsMobile } from '@/hooks/useIsMobile';
12
+ import { ollamaService } from '@/services/ollama';
13
+
14
+ const OllamaChecker = memo(() => {
15
+ const { t } = useTranslation('setting');
16
+
17
+ const theme = useTheme();
18
+
19
+ const { data, error, isLoading, mutate } = useSWR<ListResponse>(
20
+ 'ollama.list',
21
+ ollamaService.getModels,
22
+ {
23
+ revalidateOnFocus: false,
24
+ revalidateOnMount: false,
25
+ revalidateOnReconnect: false,
26
+ },
27
+ );
28
+
29
+ const checkConnection = () => {
30
+ mutate();
31
+ };
32
+
33
+ const isMobile = useIsMobile();
34
+
35
+ return (
36
+ <Flexbox align={isMobile ? 'flex-start' : 'flex-end'} gap={8}>
37
+ <Flexbox align={'center'} direction={isMobile ? 'horizontal-reverse' : 'horizontal'} gap={12}>
38
+ {!error && data?.models && (
39
+ <Flexbox gap={4} horizontal>
40
+ <CheckCircleFilled
41
+ style={{
42
+ color: theme.colorSuccess,
43
+ }}
44
+ />
45
+ {t('llm.checker.pass')}
46
+ </Flexbox>
47
+ )}
48
+ <Button loading={isLoading} onClick={checkConnection}>
49
+ {t('llm.checker.button')}
50
+ </Button>
51
+ </Flexbox>
52
+ {error && (
53
+ <Flexbox gap={8} style={{ maxWidth: '600px', width: '100%' }}>
54
+ <Alert
55
+ banner
56
+ extra={
57
+ <Flexbox>
58
+ <Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
59
+ {JSON.stringify(error.body || error, null, 2)}
60
+ </Highlighter>
61
+ </Flexbox>
62
+ }
63
+ message={t(`response.${error.type}` as any, { ns: 'error' })}
64
+ showIcon
65
+ type={'error'}
66
+ />
67
+ </Flexbox>
68
+ )}
69
+ </Flexbox>
70
+ );
71
+ });
72
+
73
+ export default OllamaChecker;
@@ -4,9 +4,7 @@ import { useTheme } from 'antd-style';
4
4
  import { memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
- import { ModelProvider } from '@/libs/agent-runtime';
8
-
9
- import Checker from '../components/Checker';
7
+ import Checker from './Checker';
10
8
  import ProviderConfig from '../components/ProviderConfig';
11
9
  import { LLMProviderBaseUrlKey, LLMProviderConfigKey } from '../const';
12
10
 
@@ -38,7 +36,7 @@ const OllamaProvider = memo(() => {
38
36
  name: [LLMProviderConfigKey, providerKey, 'customModelName'],
39
37
  },
40
38
  {
41
- children: <Checker model={'llama2'} provider={ModelProvider.Ollama} />,
39
+ children: <Checker />,
42
40
  desc: t('llm.Ollama.checker.desc'),
43
41
  label: t('llm.checker.title'),
44
42
  minWidth: undefined,
@@ -16,6 +16,28 @@ interface ConnectionCheckerProps {
16
16
  provider: string;
17
17
  }
18
18
 
19
+ const Error = memo<{ error: ChatMessageError }>(({ error }) => {
20
+ const { t } = useTranslation('error');
21
+
22
+ return (
23
+ <Flexbox gap={8} style={{ maxWidth: '600px', width: '100%' }}>
24
+ <Alert
25
+ banner
26
+ extra={
27
+ <Flexbox>
28
+ <Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
29
+ {JSON.stringify(error.body || error, null, 2)}
30
+ </Highlighter>
31
+ </Flexbox>
32
+ }
33
+ message={t(`response.${error.type}` as any)}
34
+ showIcon
35
+ type={'error'}
36
+ />
37
+ </Flexbox>
38
+ );
39
+ });
40
+
19
41
  const Checker = memo<ConnectionCheckerProps>(({ model, provider }) => {
20
42
  const { t } = useTranslation('setting');
21
43
 
@@ -75,23 +97,7 @@ const Checker = memo<ConnectionCheckerProps>(({ model, provider }) => {
75
97
  {t('llm.checker.button')}
76
98
  </Button>
77
99
  </Flexbox>
78
- {error && (
79
- <Flexbox gap={8} style={{ maxWidth: '600px', width: '100%' }}>
80
- <Alert
81
- banner
82
- extra={
83
- <Flexbox>
84
- <Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
85
- {JSON.stringify(error.body || error, null, 2)}
86
- </Highlighter>
87
- </Flexbox>
88
- }
89
- message={t(`response.${error.type}` as any, { ns: 'error' })}
90
- showIcon
91
- type={'error'}
92
- />
93
- </Flexbox>
94
- )}
100
+ {error && <Error error={error} />}
95
101
  </Flexbox>
96
102
  );
97
103
  });