diff --git a/frontend/packages/core/src/pages/aiSetting/types.ts b/frontend/packages/core/src/pages/aiSetting/types.ts
index 6ba2ea7a..920de61d 100644
--- a/frontend/packages/core/src/pages/aiSetting/types.ts
+++ b/frontend/packages/core/src/pages/aiSetting/types.ts
@@ -1,32 +1,42 @@
-export type ModelStatus = 'enabled' | 'abnormal'|'disabled'
-export type KeyStatus ='normal' | 'abnormal'|'disabled'
+export type ModelStatus = 'enabled' | 'abnormal' | 'disabled'
+export type KeyStatus = 'normal' | 'abnormal' | 'disabled'
+export type ModelDeployStatus = 'normal' | 'disabled' | 'deploying' | 'error' | 'deploying_error' | undefined
export interface KeyData {
id: string
name: string
- status: KeyStatus,
+ status: KeyStatus
}
export interface ModelListData {
- id: string
+ id: string | undefined
name: string
logo: string
- defaultLlm: string
+ defaultLlm: string | undefined
+ provider?: string
+ modelMode?: string
status: ModelStatus
- api_count: number
- key_count: number
+ state?: ModelDeployStatus
+ apiCount: number
+ keyCount: number
+ isDisabled?: boolean
keys: KeyData[]
+ canDelete: boolean
}
-export interface ModelDetailData extends ModelListData{
- enable:boolean
- config: string,
- priority?: number
+
+export interface AISettingEntityItem {
+ id: string | undefined
+ status?: ModelStatus | undefined
+ defaultLlm: string | undefined
+}
+export interface ModelDetailData extends ModelListData {
+ enable: boolean
+ config: string
getApikeyUrl: string
status: ModelStatus
configured: boolean
}
-
export type AiSettingListItem = {
name: string
id: string
@@ -53,5 +63,3 @@ export type AiProviderDefaultConfig = {
defaultLlm: string
scopes: string[]
}
-
-
diff --git a/frontend/packages/core/src/pages/guide/AIModelGuide.tsx b/frontend/packages/core/src/pages/guide/AIModelGuide.tsx
new file mode 100644
index 00000000..75c6e679
--- /dev/null
+++ b/frontend/packages/core/src/pages/guide/AIModelGuide.tsx
@@ -0,0 +1,186 @@
+import restAPIPic from '@common/assets/restAPI.svg'
+import onlineAIPic from '@common/assets/onlineAI.svg'
+import localAIPic from '@common/assets/localAI.svg'
+import { useGlobalContext } from '@common/contexts/GlobalStateContext'
+import { $t } from '@common/locales'
+import { Icon } from '@iconify/react/dist/iconify.js'
+import { App } from 'antd'
+import { Card } from 'antd'
+import { useRef } from 'react'
+import { useNavigate } from 'react-router-dom'
+import AiSettingModalContent, { AiSettingModalContentHandle } from '../aiSetting/AiSettingModal'
+import { checkAccess } from '@common/utils/permission'
+import LocalAiDeploy, { LocalAiDeployHandle } from './LocalAiDeploy'
+import useDeployLocalModel from './deployModelUtil'
+import RestAIDeploy, { RestAIDeployHandle } from './RestAIDeploy'
+
+export const AIModelGuide = () => {
+ const { modal } = App.useApp()
+ const entityData = useRef
(null)
+ const navigateTo = useNavigate()
+ const { accessData } = useGlobalContext()
+ const modalRef = useRef()
+ const localAiDeployRef = useRef()
+ const restAiDeployRef = useRef()
+ const { deployLocalModel } = useDeployLocalModel()
+
+ const dumpServerPage = () => {
+ navigateTo('/service/list')
+ }
+
+ /**
+ * rest 服务卡片点击事件
+ */
+ const restCardClick = async () => {
+ modal.confirm({
+ title: $t('添加 Rest 服务'),
+ content: ,
+ onOk: () => {
+ return restAiDeployRef.current?.deployRestAIServer().then((res) => {
+ if (res === true) {
+ dumpServerPage()
+ }
+ })
+ },
+ width: 600,
+ okText: $t('确认'),
+ cancelText: $t('取消'),
+ closable: true,
+ icon: <>>
+ })
+ }
+
+ /**
+ * AI 模型配置弹窗
+ */
+ const aiCardClick = () => {
+ // 更新弹窗
+ const updateEntityData = (data: any) => {
+ entityData.current = data
+ // 更新弹窗
+ modalInstance.update({})
+ }
+ const modalInstance = modal.confirm({
+ title: $t('模型配置'),
+ content: (
+
+ ),
+ onOk: () => {
+ return modalRef.current?.deployAIServer().then((res) => {
+ if (res === true) {
+ dumpServerPage()
+ }
+ })
+ },
+ width: 600,
+ okText: $t('确认'),
+ footer: (_, { OkBtn, CancelBtn }) => {
+ return (
+
+ )
+ },
+ cancelText: $t('取消'),
+ closable: true,
+ icon: <>>
+ })
+ }
+
+ /**
+ * 本地部署 AI 并生成 API
+ */
+ const localModelCardClick = async () => {
+ const modalInstance = modal.confirm({
+ title: $t('部署本地模型'),
+ content: {
+ modalInstance.destroy()
+ dumpServerPage()
+ }}>,
+ onOk: () => {
+ return localAiDeployRef.current?.deployLocalAIServer().then((res) => {
+ if (res === true) {
+ dumpServerPage()
+ }
+ })
+ },
+ width: 600,
+ okText: $t('确认'),
+ cancelText: $t('取消'),
+ closable: true,
+ icon: <>>
+ })
+ }
+ const deployDeepSeek = async (e: any) => {
+ e.stopPropagation()
+ await deployLocalModel({
+ modelID: 'deepseek-r1'
+ })
+ dumpServerPage()
+ }
+
+ const cardList = [
+ {
+ imgSrc: restAPIPic,
+ title: $t('添加 Rest 服务'),
+ description: $t('支持批量添加现有 API 文档以实现统一的外部访问。'),
+ click: restCardClick
+ },
+ {
+ imgSrc: onlineAIPic,
+ title: $t('添加在线 AI API'),
+ description: $t('快速调用 AI 模型的云服务 API,方便管理提示词和统一计费。'),
+ click: aiCardClick
+ },
+ {
+ imgSrc: localAIPic,
+ title: $t('本地部署 AI 并生成 API'),
+ description: $t('快速在本地部署开源模型并自动生成 API。'),
+ click: localModelCardClick,
+ bottomRender: (
+
+
+ {$t('部署')} Deepseek-R1
+
+ )
+ }
+ ]
+ return (
+
+ {cardList.map((item, itemIndex) => (
+
+
+ {item.title}
+ {item.description}
+ {item.bottomRender ? item.bottomRender : null}
+
+ ))}
+
+ )
+}
diff --git a/frontend/packages/core/src/pages/guide/Guide.tsx b/frontend/packages/core/src/pages/guide/Guide.tsx
index 9e79f2e8..deeff7fe 100644
--- a/frontend/packages/core/src/pages/guide/Guide.tsx
+++ b/frontend/packages/core/src/pages/guide/Guide.tsx
@@ -1,232 +1,323 @@
-import InsidePage from "@common/components/aoplatform/InsidePage"
-import { useGlobalContext } from "@common/contexts/GlobalStateContext"
-import { $t } from "@common/locales"
-import { Icon } from "@iconify/react/dist/iconify.js"
-import { Button, Card, Collapse } from "antd"
-import { Dispatch, SetStateAction, useEffect, useState } from "react"
-import { useLocation, useNavigate } from "react-router-dom"
+import InsidePage from '@common/components/aoplatform/InsidePage'
+import { useGlobalContext } from '@common/contexts/GlobalStateContext'
+import { $t } from '@common/locales'
+import { Icon } from '@iconify/react/dist/iconify.js'
+import { Button, Card, Collapse } from 'antd'
+import { Dispatch, SetStateAction, useEffect, useState } from 'react'
+import { useLocation, useNavigate } from 'react-router-dom'
+import { AIModelGuide } from './AIModelGuide'
-export default function Guide(){
- const [showGuide, setShowGuide] = useState(localStorage.getItem('showGuide') !== 'false' )
- const [showAdvancedGuide, setShowAdvancedGuide] = useState(localStorage.getItem('showAdvancedGuide') !== 'false' )
- const [, forceUpdate] = useState(null);
- const {state} = useGlobalContext()
- const location = useLocation()
- const currentUrl = location.pathname
- const navigator = useNavigate()
- const guideSections = [
+export default function Guide() {
+ const [showGuide, setShowGuide] = useState(localStorage.getItem('showGuide') !== 'false')
+ const [showAdvancedGuide, setShowAdvancedGuide] = useState(localStorage.getItem('showAdvancedGuide') !== 'false')
+ const [, forceUpdate] = useState(null)
+ const { state } = useGlobalContext()
+ const location = useLocation()
+ const currentUrl = location.pathname
+ const navigator = useNavigate()
+ const guideSections = [
+ {
+ title: $t('快速接入 AI'),
+ items: [
{
- title: $t('快速接入 AI'),
- items: [
- {
- title: $t("配置你的 AI 模型"),
- description: $t('通过 APIPark 快速接入各种 AI 模型,使用统一的格式来调用API,并且可以随意切换模型。'),
- link: 'https://docs.apipark.com/docs/system_setting/ai_model_providers'
- },
- {
- title: $t("创建 AI 服务和 API"),
- description: $t('创建 AI 类型的服务,并且你可以将 Prompt 提示词设置为一个 API,简化使用 AI 的流程。'),
- link: 'https://docs.apipark.com/docs/services/ai_services'
- },
- {
- title: $t("创建调用 Token"),
- description: $t('为了安全地调用 API,你需要创建一个消费者以及Token。'),
- link: 'https://docs.apipark.com/docs/consumers'
- },
- {
- title: $t("调用"),
- description: $t('现在你可以通过 Token 来调用这些 API。'),
- link: 'https://docs.apipark.com/docs/call_api'
- }
- ]
+ title: $t('配置你的 AI 模型'),
+ description: $t('通过 APIPark 快速接入各种 AI 模型,使用统一的格式来调用API,并且可以随意切换模型。'),
+ link: 'https://docs.apipark.com/docs/system_setting/ai_model_providers'
},
{
- title: $t('快速接入 REST API'),
- items: [
- {
- title: $t("创建 REST 服务和 API"),
- description: $t('创建 AI 类型的服务,并且你可以将 Prompt 提示词设置为一个 API,简化使用 AI 的流程。'),
- link: 'https://docs.apipark.com/docs/services/rest_services'
- },
- {
- title: $t("创建调用 Token"),
- description: $t('为了安全地调用 API,你需要创建一个消费者以及Token。'),
- link: 'https://docs.apipark.com/docs/consumers'
- },
- {
- title: $t("调用"),
- description: $t('现在你可以通过 Token 来调用这些 API。'),
- link: 'https://docs.apipark.com/docs/call_api'
- }
- ]
+ title: $t('创建 AI 服务和 API'),
+ description: $t('创建 AI 类型的服务,并且你可以将 Prompt 提示词设置为一个 API,简化使用 AI 的流程。'),
+ link: 'https://docs.apipark.com/docs/services/ai_services'
},
{
- title: $t('仪表盘'),
- items: [
- {
- title: $t("统计 API 调用情况"),
- description: $t('仪表盘中提供了多种统计图表,帮助我们了解 API 的运行情况。'),
- link: 'https://docs.apipark.com/docs/analysis'
- }
- ]
+ title: $t('创建调用 Token'),
+ description: $t('为了安全地调用 API,你需要创建一个消费者以及Token。'),
+ link: 'https://docs.apipark.com/docs/consumers'
+ },
+ {
+ title: $t('调用'),
+ description: $t('现在你可以通过 Token 来调用这些 API。'),
+ link: 'https://docs.apipark.com/docs/call_api'
}
- ];
- const advanceGuideSections = [
+ ]
+ },
+ {
+ title: $t('快速接入 REST API'),
+ items: [
{
- title: $t('核心功能'),
- items: [
- {
- title: $t("账号与角色"),
- description: $t('邀请你的团队成员加入 APIPark,共同管理和调用 API。'),
- link: 'https://docs.apipark.com/docs/system_setting/account_role'
- },
- {
- title: $t("团队"),
- description: $t('团队中包含了人员、消费者和服务,不同团队之间的消费者和服务数据是隔离的,可用于管理企业内部不同的部门/项目组/团队。'),
- link: 'https://docs.apipark.com/docs/teams'
- },
- {
- title: $t("服务"),
- description: $t('服务内包含一组 API,并且可以发布到 API 市场被其他团队使用。'),
- link: 'https://docs.apipark.com/docs/category/-%E6%9C%8D%E5%8A%A1'
- }
- ]
+ title: $t('创建 REST 服务和 API'),
+ description: $t('创建 AI 类型的服务,并且你可以将 Prompt 提示词设置为一个 API,简化使用 AI 的流程。'),
+ link: 'https://docs.apipark.com/docs/services/rest_services'
},
{
- title: $t('权限管理'),
- items: [
- {
- title: $t("订阅服务"),
- description: $t('如果需要调用某个服务的 API,需要先订阅该服务,并且等待提供服务的团队审核后才可发起 API 请求。'),
- link: 'https://docs.apipark.com/docs/developer_portal'
- },
- {
- title: $t("审核订阅申请"),
- description: $t('提供服务的团队可以审核来自其他团队的订阅申请,审核通过后的消费者才可发起 API 请求。'),
- link: 'https://docs.apipark.com/docs/services/review_consumers'
- }
- ]
+ title: $t('创建调用 Token'),
+ description: $t('为了安全地调用 API,你需要创建一个消费者以及Token。'),
+ link: 'https://docs.apipark.com/docs/consumers'
},
{
- title: $t('集成'),
- items: [
- {
- title: $t("日志"),
- description: $t('APIPark 提供详尽的 API 调用日志,帮助企业监控、分析和审计 API 的运行状况。'),
- link: 'https://docs.apipark.com/docs/system_setting/log/'
- }
- ]
+ title: $t('调用'),
+ description: $t('现在你可以通过 Token 来调用这些 API。'),
+ link: 'https://docs.apipark.com/docs/call_api'
}
- ];
- useEffect(()=>{
- localStorage.setItem('showGuide', showGuide.toString())
- },[showGuide])
- useEffect(()=>{
- localStorage.setItem('showAdvancedGuide', showAdvancedGuide.toString())
- },[showAdvancedGuide])
-
- useEffect(()=>{
- if(currentUrl === '/guide'){
- setTimeout(()=>{
- navigator('/guide/page')
- },0)
+ ]
+ },
+ {
+ title: $t('仪表盘'),
+ items: [
+ {
+ title: $t('统计 API 调用情况'),
+ description: $t('仪表盘中提供了多种统计图表,帮助我们了解 API 的运行情况。'),
+ link: 'https://docs.apipark.com/docs/analysis'
}
- },[])
- useEffect(()=>{forceUpdate({})},[state.language])
- return (
-
- 👋
- {$t('Hello!欢迎使用 APIPark')}
-
- }
- description={
-
{$t("你能通过 APIPark 快速在企业内部构建 API 开放门户/市场,享受极致的转发性能、API 可观测、服务治理、多租户管理、订阅审核流程等诸多好处。")}
-
{$t("如果你喜欢我们的产品,欢迎给我们 Star 或提供产品反馈意见。")}
-
}
- showBorder={false}
- scrollPage={false}
- contentClassName=" w-full pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B"
- >
-