feat: feature/1.5-Data Integration

This commit is contained in:
ningyv
2025-02-18 21:55:58 +08:00
parent 66d0653dc6
commit 04a5da862f
10 changed files with 28 additions and 15 deletions
@@ -280,9 +280,9 @@ function BasicLayout({ project = 'core' }: { project: string }) {
collapsedButtonRender={false}
>
<div
className={`w-full h-calc-100vh-minus-navbar pl-PAGE_INSIDE_X pt-PAGE_INSIDE_T ${
className={`w-full h-calc-100vh-minus-navbar ${
currentUrl.startsWith('/role/list') ? 'overflow-auto' : 'overflow-hidden'
}`}
} ${currentUrl.startsWith('/guide/page') ? '' : 'pl-PAGE_INSIDE_X pt-PAGE_INSIDE_T'}`}
>
<Outlet />
</div>
@@ -22,6 +22,7 @@ class InsidePageProps {
headerClassName?: string = ''
/** 整个页面滚动 */
scrollPage?: boolean = true
customPadding?: boolean
customBtn?: ReactNode
}
@@ -41,6 +42,7 @@ const InsidePage: FC<InsidePageProps> = ({
contentClassName = '',
headerClassName = '',
scrollPage = true,
customPadding = false,
customBtn
}) => {
const navigate = useNavigate()
@@ -57,7 +59,7 @@ const InsidePage: FC<InsidePageProps> = ({
{!pageTitle && !description && !backUrl && !customBtn ? (
<></>
) : (
<div className="mb-[30px]">
<div className={customPadding ? '' : 'mb-[30px]'}>
{backUrl && (
<div className="text-[18px] leading-[25px] mb-[12px]">
<Button type="text" onClick={goBack}>
+7 -3
View File
@@ -98,7 +98,7 @@ const trimStringValuesInObject = (obj: unknown): unknown => {
return obj
}
const processQueryParams = (url: string, options: EoRequest, shouldTransformKeys: boolean) => {
const processQueryParams = (url: string, options: EoRequest, shouldTransformKeys: boolean, transformParams = true) => {
if (options.eoParams) {
const cleanParams = Object.fromEntries(
Object.entries(options.eoParams)
@@ -106,7 +106,10 @@ const processQueryParams = (url: string, options: EoRequest, shouldTransformKeys
.map(([key, value]) => [key, typeof value === 'string' ? value.trim() : value])
)
const queryParams = convertQueryParamsToSnake(cleanParams, shouldTransformKeys, options.eoTransformKeys as string[])
const queryString = queryParams.toString()
let queryString = queryParams.toString()
if (!transformParams) {
queryString = decodeURIComponent(queryString)
}
url += (url.includes('?') ? '&' : '?') + queryString // 添加查询字符串到URL
}
return url
@@ -137,6 +140,7 @@ type EoRequest = RequestInit & {
isStream?: boolean
handleStream?: (line: any) => void
callback?: (cancel: () => void) => void
transformParams?: boolean
}
type EoHeaders = Headers | { [k: string]: string }
@@ -162,7 +166,7 @@ export function useFetch() {
!shouldNotTransform(url) && options?.eoTransformKeys && options?.eoTransformKeys?.length > 0
// 处理URL查询参数
url = processQueryParams(url, options, !!shouldTransformKeys)
url = processQueryParams(url, options, !!shouldTransformKeys, options?.transformParams)
// 处理请求体, 当请求头为json时,fetch的body应当是json字符串
options.body = processRequestBody(options, headers as EoHeaders, !!shouldTransformKeys)
@@ -868,6 +868,7 @@
"K39a8d392": "Import OpenAPI documents to publish existing system APIs to APIPark.",
"Ka742e079": "Add API Key for public cloud AI models to call public cloud AI models via APIPark.",
"K8097d6be": "is an open-source AI Gateway and API Portal that unifies access to OpenAI, DeepSeek, and other AI models. With enterprise-grade security features and real-time monitoring, it helps teams safely manage and share their AI APIs through a unified gateway.",
"Kf1ce5b3": "✨ We'd love your support on Github! Leave us a star or share your feedback.",
"K3af90490": "⚡ You can quickly open the API for everyone to use via the following methods:"
"Kf1ce5b3": "✨ We'd love your support on Github! Leave us a star or share your feedback. ",
"K3af90490": "⚡ You can quickly open the API for everyone to use via the following methods:",
"K6b99dce8": "address"
}
@@ -891,5 +891,6 @@
"Ka742e079": "パブリッククラウドAIモデルのAPIキーを追加し、APIParkを介してパブリッククラウドのAIモデルを統一的に呼び出します。",
"K8097d6be": "OpenAIやDeepSeekなどのさまざまなAIモデルに迅速にアクセスできるオープンソースのワンストップAIゲートウェイおよびAPIポータルです。統一されたリクエスト形式を使用して、モデルの切り替えによるビジネスへの影響を回避し、企業レベルのAPIセキュリティ(認証/レート制限/センシティブワードフィルタリング)とリアルタイムの使用量監視を提供します。チーム内でのAPI共有やコラボレーションをサポートし、インターフェースのサブスクリプション認証を管理してAPIのセキュリティを確保します。",
"Kf1ce5b3": "✨ Githubでスターを付けていただくか、製品フィードバックをお寄せください。",
"K3af90490": "⚡ 以下の方法で、APIをすぐに公開して皆さんに利用してもらえます:"
"K3af90490": "⚡ 以下の方法で、APIをすぐに公開して皆さんに利用してもらえます:",
"K6b99dce8": "Ollama アドレス"
}
@@ -822,5 +822,6 @@
"Ka742e079": "添加公有云AI模型的 API Key,通过APIPark 统一调用公有云的AI模型。",
"K8097d6be": "是开源的一站式 AI 网关与 API 门户,可快速接入 OpenAI/DeepSeek 等各类 AI 模型,通过统一请求格式避免模型切换对业务造成影响,提供企业级 API 安全防护(鉴权/限流/敏感词过滤)与实时用量监控,支持团队内 API 共享协作,管理接口订阅授权并保证您的API安全。",
"Kf1ce5b3": "✨ 欢迎在 Github 为我们 Star 或提供产品反馈意见。",
"K3af90490": "⚡您可快速通过以下方式开放API供大家使用:"
"K3af90490": "⚡您可快速通过以下方式开放API供大家使用:",
"K6b99dce8": "Ollama 地址"
}
@@ -891,5 +891,6 @@
"Ka742e079": "添加公有雲 AI 模型的 API Key,通過 APIPark 統一調用公有雲的 AI 模型。",
"K8097d6be": "是一個開源的一站式 AI 閘道和 API 入口網站,可快速接入 OpenAI/DeepSeek 等各類 AI 模型,通過統一的請求格式避免模型切換對業務造成影響,提供企業級 API 安全防護(鑑權/限流/敏感詞過濾)與實時用量監控,支持團隊內 API 共享協作,管理介面訂閱授權並保證您的 API 安全。",
"Kf1ce5b3": "✨ 歡迎在 Github 為我們 Star 或提供產品反饋意見。",
"K3af90490": "⚡ 您可以快速通過以下方式開放 API 供大家使用:"
"K3af90490": "⚡ 您可以快速通過以下方式開放 API 供大家使用:",
"K6b99dce8": "Ollama 地址"
}
@@ -31,7 +31,8 @@ const ConfigureOllamaService = forwardRef<ConfigureOllamaServiceHandle, any>((pr
.then((value) => {
fetchData<BasicResponse<null>>('model/local/source/ollama', {
method: 'PUT',
eoParams: { address: value.address }
eoParams: { address: value.address },
transformParams: false
})
.then((response) => {
const { code, msg } = response
@@ -69,7 +70,7 @@ const ConfigureOllamaService = forwardRef<ConfigureOllamaServiceHandle, any>((pr
name="address"
rules={[{ required: true, whitespace: true }]}
className="p-4 bg-white rounded-lg"
label={$t('Ollama 端点')}
label={$t('Ollama 地址')}
>
<Input
placeholder={$t('输入例如:https://www.apipark.com')}
@@ -193,7 +193,7 @@ export const AIModelGuide = () => {
}
]
return (
<div className="mb-[30px] pt-[15px] flex justify-between space-x-4">
<div className="mb-[30px] pt-[30px] flex justify-between space-x-4">
{cardList.map((item, itemIndex) => (
<Card
key={itemIndex}
@@ -186,7 +186,9 @@ export default function Guide() {
}
showBorder={false}
scrollPage={false}
contentClassName=" w-full pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B"
customPadding={true}
headerClassName="pt-[30px] pl-[40px]"
contentClassName=" w-full pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B pl-[40px]"
>
<AIModelGuide></AIModelGuide>
<div className="flex flex-col gap-[15px]">