mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-19 13:54:10 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16dd71b5e9 | |||
| ad8f5e451b | |||
| 67abdfe153 | |||
| 672580737f | |||
| 778152f966 | |||
| 018ca7598c | |||
| 6bfba72dce | |||
| b7dbcfd310 | |||
| 3264cf2106 | |||
| 9a372f622d | |||
| de05d4165f | |||
| 57118b031e | |||
| c4b2bb59c3 | |||
| 2211cd7632 | |||
| 2a3754a436 | |||
| e448d52d5c | |||
| 04edfca6e0 | |||
| b9e3e6633e |
+160
@@ -2,6 +2,166 @@
|
||||
|
||||
# Changelog
|
||||
|
||||
## [Version 1.106.0](https://github.com/lobehub/lobe-chat/compare/v1.105.6...v1.106.0)
|
||||
|
||||
<sup>Released on **2025-07-29**</sup>
|
||||
|
||||
#### ✨ Features
|
||||
|
||||
- **misc**: Add support for Okta Authentication.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's improved
|
||||
|
||||
- **misc**: Add support for Okta Authentication, closes [#8547](https://github.com/lobehub/lobe-chat/issues/8547) ([67abdfe](https://github.com/lobehub/lobe-chat/commit/67abdfe))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
### [Version 1.105.6](https://github.com/lobehub/lobe-chat/compare/v1.105.5...v1.105.6)
|
||||
|
||||
<sup>Released on **2025-07-29**</sup>
|
||||
|
||||
#### 💄 Styles
|
||||
|
||||
- **misc**: Open new topic by tap Just Chat again.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### Styles
|
||||
|
||||
- **misc**: Open new topic by tap Just Chat again, closes [#8426](https://github.com/lobehub/lobe-chat/issues/8426) ([018ca75](https://github.com/lobehub/lobe-chat/commit/018ca75))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
### [Version 1.105.5](https://github.com/lobehub/lobe-chat/compare/v1.105.4...v1.105.5)
|
||||
|
||||
<sup>Released on **2025-07-29**</sup>
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Reorder AppTheme and Locale to fix modal i18n.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Reorder AppTheme and Locale to fix modal i18n, closes [#8600](https://github.com/lobehub/lobe-chat/issues/8600) ([3264cf2](https://github.com/lobehub/lobe-chat/commit/3264cf2))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
### [Version 1.105.4](https://github.com/lobehub/lobe-chat/compare/v1.105.3...v1.105.4)
|
||||
|
||||
<sup>Released on **2025-07-29**</sup>
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Revert jose to ^5 to fix auth issue on desktop.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Revert jose to ^5 to fix auth issue on desktop, closes [#8603](https://github.com/lobehub/lobe-chat/issues/8603) ([57118b0](https://github.com/lobehub/lobe-chat/commit/57118b0))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
### [Version 1.105.3](https://github.com/lobehub/lobe-chat/compare/v1.105.2...v1.105.3)
|
||||
|
||||
<sup>Released on **2025-07-29**</sup>
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Fix subscription plan tag display.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Fix subscription plan tag display, closes [#8599](https://github.com/lobehub/lobe-chat/issues/8599) ([2a3754a](https://github.com/lobehub/lobe-chat/commit/2a3754a))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
### [Version 1.105.2](https://github.com/lobehub/lobe-chat/compare/v1.105.1...v1.105.2)
|
||||
|
||||
<sup>Released on **2025-07-29**</sup>
|
||||
|
||||
#### ♻ Code Refactoring
|
||||
|
||||
- **misc**: Clean mcp sitemap, refactor jose-JWT to xor obfuscation.
|
||||
|
||||
#### 💄 Styles
|
||||
|
||||
- **misc**: Add more OpenAI SDK Text2Image providers, update i18n.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### Code refactoring
|
||||
|
||||
- **misc**: Clean mcp sitemap, closes [#8596](https://github.com/lobehub/lobe-chat/issues/8596) ([b9e3e66](https://github.com/lobehub/lobe-chat/commit/b9e3e66))
|
||||
- **misc**: Refactor jose-JWT to xor obfuscation, closes [#8595](https://github.com/lobehub/lobe-chat/issues/8595) ([be98d56](https://github.com/lobehub/lobe-chat/commit/be98d56))
|
||||
|
||||
#### Styles
|
||||
|
||||
- **misc**: Add more OpenAI SDK Text2Image providers, closes [#8573](https://github.com/lobehub/lobe-chat/issues/8573) ([403aebd](https://github.com/lobehub/lobe-chat/commit/403aebd))
|
||||
- **misc**: Update i18n, closes [#8593](https://github.com/lobehub/lobe-chat/issues/8593) ([356cf0c](https://github.com/lobehub/lobe-chat/commit/356cf0c))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
### [Version 1.105.1](https://github.com/lobehub/lobe-chat/compare/v1.105.0...v1.105.1)
|
||||
|
||||
<sup>Released on **2025-07-29**</sup>
|
||||
|
||||
@@ -1,4 +1,39 @@
|
||||
[
|
||||
{
|
||||
"children": {
|
||||
"improvements": ["Open new topic by tap Just Chat again."]
|
||||
},
|
||||
"date": "2025-07-29",
|
||||
"version": "1.105.6"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Reorder AppTheme and Locale to fix modal i18n."]
|
||||
},
|
||||
"date": "2025-07-29",
|
||||
"version": "1.105.5"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Revert jose to ^5 to fix auth issue on desktop."]
|
||||
},
|
||||
"date": "2025-07-29",
|
||||
"version": "1.105.4"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Fix subscription plan tag display."]
|
||||
},
|
||||
"date": "2025-07-29",
|
||||
"version": "1.105.3"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"improvements": ["Add more OpenAI SDK Text2Image providers, update i18n."]
|
||||
},
|
||||
"date": "2025-07-29",
|
||||
"version": "1.105.2"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"improvements": ["Support more Text2Image from Qwen."]
|
||||
|
||||
@@ -55,6 +55,8 @@ Currently supported identity verification services include:
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/google'} title={'Google'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
|
||||
</Cards>
|
||||
|
||||
Click on the links to view the corresponding platform's configuration documentation.
|
||||
@@ -78,6 +80,7 @@ The order corresponds to the display order of the SSO providers.
|
||||
| ZITADEL | `zitadel` |
|
||||
| Keycloak | `keycloak` |
|
||||
| Google | `google` |
|
||||
| Okta | `okta` |
|
||||
|
||||
## Other SSO Providers
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/logto'} title={'Logto'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
|
||||
</Cards>
|
||||
|
||||
点击即可查看对应平台的配置文档。
|
||||
@@ -73,6 +75,7 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全
|
||||
| Microsoft Entra ID | `microsoft-entra-id` |
|
||||
| ZITADEL | `zitadel` |
|
||||
| Keycloak | `keycloak` |
|
||||
| Okta | `okta` |
|
||||
|
||||
## 其他 SSO 提供商
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: Configure Okta Identity Verification Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Okta Identity Verification Service for LobeChat for your organization, including creating applications, adding users, and configuring environment variables.
|
||||
|
||||
tags:
|
||||
- Okta
|
||||
- Identity Verification
|
||||
- Single Sign-On
|
||||
- Environment Variables
|
||||
- User Management
|
||||
- SSO Integrations
|
||||
- Social Login
|
||||
---
|
||||
|
||||
# Configure Okta Identity Verification Service
|
||||
|
||||
<Steps>
|
||||
### Create Okta Application
|
||||
|
||||
Register and log in to [Okta][okta-client-page], open the "Applications" subtab in the left navigation bar, and click "Applications" to switch to the application management interface. click "Create App Integration" in the upper left corner to create an application.
|
||||
|
||||
Select "OIDC - OpenID Connect" in Sign-In Method and then select "Web Application" in Application Type.
|
||||
|
||||
Fill in the following settings:
|
||||
|
||||
| Setting Name | Description | Sample Information |
|
||||
| ---------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------- |
|
||||
| App Integration Name | The Application Name your users will see | LobeChat Instance |
|
||||
| Sign-in redirect URIs | Okta sends the authentication response and ID token for the user's sign-in request to these URIs | (http(s)://your-domain/api/auth/callback/okta |
|
||||
| Sign-out redirect URIs | After your application contacts Okta to close the user session, Okta redirects the user to one of these URIs | (http(s)://your-domain |
|
||||
|
||||
<Callout type={'important'}>
|
||||
You can fill in or modify all the fields after deployment, but make sure the filled URL is
|
||||
consistent with the deployed URL.
|
||||
</Callout>
|
||||
|
||||
### Add Users
|
||||
|
||||
Click on the "Assignments" in the top navigation bar to enter the user management interface, where you can create or assign users in your organization to log in to LobeChat.
|
||||
|
||||
### Configure Environment Variables
|
||||
|
||||
When deploying LobeChat, you need to configure the following environment variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
|
||||
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `okta` for Okta. |
|
||||
| `AUTH_OKTA_ID` | Required | Client ID of the Okta application |
|
||||
| `AUTH_OKTA_SECRET` | Required | Client Secret of the Okta application |
|
||||
| `AUTH_OKTA_ISSUER` | Required | Domain of the Okta application, `https://example.oktapreview.com` |
|
||||
| `NEXTAUTH_URL` | Optional | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
You can refer to the related variable details at [📘Environment Variables](/docs/self-hosting/environment-variable/auth#okta).
|
||||
</Callout>
|
||||
</Steps>
|
||||
|
||||
<Callout>
|
||||
After successful deployment, users will be able to authenticate and use LobeChat using the users
|
||||
configured in Okta.
|
||||
</Callout>
|
||||
|
||||
[okta-client-page]: https://login.okta.com
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
title: 在 LobeChat 中配置 Okta 身份验证服务 - 详细步骤和环境变量设置
|
||||
description: >-
|
||||
学习如何在 LobeChat 中为您的组织配置 Okta 身份验证服务,包括创建应用程序、添加用户和配置环境变量等。
|
||||
|
||||
tags:
|
||||
- Okta
|
||||
- 身份验证
|
||||
- 单点登录
|
||||
- 环境变量
|
||||
- 用户管理
|
||||
- SSO 集成
|
||||
- 社交登录
|
||||
---
|
||||
|
||||
# 配置 Okta 身份验证服务
|
||||
|
||||
<Steps>
|
||||
### 创建 Okta 应用程序
|
||||
|
||||
注册并登录 [Okta][okta-client-page],打开左侧导航栏中的「Applications」子选项卡,点击「Applications」切换到应用程序管理界面。点击左上角的「Create App Integration」创建应用程序。
|
||||
|
||||
在登录方法中选择「OIDC - OpenID Connect」,然后在应用程序类型中选择「Web Application」。
|
||||
|
||||
填写以下设置:
|
||||
|
||||
| 设置名称 | 描述 | 示例信息 |
|
||||
| ---------------------- | ------------------------------------------- | --------------------------------------------- |
|
||||
| App Integration Name | 您的用户将看到的应用程序名称 | LobeChat Instance |
|
||||
| Sign-in redirect URIs | Okta 将用户登录请求的身份验证响应和 ID 令牌发送到这些 URI | (http(s)://your-domain/api/auth/callback/okta |
|
||||
| Sign-out redirect URIs | 您的应用程序联系 Okta 关闭用户会话后,Okta 将用户重定向到这些 URI 之一 | (http(s)://your-domain |
|
||||
|
||||
<Callout type={'important'}>
|
||||
您可以在部署后填写或修改所有字段,但请确保填写的 URL 与部署的 URL 一致。
|
||||
</Callout>
|
||||
|
||||
### 添加用户
|
||||
|
||||
点击顶部导航栏中的「Assignments」进入用户管理界面,您可以在此创建或分配组织中的用户来登录 LobeChat。
|
||||
|
||||
### 配置环境变量
|
||||
|
||||
在部署 LobeChat 时,您需要配置以下环境变量:
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| ------------------------- | -- | ------------------------------------------------------------------------------------ |
|
||||
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成密钥:`openssl rand -base64 32` |
|
||||
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Okta 请填写 `okta`。 |
|
||||
| `AUTH_OKTA_ID` | 必选 | Okta 应用程序的客户端 ID |
|
||||
| `AUTH_OKTA_SECRET` | 必选 | Okta 应用程序的客户端密钥 |
|
||||
| `AUTH_OKTA_ISSUER` | 必选 | Okta 应用程序的域名,`https://example.oktapreview.com` |
|
||||
| `NEXTAUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 认证时的回调地址。仅当默认地址不正确时才需要设置。`https://example.com/api/auth` |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
您可以在 [📘环境变量](/zh/docs/self-hosting/environment-variables/auth#okta) 查阅相关变量详情。
|
||||
</Callout>
|
||||
</Steps>
|
||||
|
||||
<Callout>
|
||||
部署成功后,用户将能够使用在 Okta 中配置的用户进行身份验证并使用 LobeChat。
|
||||
</Callout>
|
||||
|
||||
[okta-client-page]: https://login.okta.com
|
||||
@@ -249,6 +249,29 @@ LobeChat provides a complete authentication service capability when deployed. Th
|
||||
- Default: `-`
|
||||
- Example: `https://your-instance-abc123.zitadel.cloud`
|
||||
|
||||
### Okta
|
||||
|
||||
#### `AUTH_OKTA_ID`
|
||||
|
||||
- Type: Required
|
||||
- Description: Client ID of the Okta application. This can be found under your application settings in the Okta console.
|
||||
- Default: `-`
|
||||
- Example: `ac12c950f3ce48c8a45a`
|
||||
|
||||
#### `AUTH_OKTA_SECRET`
|
||||
|
||||
- Type: Required
|
||||
- Description: Client Secret of the Okta application. This can be found under your application settings in the Okta console.
|
||||
- Default: `-`
|
||||
- Example: `ex1HqvSOOkC5INqo42grOSqNvHoD4p84em1yy5QU7v88IZlaWGywFjYkrkpkSopt`
|
||||
|
||||
#### `AUTH_OKTA_ISSUER`
|
||||
|
||||
- Type: Required
|
||||
- Description: Issuer of the Okta application. This is the URL of the Okta instance -- If branding is set up, it can be your custom domain.
|
||||
- Default: `-`
|
||||
- Example: `https://your-instance.okta.com`
|
||||
|
||||
### Generic OIDC
|
||||
|
||||
#### `AUTH_GENERIC_OIDC_ID`
|
||||
|
||||
@@ -245,6 +245,29 @@ LobeChat 在部署时提供了完善的身份验证服务能力,以下是相
|
||||
- 默认值:`-`
|
||||
- 示例:`https://your-instance-abc123.zitadel.cloud`
|
||||
|
||||
### Okta
|
||||
|
||||
#### `AUTH_OKTA_ID`
|
||||
|
||||
- 类型:必选
|
||||
- 描述:Okta 应用程序的 Client ID。您可以在 Okta 控制台的应用程序设置中找到。
|
||||
- 默认值:`-`
|
||||
- 示例:`ac12c950f3ce48c8a45a`
|
||||
|
||||
#### `AUTH_OKTA_SECRET`
|
||||
|
||||
- 类型:必选
|
||||
- 描述:Okta 应用程序的 Client Secret。您可以在 Okta 控制台的应用程序设置中找到。
|
||||
- 默认值:`-`
|
||||
- 示例:`ex1HqvSOOkC5INqo42grOSqNvHoD4p84em1yy5QU7v88IZlaWGywFjYkrkpkSopt`
|
||||
|
||||
#### `AUTH_OKTA_ISSUER`
|
||||
|
||||
- 类型:必选
|
||||
- 描述:Okta 应用程序的 OpenID Connect 颁发者(issuer)。这是 Okta 实例的 URL—— 如果设置了品牌化,也可以是您的自定义域名。
|
||||
- 默认值:`-`
|
||||
- 示例:`https://your-instance.okta.com`
|
||||
|
||||
### Generic OIDC
|
||||
|
||||
#### `AUTH_GENERIC_OIDC_ID`
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@lobehub/chat",
|
||||
"version": "1.105.1",
|
||||
"version": "1.106.0",
|
||||
"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.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
@@ -196,7 +196,7 @@
|
||||
"i18next-resources-to-backend": "^1.2.1",
|
||||
"idb-keyval": "^6.2.2",
|
||||
"immer": "^10.1.1",
|
||||
"jose": "^6.0.12",
|
||||
"jose": "^5.10.0",
|
||||
"js-sha256": "^0.11.1",
|
||||
"jsonl-parse-stringify": "^1.0.3",
|
||||
"keyv": "^4.5.4",
|
||||
|
||||
+17
-2
@@ -6,6 +6,8 @@ import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
|
||||
import { INBOX_SESSION_ID } from '@/const/session';
|
||||
import { SESSION_CHAT_URL } from '@/const/url';
|
||||
import { useSwitchSession } from '@/hooks/useSwitchSession';
|
||||
import { getChatStoreState, useChatStore } from '@/store/chat';
|
||||
import { chatSelectors } from '@/store/chat/selectors';
|
||||
import { useServerConfigStore } from '@/store/serverConfig';
|
||||
import { useSessionStore } from '@/store/session';
|
||||
|
||||
@@ -17,13 +19,26 @@ const Inbox = memo(() => {
|
||||
const activeId = useSessionStore((s) => s.activeId);
|
||||
const switchSession = useSwitchSession();
|
||||
|
||||
const openNewTopicOrSaveTopic = useChatStore((s) => s.openNewTopicOrSaveTopic);
|
||||
|
||||
return (
|
||||
<Link
|
||||
aria-label={t('inbox.title')}
|
||||
href={SESSION_CHAT_URL(INBOX_SESSION_ID, mobile)}
|
||||
onClick={(e) => {
|
||||
onClick={async (e) => {
|
||||
e.preventDefault();
|
||||
switchSession(INBOX_SESSION_ID);
|
||||
|
||||
if (activeId === INBOX_SESSION_ID && !mobile) {
|
||||
// If user tap the inbox again, open a new topic.
|
||||
// Only for desktop.
|
||||
const inboxMessages = chatSelectors.inboxActiveTopicMessages(getChatStoreState());
|
||||
|
||||
if (inboxMessages.length > 0) {
|
||||
await openNewTopicOrSaveTopic();
|
||||
}
|
||||
} else {
|
||||
switchSession(INBOX_SESSION_ID);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ListItem
|
||||
|
||||
+1
-10
@@ -17,10 +17,9 @@ export async function generateSitemaps() {
|
||||
const staticSitemaps = sitemapModule.sitemapIndexs;
|
||||
|
||||
// 获取需要分页的类型的页数
|
||||
const [pluginPages, assistantPages, mcpPages, modelPages] = await Promise.all([
|
||||
const [pluginPages, assistantPages, modelPages] = await Promise.all([
|
||||
sitemapModule.getPluginPageCount(),
|
||||
sitemapModule.getAssistantPageCount(),
|
||||
sitemapModule.getMcpPageCount(),
|
||||
sitemapModule.getModelPageCount(),
|
||||
]);
|
||||
|
||||
@@ -30,7 +29,6 @@ export async function generateSitemaps() {
|
||||
...Array.from({ length: assistantPages }, (_, i) => ({
|
||||
id: `assistants-${i + 1}` as SitemapType,
|
||||
})),
|
||||
...Array.from({ length: mcpPages }, (_, i) => ({ id: `mcp-${i + 1}` as SitemapType })),
|
||||
...Array.from({ length: modelPages }, (_, i) => ({ id: `models-${i + 1}` as SitemapType })),
|
||||
];
|
||||
|
||||
@@ -60,9 +58,6 @@ export default async function sitemap({ id }: { id: string }): Promise<MetadataR
|
||||
case SitemapType.Assistants: {
|
||||
return sitemapModule.getAssistants(page);
|
||||
}
|
||||
case SitemapType.Mcp: {
|
||||
return sitemapModule.getMcp(page);
|
||||
}
|
||||
case SitemapType.Plugins: {
|
||||
return sitemapModule.getPlugins(page);
|
||||
}
|
||||
@@ -82,10 +77,6 @@ export default async function sitemap({ id }: { id: string }): Promise<MetadataR
|
||||
const pageNum = parseInt(id.split('-')[1], 10);
|
||||
return sitemapModule.getAssistants(pageNum);
|
||||
}
|
||||
if (id.startsWith('mcp-')) {
|
||||
const pageNum = parseInt(id.split('-')[1], 10);
|
||||
return sitemapModule.getMcp(pageNum);
|
||||
}
|
||||
if (id.startsWith('models-')) {
|
||||
const pageNum = parseInt(id.split('-')[1], 10);
|
||||
return sitemapModule.getModels(pageNum);
|
||||
|
||||
@@ -30,9 +30,10 @@ export interface UserInfoProps extends FlexboxProps {
|
||||
const UserInfo = memo<UserInfoProps>(({ avatarProps, onClick, ...rest }) => {
|
||||
const { styles, theme } = useStyles();
|
||||
const isSignedIn = useUserStore(authSelectors.isLogin);
|
||||
const [nickname, username] = useUserStore((s) => [
|
||||
const [nickname, username, subscriptionPlan] = useUserStore((s) => [
|
||||
userProfileSelectors.nickName(s),
|
||||
userProfileSelectors.username(s),
|
||||
s.subscriptionPlan,
|
||||
]);
|
||||
|
||||
return (
|
||||
@@ -52,7 +53,7 @@ const UserInfo = memo<UserInfoProps>(({ avatarProps, onClick, ...rest }) => {
|
||||
<div className={styles.username}>{username}</div>
|
||||
</Flexbox>
|
||||
</Flexbox>
|
||||
{isSignedIn && <PlanTag />}
|
||||
{isSignedIn && <PlanTag type={subscriptionPlan} />}
|
||||
</Flexbox>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -40,15 +40,15 @@ const GlobalLayout = async ({
|
||||
const serverConfig = await getServerGlobalConfig();
|
||||
return (
|
||||
<StyleRegistry>
|
||||
<AppTheme
|
||||
customFontFamily={appEnv.CUSTOM_FONT_FAMILY}
|
||||
customFontURL={appEnv.CUSTOM_FONT_URL}
|
||||
defaultAppearance={appearance}
|
||||
defaultNeutralColor={neutralColor as any}
|
||||
defaultPrimaryColor={primaryColor as any}
|
||||
globalCDN={appEnv.CDN_USE_GLOBAL}
|
||||
>
|
||||
<Locale antdLocale={antdLocale} defaultLang={userLocale}>
|
||||
<Locale antdLocale={antdLocale} defaultLang={userLocale}>
|
||||
<AppTheme
|
||||
customFontFamily={appEnv.CUSTOM_FONT_FAMILY}
|
||||
customFontURL={appEnv.CUSTOM_FONT_URL}
|
||||
defaultAppearance={appearance}
|
||||
defaultNeutralColor={neutralColor as any}
|
||||
defaultPrimaryColor={primaryColor as any}
|
||||
globalCDN={appEnv.CDN_USE_GLOBAL}
|
||||
>
|
||||
<ServerConfigStoreProvider
|
||||
featureFlags={serverFeatureFlags}
|
||||
isMobile={isMobile}
|
||||
@@ -63,8 +63,8 @@ const GlobalLayout = async ({
|
||||
{process.env.NODE_ENV === 'development' && <DevPanel />}
|
||||
</Suspense>
|
||||
</ServerConfigStoreProvider>
|
||||
</Locale>
|
||||
</AppTheme>
|
||||
</AppTheme>
|
||||
</Locale>
|
||||
<AntdV5MonkeyPatch />
|
||||
</StyleRegistry>
|
||||
);
|
||||
|
||||
@@ -4,15 +4,16 @@ import Authentik from './authentik';
|
||||
import AzureAD from './azure-ad';
|
||||
import Casdoor from './casdoor';
|
||||
import CloudflareZeroTrust from './cloudflare-zero-trust';
|
||||
import Cognito from './cognito';
|
||||
import GenericOIDC from './generic-oidc';
|
||||
import Github from './github';
|
||||
import Google from './google';
|
||||
import Keycloak from './keycloak';
|
||||
import Logto from './logto';
|
||||
import MicrosoftEntraID from './microsoft-entra-id';
|
||||
import Okta from './okta';
|
||||
import WeChat from './wechat';
|
||||
import Zitadel from './zitadel';
|
||||
import Cognito from "./cognito";
|
||||
|
||||
export const ssoProviders = [
|
||||
Auth0,
|
||||
@@ -29,5 +30,6 @@ export const ssoProviders = [
|
||||
WeChat,
|
||||
Keycloak,
|
||||
Google,
|
||||
Cognito
|
||||
Cognito,
|
||||
Okta,
|
||||
];
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import Okta from 'next-auth/providers/okta';
|
||||
|
||||
import { CommonProviderConfig } from './sso.config';
|
||||
|
||||
const provider = {
|
||||
id: 'okta',
|
||||
provider: Okta({
|
||||
...CommonProviderConfig,
|
||||
authorization: { params: { scope: 'openid email profile' } },
|
||||
clientId: process.env.AUTH_OKTA_ID,
|
||||
clientSecret: process.env.AUTH_OKTA_SECRET,
|
||||
issuer: process.env.AUTH_OKTA_ISSUER,
|
||||
// Remove End
|
||||
profile(profile) {
|
||||
return {
|
||||
email: profile.email,
|
||||
id: profile.sub,
|
||||
image: profile.picture,
|
||||
name: profile.name ?? profile.preferred_username,
|
||||
providerAccountId: profile.sub,
|
||||
};
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
export default provider;
|
||||
@@ -173,20 +173,6 @@ export const marketRouter = router({
|
||||
}
|
||||
}),
|
||||
|
||||
getMcpIdentifiers: marketProcedure.query(async ({ ctx }) => {
|
||||
log('getMcpIdentifiers called');
|
||||
|
||||
try {
|
||||
return await ctx.discoverService.getMcpIdentifiers();
|
||||
} catch (error) {
|
||||
log('Error fetching mcp identifiers: %O', error);
|
||||
throw new TRPCError({
|
||||
code: 'INTERNAL_SERVER_ERROR',
|
||||
message: 'Failed to fetch mcp identifiers',
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
getMcpList: marketProcedure
|
||||
.input(
|
||||
z
|
||||
|
||||
@@ -462,19 +462,6 @@ export class DiscoverService {
|
||||
return result;
|
||||
};
|
||||
|
||||
getMcpIdentifiers = async (): Promise<IdentifiersResponse> => {
|
||||
log('getMcpIdentifiers: fetching identifiers');
|
||||
const result = await this.market.plugins.getPublishedIdentifiers({
|
||||
cache: 'force-cache',
|
||||
next: {
|
||||
revalidate: CacheRevalidate.List,
|
||||
tags: [CacheTag.Discover, CacheTag.MCP],
|
||||
},
|
||||
});
|
||||
log('getMcpIdentifiers: returning %d identifiers', result.length);
|
||||
return result;
|
||||
};
|
||||
|
||||
getMcpList = async (params: McpQueryParams = {}): Promise<McpListResponse> => {
|
||||
log('getMcpList: params=%O', params);
|
||||
const { locale } = params;
|
||||
|
||||
@@ -13,7 +13,6 @@ describe('Sitemap', () => {
|
||||
// Mock the page count methods to return specific values for testing
|
||||
vi.spyOn(sitemap, 'getPluginPageCount').mockResolvedValue(2);
|
||||
vi.spyOn(sitemap, 'getAssistantPageCount').mockResolvedValue(3);
|
||||
vi.spyOn(sitemap, 'getMcpPageCount').mockResolvedValue(1);
|
||||
vi.spyOn(sitemap, 'getModelPageCount').mockResolvedValue(2);
|
||||
|
||||
const index = await sitemap.getIndex();
|
||||
@@ -31,7 +30,6 @@ describe('Sitemap', () => {
|
||||
expect(index).toContain(`<loc>${getCanonicalUrl('/sitemap/assistants-1.xml')}</loc>`);
|
||||
expect(index).toContain(`<loc>${getCanonicalUrl('/sitemap/assistants-2.xml')}</loc>`);
|
||||
expect(index).toContain(`<loc>${getCanonicalUrl('/sitemap/assistants-3.xml')}</loc>`);
|
||||
expect(index).toContain(`<loc>${getCanonicalUrl('/sitemap/mcp-1.xml')}</loc>`);
|
||||
expect(index).toContain(`<loc>${getCanonicalUrl('/sitemap/models-1.xml')}</loc>`);
|
||||
expect(index).toContain(`<loc>${getCanonicalUrl('/sitemap/models-2.xml')}</loc>`);
|
||||
|
||||
@@ -218,46 +216,6 @@ describe('Sitemap', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getMcp', () => {
|
||||
it('should return a valid mcp sitemap without pagination', async () => {
|
||||
vi.spyOn(sitemap['discoverService'], 'getMcpIdentifiers').mockResolvedValue([
|
||||
// @ts-ignore
|
||||
{ identifier: 'test-mcp', lastModified: '2023-01-01' },
|
||||
]);
|
||||
|
||||
const mcpSitemap = await sitemap.getMcp();
|
||||
expect(mcpSitemap.length).toBe(15);
|
||||
expect(mcpSitemap).toContainEqual(
|
||||
expect.objectContaining({
|
||||
url: getCanonicalUrl('/discover/mcp/test-mcp'),
|
||||
lastModified: '2023-01-01T00:00:00.000Z',
|
||||
}),
|
||||
);
|
||||
expect(mcpSitemap).toContainEqual(
|
||||
expect.objectContaining({
|
||||
url: getCanonicalUrl('/discover/mcp/test-mcp?hl=zh-CN'),
|
||||
lastModified: '2023-01-01T00:00:00.000Z',
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a valid mcp sitemap with pagination', async () => {
|
||||
const mockMcps = Array.from({ length: 80 }, (_, i) => ({
|
||||
identifier: `test-mcp-${i}`,
|
||||
lastModified: '2023-01-01',
|
||||
}));
|
||||
|
||||
vi.spyOn(sitemap['discoverService'], 'getMcpIdentifiers').mockResolvedValue(
|
||||
// @ts-ignore
|
||||
mockMcps,
|
||||
);
|
||||
|
||||
// Test first page (should have 80 items, all on first page)
|
||||
const firstPageSitemap = await sitemap.getMcp(1);
|
||||
expect(firstPageSitemap.length).toBe(80 * 15); // 80 items * 15 locales
|
||||
});
|
||||
});
|
||||
|
||||
describe('getProviders', () => {
|
||||
it('should return a valid providers sitemap', async () => {
|
||||
vi.spyOn(sitemap['discoverService'], 'getProviderIdentifiers').mockResolvedValue([
|
||||
@@ -303,16 +261,6 @@ describe('Sitemap', () => {
|
||||
expect(pageCount).toBe(3); // 250 items / 100 per page = ceil(2.5) = 3 pages
|
||||
});
|
||||
|
||||
it('should return correct mcp page count', async () => {
|
||||
vi.spyOn(sitemap['discoverService'], 'getMcpIdentifiers').mockResolvedValue(
|
||||
// @ts-ignore
|
||||
Array.from({ length: 50 }, (_, i) => ({ identifier: `mcp-${i}` })),
|
||||
);
|
||||
|
||||
const pageCount = await sitemap.getMcpPageCount();
|
||||
expect(pageCount).toBe(1); // 50 items / 100 per page = 1 page
|
||||
});
|
||||
|
||||
it('should return correct model page count', async () => {
|
||||
vi.spyOn(sitemap['discoverService'], 'getModelIdentifiers').mockResolvedValue(
|
||||
// @ts-ignore
|
||||
|
||||
+1
-38
@@ -52,12 +52,6 @@ export class Sitemap {
|
||||
return Math.ceil(list.length / ITEMS_PER_PAGE);
|
||||
}
|
||||
|
||||
// 获取MCP总页数
|
||||
async getMcpPageCount(): Promise<number> {
|
||||
const list = await this.discoverService.getMcpIdentifiers();
|
||||
return Math.ceil(list.length / ITEMS_PER_PAGE);
|
||||
}
|
||||
|
||||
// 获取模型总页数
|
||||
async getModelPageCount(): Promise<number> {
|
||||
const list = await this.discoverService.getModelIdentifiers();
|
||||
@@ -171,10 +165,9 @@ export class Sitemap {
|
||||
);
|
||||
|
||||
// 获取需要分页的类型的页数
|
||||
const [pluginPages, assistantPages, mcpPages, modelPages] = await Promise.all([
|
||||
const [pluginPages, assistantPages, modelPages] = await Promise.all([
|
||||
this.getPluginPageCount(),
|
||||
this.getAssistantPageCount(),
|
||||
this.getMcpPageCount(),
|
||||
this.getModelPageCount(),
|
||||
]);
|
||||
|
||||
@@ -193,11 +186,6 @@ export class Sitemap {
|
||||
),
|
||||
),
|
||||
),
|
||||
...Array.from({ length: mcpPages }, (_, i) =>
|
||||
this._generateSitemapLink(
|
||||
getCanonicalUrl(SITEMAP_BASE_URL, isDev ? `mcp-${i + 1}` : `mcp-${i + 1}.xml`),
|
||||
),
|
||||
),
|
||||
...Array.from({ length: modelPages }, (_, i) =>
|
||||
this._generateSitemapLink(
|
||||
getCanonicalUrl(SITEMAP_BASE_URL, isDev ? `models-${i + 1}` : `models-${i + 1}.xml`),
|
||||
@@ -239,31 +227,6 @@ export class Sitemap {
|
||||
return flatten(sitmap);
|
||||
}
|
||||
|
||||
async getMcp(page?: number): Promise<MetadataRoute.Sitemap> {
|
||||
const list = await this.discoverService.getMcpIdentifiers();
|
||||
|
||||
if (page !== undefined) {
|
||||
const startIndex = (page - 1) * ITEMS_PER_PAGE;
|
||||
const endIndex = startIndex + ITEMS_PER_PAGE;
|
||||
const pageMcps = list.slice(startIndex, endIndex);
|
||||
|
||||
const sitmap = pageMcps.map((item) =>
|
||||
this._genSitemap(urlJoin('/discover/mcp', item.identifier), {
|
||||
lastModified: item?.lastModified || LAST_MODIFIED,
|
||||
}),
|
||||
);
|
||||
return flatten(sitmap);
|
||||
}
|
||||
|
||||
// 如果没有指定页数,返回所有(向后兼容)
|
||||
const sitmap = list.map((item) =>
|
||||
this._genSitemap(urlJoin('/discover/mcp', item.identifier), {
|
||||
lastModified: item?.lastModified || LAST_MODIFIED,
|
||||
}),
|
||||
);
|
||||
return flatten(sitmap);
|
||||
}
|
||||
|
||||
async getPlugins(page?: number): Promise<MetadataRoute.Sitemap> {
|
||||
const list = await this.discoverService.getPluginIdentifiers();
|
||||
|
||||
|
||||
@@ -83,10 +83,6 @@ class DiscoverService {
|
||||
});
|
||||
};
|
||||
|
||||
getMcpIdentifiers = async (): Promise<IdentifiersResponse> => {
|
||||
return lambdaClient.market.getMcpIdentifiers.query();
|
||||
};
|
||||
|
||||
getMcpList = async (params: McpQueryParams = {}): Promise<McpListResponse> => {
|
||||
const locale = globalHelpers.getCurrentLanguage();
|
||||
return lambdaClient.market.getMcpList.query({
|
||||
|
||||
@@ -201,6 +201,11 @@ const isSendButtonDisabledByMessage = (s: ChatStoreState) =>
|
||||
// 4. when the message is in RAG flow
|
||||
isInRAGFlow(s);
|
||||
|
||||
const inboxActiveTopicMessages = (state: ChatStoreState) => {
|
||||
const activeTopicId = state.activeTopicId;
|
||||
return state.messagesMap[messageMapKey(INBOX_SESSION_ID, activeTopicId)] || [];
|
||||
};
|
||||
|
||||
export const chatSelectors = {
|
||||
activeBaseChats,
|
||||
activeBaseChatsWithoutTool,
|
||||
@@ -213,6 +218,7 @@ export const chatSelectors = {
|
||||
getMessageById,
|
||||
getMessageByToolCallId,
|
||||
getTraceIdByMessageId,
|
||||
inboxActiveTopicMessages,
|
||||
isAIGenerating,
|
||||
isCreatingMessage,
|
||||
isCurrentChatLoaded,
|
||||
|
||||
@@ -8,7 +8,6 @@ import { DiscoverStore } from '@/store/discover';
|
||||
import { globalHelpers } from '@/store/global/helpers';
|
||||
import {
|
||||
DiscoverMcpDetail,
|
||||
IdentifiersResponse,
|
||||
McpListResponse,
|
||||
McpQueryParams,
|
||||
} from '@/types/discover';
|
||||
@@ -20,7 +19,6 @@ export interface MCPAction {
|
||||
}) => SWRResponse<DiscoverMcpDetail>;
|
||||
useFetchMcpList: (params: McpQueryParams) => SWRResponse<McpListResponse>;
|
||||
useMcpCategories: (params: CategoryListQuery) => SWRResponse<CategoryItem[]>;
|
||||
useMcpIdentifiers: () => SWRResponse<IdentifiersResponse>;
|
||||
}
|
||||
|
||||
export const createMCPSlice: StateCreator<
|
||||
@@ -61,10 +59,4 @@ export const createMCPSlice: StateCreator<
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
useMcpIdentifiers: () => {
|
||||
return useClientDataSWR('mcp-identifiers', async () => discoverService.getMcpIdentifiers(), {
|
||||
revalidateOnFocus: false,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -113,6 +113,7 @@ export const createCommonSlice: StateCreator<
|
||||
preference,
|
||||
serverLanguageModel: serverConfig.languageModel,
|
||||
settings: data.settings || {},
|
||||
subscriptionPlan: data.subscriptionPlan,
|
||||
user,
|
||||
},
|
||||
false,
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Plans } from '@/types/subscription';
|
||||
|
||||
export interface CommonState {
|
||||
isOnboard: boolean;
|
||||
isShowPWAGuide: boolean;
|
||||
isUserCanEnableTrace: boolean;
|
||||
isUserHasConversation: boolean;
|
||||
isUserStateInit: boolean;
|
||||
subscriptionPlan?: Plans;
|
||||
}
|
||||
|
||||
export const initialCommonState: CommonState = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Plans } from '@/types/subscription';
|
||||
import { TopicDisplayMode } from '@/types/topic';
|
||||
import { UserSettings } from '@/types/user/settings';
|
||||
|
||||
@@ -56,6 +57,7 @@ export interface UserInitializationState {
|
||||
lastName?: string;
|
||||
preference: UserPreference;
|
||||
settings: PartialDeep<UserSettings>;
|
||||
subscriptionPlan?: Plans;
|
||||
userId?: string;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user