diff --git a/frontend/packages/core/src/pages/aiSetting/AIUnconfigure.tsx b/frontend/packages/core/src/pages/aiSetting/AIUnconfigure.tsx
new file mode 100644
index 00000000..8634e890
--- /dev/null
+++ b/frontend/packages/core/src/pages/aiSetting/AIUnconfigure.tsx
@@ -0,0 +1,139 @@
+import Icon, { LoadingOutlined } from '@ant-design/icons'
+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 { FC, memo, useEffect, useState } from 'react'
+import { AiSettingListItem } from './AiSettingList'
+
+const CardBox = memo(
+ ({ provider, openModal }: { provider: AiSettingListItem; openModal: (provider: AiSettingListItem) => void }) => {
+ return (
+
+
+
+ {provider.name}
+
+
+ {provider.configured ? $t('已配置') : $t('未配置')}
+
+
+ }
+ className="shadow-[0_5px_10px_0_rgba(0,0,0,0.05)] rounded-[10px] overflow-visible h-[156px] m-0 flex flex-col "
+ classNames={{ header: 'border-b-[0px] p-[20px] px-[24px]', body: 'pt-0 flex-1' }}
+ >
+
+
+ {provider.configured && (
+ <>
+
+ {provider.defaultLlm}
+ >
+ )}
+
+
+ }
+ onClick={() => openModal(provider)}
+ classNames={{ icon: 'h-[18px]' }}
+ >
+ {$t('设置')}
+
+
+
+
+ )
+ }
+)
+const ModelCardArea = ({ modelList, className }: { modelList: AiSettingListItem[]; className?: string }) => {
+ return (
+ <>
+ {modelList.length > 0 ? (
+
+ {modelList.map((provider: AiSettingListItem) => (
+
+ ))}
+
+ ) : (
+
+ )}
+ >
+ )
+}
+const AIUnconfigure: FC = () => {
+ const { message } = App.useApp()
+ const { fetchData } = useFetch()
+ const [aiSettingList, setAiSettingList] = useState([])
+ const [loading, setLoading] = useState(false)
+
+ const getAiSettingList = () => {
+ setLoading(true)
+ return fetchData[] }>>(
+ `ai/providers/unconfigured`,
+ { method: 'GET', eoTransformKeys: ['default_llm', 'default_llm_logo'] }
+ )
+ .then((response) => {
+ const { code, data, msg } = response
+ if (code === STATUS_CODE.SUCCESS) {
+ setAiSettingList(
+ data.providers?.map((x: AiSettingListItem) => ({
+ ...x,
+ name: $t(x.name),
+ llmListStatus: 'unload',
+ availableLlms: []
+ }))
+ )
+ } else {
+ message.error(msg || $t(RESPONSE_TIPS.error))
+ }
+ })
+ .finally(() => setLoading(false))
+ }
+
+ useEffect(() => {
+ getAiSettingList()
+ }, [])
+
+ return (
+ }
+ spinning={loading}
+ >
+ {aiSettingList && aiSettingList.length > 0 ? (
+
+ {aiSettingList.filter((item) => !item.configured).length > 0 && (
+ <>
+
+
{$t('未配置')}
+
!item.configured) || []} />
+ >
+ )}
+
+ ) : (
+
+ )}
+
+ )
+}
+
+export default AIUnconfigure
diff --git a/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx b/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx
index 5d2af89a..9505364f 100644
--- a/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx
+++ b/frontend/packages/core/src/pages/aiSetting/AiSettingList.tsx
@@ -1,16 +1,15 @@
-import { LoadingOutlined } from '@ant-design/icons'
import InsidePage from '@common/components/aoplatform/InsidePage'
-import WithPermission from '@common/components/aoplatform/WithPermission'
import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from '@common/const/const'
import { useGlobalContext } from '@common/contexts/GlobalStateContext'
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, Button, Card, Divider, Empty, Spin, Tag } from 'antd'
-import { memo, useEffect, useRef, useState } from 'react'
+import { App } from 'antd'
+import { useRef } from 'react'
import AIFlowChart from './AIFlowChart'
import AiSettingModalContent, { AiSettingModalContentHandle } from './AiSettingModal'
+import AIUnconfigure from './AIUnconfigure'
export type AiSettingListItem = {
name: string
@@ -47,36 +46,9 @@ export type AiProviderConfig = {
const AiSettingList = () => {
const { modal, message } = App.useApp()
const { fetchData } = useFetch()
- const [aiSettingList, setAiSettingList] = useState([])
- const [loading, setLoading] = useState(false)
const modalRef = useRef()
const { setAiConfigFlushed, accessData } = useGlobalContext()
- const getAiSettingList = () => {
- setLoading(true)
- return fetchData[] }>>(
- `ai/providers/unconfigured`,
- { method: 'GET', eoTransformKeys: ['default_llm', 'default_llm_logo'] }
- // eoApiPrefix: 'http://uat.apikit.com:11204/mockApi/aoplatform/api/v1/'
- )
- .then((response) => {
- const { code, data, msg } = response
- if (code === STATUS_CODE.SUCCESS) {
- setAiSettingList(
- data.providers?.map((x: AiSettingListItem) => ({
- ...x,
- name: $t(x.name),
- llmListStatus: 'unload',
- availableLlms: []
- }))
- )
- } else {
- message.error(msg || $t(RESPONSE_TIPS.error))
- }
- })
- .finally(() => setLoading(false))
- }
-
const openModal = async (entity: AiSettingListItem) => {
message.loading($t(RESPONSE_TIPS.loading))
const { code, data, msg } = await fetchData>('ai/provider/config', {
@@ -101,7 +73,6 @@ const AiSettingList = () => {
onOk: () => {
return modalRef.current?.save().then((res) => {
if (res === true) setAiConfigFlushed(true)
- getAiSettingList()
})
},
width: 600,
@@ -131,81 +102,6 @@ const AiSettingList = () => {
})
}
- useEffect(() => {
- getAiSettingList()
- }, [])
-
- const CardBox = memo(({ provider }: { provider: AiSettingListItem }) => {
- return (
-
-
-
- {provider.name}
-
-
- {provider.configured ? $t('已配置') : $t('未配置')}
-
-
- }
- className="shadow-[0_5px_10px_0_rgba(0,0,0,0.05)] rounded-[10px] overflow-visible h-[156px] m-0 flex flex-col "
- classNames={{ header: 'border-b-[0px] p-[20px] px-[24px]', body: 'pt-0 flex-1' }}
- >
-
-
- {provider.configured && (
- <>
-
- {provider.defaultLlm}
- >
- )}
-
-
- }
- onClick={() => openModal(provider)}
- classNames={{ icon: 'h-[18px]' }}
- >
- {$t('设置')}
-
-
-
-
- )
- })
-
- const ModelCardArea = ({ modelList, className }: { modelList: AiSettingListItem[]; className?: string }) => {
- return (
- <>
- {modelList.length > 0 ? (
-
- {modelList.map((provider: AiSettingListItem) => (
-
- ))}
-
- ) : (
-
- )}
- >
- )
- }
-
return (
<>
{
scrollPage={false}
>
- }
- spinning={loading}
- >
- {aiSettingList && aiSettingList.length > 0 ? (
-
- {aiSettingList.filter((item) => !item.configured).length > 0 && (
- <>
-
-
{$t('未配置')}
-
!item.configured) || []} />
- >
- )}
-
- ) : (
-
- )}
-
+
>
)