mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-07-06 16:11:56 +08:00
Merge remote-tracking branch 'origin/feature/1.5-cx' into feature/1.5-local-model
This commit is contained in:
@@ -239,6 +239,21 @@ export const PERMISSION_DEFINITION = [
|
||||
anyOf: [{ backend: ['system.settings.log_configuration.manager'] }]
|
||||
}
|
||||
},
|
||||
'system.settings.ai_balance.view': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.ai_balance.view'] }]
|
||||
}
|
||||
},
|
||||
'system.settings.ai_balance.delete': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.ai_balance.manager'] }]
|
||||
}
|
||||
},
|
||||
'system.settings.ai_balance.add': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.ai_balance.manager'] }]
|
||||
}
|
||||
},
|
||||
'system.devops.policy.view': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.strategy.view'] }]
|
||||
|
||||
@@ -65,7 +65,7 @@ export type SimpleTeamItem = {
|
||||
}
|
||||
export type LocalModelItem = {
|
||||
id: string
|
||||
is_popular: boolean
|
||||
isPopular: boolean
|
||||
name: string
|
||||
size: string
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ const mockData = [
|
||||
key: 'loadBalancing',
|
||||
path: '/loadBalancing',
|
||||
icon: 'ph:network-x',
|
||||
access: 'system.settings.data_source.view'
|
||||
access: 'system.settings.ai_balance.view'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -269,11 +269,15 @@ const LocalModelList: React.FC = () => {
|
||||
]
|
||||
|
||||
const openLogsModal = (record: any) => {
|
||||
const closeModal = (reload = true) => {
|
||||
reload && pageListRef.current?.reload()
|
||||
modalInstance.destroy()
|
||||
}
|
||||
const modalInstance = modal.confirm({
|
||||
title: $t('部署过程'),
|
||||
content: <ServiceDeployment record={record} />,
|
||||
content: <ServiceDeployment record={record} closeModal={closeModal} />,
|
||||
footer: () => {
|
||||
return <LogsFooter record={record} modalInstance={modalInstance} />
|
||||
return <LogsFooter record={record} closeModal={closeModal} />
|
||||
},
|
||||
width: 600,
|
||||
okText: $t('确认'),
|
||||
|
||||
@@ -40,9 +40,10 @@ const LocalAiDeploy = forwardRef<LocalAiDeployHandle, any>((props: any, ref: any
|
||||
const tagList = data.models?.map((x: LocalModelItem) => {
|
||||
return { ...x, label: x.name, value: x.id }
|
||||
})
|
||||
tagList.unshift({ id: 'default', name: 'default' })
|
||||
form.setFieldValue('model', 'default')
|
||||
setTagList(tagList)
|
||||
if (tagList.length) {
|
||||
form.setFieldValue('model', tagList[0].id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
@@ -135,7 +136,7 @@ const LocalAiDeploy = forwardRef<LocalAiDeployHandle, any>((props: any, ref: any
|
||||
<div className="pl-[5px] flex flex-wrap">
|
||||
{modelList.length
|
||||
? modelList
|
||||
.filter((item) => item.is_popular)
|
||||
.filter((item) => item.isPopular)
|
||||
.map((item) => (
|
||||
<span
|
||||
key={item.id}
|
||||
|
||||
@@ -256,7 +256,7 @@ const LoadBalancingPage = () => {
|
||||
valueType: 'option',
|
||||
render: (_: React.ReactNode, entity: any) => [
|
||||
<TableBtnWithPermission
|
||||
access=""
|
||||
access="system.settings.ai_balance.delete"
|
||||
key="delete"
|
||||
btnType="delete"
|
||||
onClick={() => handleDelete(entity.id as string)}
|
||||
@@ -285,7 +285,7 @@ const LoadBalancingPage = () => {
|
||||
ref={pageListRef}
|
||||
rowKey="id"
|
||||
afterNewBtn={[
|
||||
<WithPermission key="removeFromDepPermission" access={``}>
|
||||
<WithPermission key="removeFromDepPermission" access="system.settings.ai_balance.add">
|
||||
<Button className="mr-btnbase" type="primary" key="removeFromDep" onClick={() => addModel()}>
|
||||
{$t('添加模型')}
|
||||
</Button>
|
||||
|
||||
@@ -137,15 +137,15 @@ const SystemList: FC = () => {
|
||||
setOpen(false)
|
||||
}
|
||||
const openLogsModal = (record: any) => {
|
||||
const closeModal = () => {
|
||||
const closeModal = (reload = true) => {
|
||||
modalInstance.destroy()
|
||||
manualReloadTable()
|
||||
reload && manualReloadTable()
|
||||
}
|
||||
const modalInstance = modal.confirm({
|
||||
title: $t('部署过程'),
|
||||
content: <ServiceDeployment record={record} closeModal={closeModal} />,
|
||||
footer: () => {
|
||||
return <LogsFooter record={record} modalInstance={modalInstance} />
|
||||
return <LogsFooter record={record} closeModal={closeModal} />
|
||||
},
|
||||
width: 600,
|
||||
okText: $t('确认'),
|
||||
|
||||
+5
-11
@@ -4,7 +4,7 @@ import { useFetch } from '@common/hooks/http.ts'
|
||||
import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from '@common/const/const'
|
||||
|
||||
export const LogsFooter = (props: any) => {
|
||||
const { record, modalInstance } = props
|
||||
const { record, closeModal = () => {} } = props
|
||||
const { message, modal } = App.useApp()
|
||||
const { fetchData } = useFetch()
|
||||
const stopDeploy = () => {
|
||||
@@ -21,15 +21,12 @@ export const LogsFooter = (props: any) => {
|
||||
const { code, msg } = response
|
||||
if (code === STATUS_CODE.SUCCESS) {
|
||||
resolve(true)
|
||||
closeModal()
|
||||
} else {
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
reject(false)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
resolve(true)
|
||||
modalInstance.destroy()
|
||||
})
|
||||
})
|
||||
},
|
||||
width: 600,
|
||||
@@ -53,15 +50,12 @@ export const LogsFooter = (props: any) => {
|
||||
const { code, msg } = response
|
||||
if (code === STATUS_CODE.SUCCESS) {
|
||||
resolve(true)
|
||||
closeModal()
|
||||
} else {
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
reject(false)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
resolve(true)
|
||||
modalInstance.destroy()
|
||||
})
|
||||
})
|
||||
},
|
||||
width: 600,
|
||||
@@ -75,7 +69,7 @@ export const LogsFooter = (props: any) => {
|
||||
<>
|
||||
{['deploying_error', 'error'].includes(record.state) ? (
|
||||
<div className="flex justify-end items-center">
|
||||
<Button onClick={() => { modalInstance.destroy() }}>{$t('取消')}</Button>
|
||||
<Button onClick={() => { closeModal(true) }}>{$t('取消')}</Button>
|
||||
<Button onClick={deleteService} type="primary" danger>
|
||||
{$t('删除服务')}
|
||||
</Button>
|
||||
@@ -85,7 +79,7 @@ export const LogsFooter = (props: any) => {
|
||||
<Button onClick={stopDeploy} type="primary" danger>
|
||||
{$t('停止')}
|
||||
</Button>
|
||||
<Button type="primary" onClick={() => { modalInstance.destroy() }}>{$t('继续等待')}</Button>
|
||||
<Button type="primary" onClick={() => { closeModal() }}>{$t('继续等待')}</Button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user