Merge pull request #343 from APIParkLab/feature/1.9-OAuth

Feature/1.9 o auth
This commit is contained in:
ningyv
2025-07-17 11:52:14 +08:00
committed by GitHub
8 changed files with 41 additions and 16 deletions
@@ -576,6 +576,8 @@
"AI 代理集成": "Ke6908f16",
"请先订阅该服务": "K71ed51fa",
"申请": "K4aa9ed2c",
"未配置 API Key": "Kf7b54a1",
"配置": "K2a1422d2",
"选择 API Key": "K1bec8cbe",
"新增 API Key": "Kb0e0aeda",
"API 密钥可用于调用系统级 Open API 和 MCP。": "K9d81999c",
@@ -984,5 +984,7 @@
"K50693bd8": "Enable Authorization",
"K682b11cb": "Feishu Authorization Login",
"K45c99f97": "The APP ID parameter can be found on the App Credentials and Basic Information page in the Feishu Developer Console",
"K56e77c4": "The APP Secret parameter can be found on the App Credentials and Basic Information page in the Feishu Developer Console"
"K56e77c4": "The APP Secret parameter can be found on the App Credentials and Basic Information page in the Feishu Developer Console",
"Kf7b54a1": "API Key not configured",
"K2a1422d2": "Configure"
}
@@ -1006,5 +1006,7 @@
"K50693bd8": "認可を有効化",
"K682b11cb": "Feishu 認証ログイン",
"K45c99f97": "APP ID パラメータは Feishu 開発者コンソールのアプリ認証情報と基本情報ページにあります",
"K56e77c4": "APP Secret パラメータは Feishu 開発者コンソールのアプリ認証情報と基本情報ページにあります"
"K56e77c4": "APP Secret パラメータは Feishu 開発者コンソールのアプリ認証情報と基本情報ページにあります",
"Kf7b54a1": "API Key が設定されていません",
"K2a1422d2": "設定"
}
@@ -935,5 +935,7 @@
"K50693bd8": "启用授权",
"K682b11cb": "飞书授权登录",
"K45c99f97": "APP ID 参数位于飞书开发人员控制台中的应用程序凭证和基础信息页面上",
"K56e77c4": "APP Secret 参数位于飞书开发人员控制台中的应用程序凭证和基础信息页面上"
"K56e77c4": "APP Secret 参数位于飞书开发人员控制台中的应用程序凭证和基础信息页面上",
"Kf7b54a1": "未配置 API Key",
"K2a1422d2": "配置"
}
@@ -1006,5 +1006,7 @@
"K50693bd8": "啟用授權",
"K682b11cb": "飛書授權登入",
"K45c99f97": "APP ID 參數位於飛書開發人員控制台中的應用程式憑證與基礎資訊頁面",
"K56e77c4": "APP Secret 參數位於飛書開發人員控制台中的應用程式憑證與基礎資訊頁面"
"K56e77c4": "APP Secret 參數位於飛書開發人員控制台中的應用程式憑證與基礎資訊頁面",
"Kf7b54a1": "未配置 API Key",
"K2a1422d2": "配置"
}
@@ -34,7 +34,7 @@ const Auth = () => {
}, [state.language])
const onFinish = () => {
form.validateFields().then((value) => {
return fetchData<BasicResponse<null>>(`/account/third/${value.authType}`, {
return fetchData<BasicResponse<null>>(`account/third/${value.authType}`, {
method: 'POST',
eoBody: {
enable: value.enabled,
@@ -71,7 +71,7 @@ const Auth = () => {
value: string
}[]
}>
>('/account/third', {
>('account/third', {
method: 'GET',
}).then((response) => {
const { code, data, msg } = response
@@ -87,7 +87,7 @@ const Auth = () => {
*
*/
const getThirdPartyAuthSetting = () => {
fetchData<BasicResponse<{ info: AuthSetting }>>(`/account/third/${form.getFieldValue('authType')}`, {
fetchData<BasicResponse<{ info: AuthSetting }>>(`account/third/${form.getFieldValue('authType')}`, {
method: 'GET',
eoTransformKeys: ['client_id', 'client_secret']
}).then((response) => {
@@ -226,6 +226,10 @@ export const IntegrationAIContainer = forwardRef<IntegrationAIContainerRef, Inte
navigator('/mcpKey')
}
const dropAuthPage = () => {
navigator(`/consumer/${consumerParams?.teamId}/inside/${consumerParams?.consumerId}/authorization`)
}
/**
* API Key
*/
@@ -492,7 +496,7 @@ export const IntegrationAIContainer = forwardRef<IntegrationAIContainerRef, Inte
</div>
</div>
)}
{type === 'service' && !apiKeyList.length ? (
{(type === 'service' || type === 'consumer') && !apiKeyList.length ? (
<>
<Card
style={{ borderRadius: '10px' }}
@@ -501,12 +505,23 @@ export const IntegrationAIContainer = forwardRef<IntegrationAIContainerRef, Inte
body: 'p-[10px]'
}}
>
<div className="flex flex-col items-center justify-center py-3">
<span className="text-[14px] mb-5">{$t('请先订阅该服务')}</span>
<Button type="primary" onClick={() => openModal?.('apply')}>
{$t('请')}
</Button>
</div>
{
type === 'service' ? (
<div className="flex flex-col items-center justify-center py-3">
<span className="text-[14px] mb-5">{$t('请先订阅该服务')}</span>
<Button type="primary" onClick={() => openModal?.('apply')}>
{$t('申请')}
</Button>
</div>
) : (
<div className="flex flex-col items-center justify-center py-3">
<span className="text-[14px] mb-5">{$t('未配置 API Key')}</span>
<Button type="primary" onClick={() => dropAuthPage()}>
{$t('配置')}
</Button>
</div>
)
}
</Card>
</>
) : (
@@ -31,9 +31,9 @@ export default function ManagementInsidePage() {
const TENANT_MANAGEMENT_APP_MENU: MenuProps['items'] = useMemo(
() => [
getItem($t('订阅的服务'), 'service', undefined, undefined, undefined, 'team.application.subscription.view'),
getItem($t('MCP 服务'), 'mcp', undefined, undefined, undefined, 'team.consumer.mcp.view'),
getItem($t('访问授权'), 'authorization', undefined, undefined, undefined, 'team.consumer.authorization.view'),
getItem($t('MCP 服务'), 'mcp', undefined, undefined, undefined, 'team.consumer.mcp.view'),
getItem($t('订阅的服务'), 'service', undefined, undefined, undefined, 'team.application.subscription.view'),
getItem($t('消费者管理'), 'setting', undefined, undefined, undefined, 'team.application.application.view')
],
[state.language]