diff --git a/frontend/packages/core/src/pages/aiSetting/AIUnconfigure.tsx b/frontend/packages/core/src/pages/aiSetting/AIUnconfigure.tsx index 8634e890..2f94679f 100644 --- a/frontend/packages/core/src/pages/aiSetting/AIUnconfigure.tsx +++ b/frontend/packages/core/src/pages/aiSetting/AIUnconfigure.tsx @@ -3,12 +3,18 @@ import WithPermission from '@common/components/aoplatform/WithPermission' import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from '@common/const/const' import { useFetch } from '@common/hooks/http' import { $t } from '@common/locales' -import { App, Button, Card, Divider, Empty, Spin, Tag } from 'antd' +import { App, Button, Card, Empty, Spin, Tag } from 'antd' import { FC, memo, useEffect, useState } from 'react' import { AiSettingListItem } from './AiSettingList' const CardBox = memo( - ({ provider, openModal }: { provider: AiSettingListItem; openModal: (provider: AiSettingListItem) => void }) => { + ({ + provider, + openModal + }: { + provider: AiSettingListItem + openModal: (provider: AiSettingListItem) => Promise + }) => { return ( { +const ModelCardArea = ({ + modelList, + className, + openModal +}: { + modelList: AiSettingListItem[] + className?: string + openModal?: (provider: AiSettingListItem) => Promise +}) => { return ( <> {modelList.length > 0 ? ( @@ -69,7 +83,7 @@ const ModelCardArea = ({ modelList, className }: { modelList: AiSettingListItem[ }} > {modelList.map((provider: AiSettingListItem) => ( - + ))} ) : ( @@ -78,7 +92,11 @@ const ModelCardArea = ({ modelList, className }: { modelList: AiSettingListItem[ ) } -const AIUnconfigure: FC = () => { +interface AIUnconfigureProps { + openModal: (entity: AiSettingListItem) => Promise +} + +const AIUnconfigure: FC = ({ openModal }) => { const { message } = App.useApp() const { fetchData } = useFetch() const [aiSettingList, setAiSettingList] = useState([]) @@ -123,8 +141,6 @@ const AIUnconfigure: FC = () => {
{aiSettingList.filter((item) => !item.configured).length > 0 && ( <> - -

{$t('未配置')}

!item.configured) || []} /> )} diff --git a/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx b/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx index 9505364f..fb66cb74 100644 --- a/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx +++ b/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx @@ -5,44 +5,13 @@ import { useFetch } from '@common/hooks/http' import { $t } from '@common/locales' import { checkAccess } from '@common/utils/permission' import { Icon } from '@iconify/react/dist/iconify.js' -import { App } from 'antd' +import { App, Tabs } from 'antd' import { useRef } from 'react' import AIFlowChart from './AIFlowChart' import AiSettingModalContent, { AiSettingModalContentHandle } from './AiSettingModal' import AIUnconfigure from './AIUnconfigure' +import { AiProviderConfig, AiSettingListItem } from './types' -export type AiSettingListItem = { - name: string - id: string - logo: string - defaultLlm: string - defaultLlmLogo: string - enable: boolean - configured: boolean -} - -export type AiProviderLlmsItems = { - id: string - logo: string - scopes: ('chat' | 'completions')[] - config: string -} - -export type AiProviderDefaultConfig = { - id: string - provider: string - name: string - logo: string - defaultLlm: string - scopes: string[] -} - -export type AiProviderConfig = { - id: string - name: string - config: string - getApikeyUrl: string -} const AiSettingList = () => { const { modal, message } = App.useApp() const { fetchData } = useFetch() @@ -111,8 +80,23 @@ const AiSettingList = () => { showBorder={false} scrollPage={false} > - - +
+ + }, + { + key: 'config', + label: $t('未设置'), + children:
{}
+ } + ]} + /> +
) diff --git a/frontend/packages/core/src/pages/aiSetting/styles.css b/frontend/packages/core/src/pages/aiSetting/styles.css index e12ed580..13d5b62b 100644 --- a/frontend/packages/core/src/pages/aiSetting/styles.css +++ b/frontend/packages/core/src/pages/aiSetting/styles.css @@ -1,4 +1,20 @@ /* Flow Chart Styles */ +.react-flow { + width: 100%; + height: 100%; + min-height: 500px; +} + +.react-flow__container { + width: 100%; + height: 100%; +} + +.react-flow__renderer { + width: 100%; + height: 100%; +} + .react-flow__node { padding: 0; border-radius: 8px; diff --git a/frontend/packages/core/src/pages/aiSetting/types.ts b/frontend/packages/core/src/pages/aiSetting/types.ts index 4935473e..43d46536 100644 --- a/frontend/packages/core/src/pages/aiSetting/types.ts +++ b/frontend/packages/core/src/pages/aiSetting/types.ts @@ -18,3 +18,36 @@ export interface ModelData { keys: KeyData[] priority?: number } + +export type AiSettingListItem = { + name: string + id: string + logo: string + defaultLlm: string + defaultLlmLogo: string + enable: boolean + configured: boolean +} + +export type AiProviderLlmsItems = { + id: string + logo: string + scopes: ('chat' | 'completions')[] + config: string +} + +export type AiProviderDefaultConfig = { + id: string + provider: string + name: string + logo: string + defaultLlm: string + scopes: string[] +} + +export type AiProviderConfig = { + id: string + name: string + config: string + getApikeyUrl: string +}