Skip to content

Commit 1ad9ead

Browse files
refactor: 显卡数量选择变成option选项、去除readme中的无用image (#40)
- 显卡数量选择变成option选项 - 去除readme中的无用image - 新增administrator管理员账号(用于编辑内置应用) - 改变代码编辑器目录名称避免出现404问题 - 修复组件运行实现为undefined问题 - 解决画布中调用推理服务参数为undefined问题 - 添加互联网功能开关机制 - 调整内置的模型清单 - 更新内置模型清单、解除上传模型不可推理限制、增加模型首次启动标识、增加推理引擎是否正常检测功能 - 自动生成帮助文档导航 - 修改模型来源model_kind和相关功能优化 Co-authored-by: wangbochao.vendor <15830881993@163.com>
1 parent aa35833 commit 1ad9ead

56 files changed

Lines changed: 146 additions & 71 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 0 deletions

back/src/parts/doc/template/README.md

Lines changed: 0 additions & 2 deletions
Binary file not shown.

front/app/(appLayout)/inferenceService/cloud/EditModel.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
2-
import { Form, Input, Modal } from 'antd'
2+
import { Form, Input, Modal, Tooltip } from 'antd'
3+
import { QuestionCircleOutlined } from '@ant-design/icons'
34
import { editModel } from '@/infrastructure/api/modelWarehouse'
45
import Toast, { ToastTypeEnum } from '@/app/components/base/flash-notice'
56

@@ -55,7 +56,40 @@ const ModalList = (props: any) => {
5556
{isOpenAI && (
5657
<Form.Item
5758
name="proxy_url"
58-
label="URL"
59+
label={
60+
<span>
61+
URL{' '}
62+
<Tooltip
63+
title={
64+
<div style={{ whiteSpace: 'pre-wrap' }}>
65+
OpenAI协议接入方式(示例URL为:http://ip:8000/v1/):
66+
<br />
67+
1、接入已有的标准OpenAI协议的推理服务,填写推理服务地址即可
68+
<br />
69+
2、使用vllm-openai镜像方式搭建OpenAI协议的推理服务
70+
<br />
71+
<pre style={{ margin: '8px 0', background: 'rgba(255,255,255,0.1)', padding: '8px', borderRadius: '4px', fontSize: '12px' }}>
72+
{`docker run \\
73+
--runtime=nvidia \\
74+
-e NVIDIA_VISIBLE_DEVICES=6,7 \\
75+
-v /data/nfs/ams/models/Qwen3-32B:/model \\
76+
-p 8000:8000 \\
77+
--shm-size=32g \\
78+
vllm/vllm-openai:v0.11.0 \\
79+
--model /model \\
80+
--dtype auto \\
81+
--tensor-parallel-size 2 \\
82+
--served-model-name qwen3-32b \\
83+
--port 8000`}
84+
</pre>
85+
</div>
86+
}
87+
overlayStyle={{ maxWidth: '600px' }}
88+
>
89+
<QuestionCircleOutlined style={{ cursor: 'pointer' }} />
90+
</Tooltip>
91+
</span>
92+
}
5993
dependencies={['api_key']}
6094
rules={[
6195
// { required: true, message: 'URL 和 API Key 至少需要填写一个' },

front/app/(appLayout)/inferenceService/platform/page.tsx

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22
import React, { useEffect, useRef, useState } from 'react'
3-
import { Button, Collapse, Empty, Form, Input, InputNumber, Modal, Pagination, Popconfirm, Select, Spin, Tag, message } from 'antd'
4-
import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons'
3+
import { Button, Collapse, Empty, Form, Input, Modal, Pagination, Popconfirm, Select, Spin, Tag, Tooltip, message } from 'antd'
4+
import { MinusCircleOutlined, PlusCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons'
55
import { useUpdateEffect } from 'ahooks'
66
import style from './page.module.scss'
77
import ChatModal from './chatModal'
@@ -62,6 +62,8 @@ const InferenceService = () => {
6262
const [sName, setSName] = useState('')
6363
const [selectLabels, setSelectLabels] = useState([]) as any
6464
const [creator, setCreator] = useState([]) as any
65+
const [riskModalOpen, setRiskModalOpen] = useState(false)
66+
const [pendingValues, setPendingValues] = useState<any>(null)
6567

6668
// 添加轮询相关的引用
6769
const pollingTimer = useRef<NodeJS.Timeout | null>(null)
@@ -188,47 +190,62 @@ const InferenceService = () => {
188190
setIsModalOpen(true)
189191
}
190192

191-
const handleOk = () => {
192-
if (isView) {
193-
setIsModalOpen(false)
194-
setIsView(false)
195-
return
196-
}
193+
const submitFormValues = async (values: any) => {
197194
let gUrl = ''
198195
if (isEdit)
199196
gUrl = '/infer-service/service/create'
200197

201198
else
202199
gUrl = '/infer-service/group/create'
203200

201+
setBtnLoading(true)
202+
203+
try {
204+
const res: any = await createPrompt({
205+
url: gUrl,
206+
body: values,
207+
})
208+
if (res) {
209+
message.success('保存成功')
210+
form.resetFields()
211+
setModelType('localLLM')
212+
getList(1, '')
213+
setIsModalOpen(false)
214+
setPageOption({ ...pageOption, page: 1 })
215+
}
216+
}
217+
finally {
218+
setBtnLoading(false)
219+
setPendingValues(null)
220+
setRiskModalOpen(false)
221+
}
222+
}
223+
224+
const handleOk = () => {
225+
if (isView) {
226+
setIsModalOpen(false)
227+
setIsView(false)
228+
return
229+
}
204230
form.validateFields().then(async (values) => {
205-
setBtnLoading(true)
206-
207-
const params = { ...values }
208-
try {
209-
const res: any = await createPrompt({
210-
url: gUrl,
211-
body: params,
212-
})
213-
if (res) {
214-
message.success('保存成功')
215-
form.resetFields()
216-
setModelType('localLLM')
217-
getList(1, '')
218-
setIsModalOpen(false)
219-
setPageOption({ ...pageOption, page: 1 })
231+
if (!isEdit) {
232+
const selectedModel = modelList.find((item: any) => item.id === values.model_id)
233+
if (selectedModel && selectedModel.need_confirm === false) {
234+
setPendingValues(values)
235+
setRiskModalOpen(true)
236+
return
220237
}
221238
}
222-
finally {
223-
setBtnLoading(false)
224-
}
239+
submitFormValues(values)
225240
})
226241
}
227242

228243
const handleCancel = () => {
229244
setIsModalOpen(false)
230245
form.resetFields()
231246
setModelType('localLLM')
247+
setPendingValues(null)
248+
setRiskModalOpen(false)
232249
}
233250

234251
const onSearchApp = (e) => {
@@ -527,9 +544,24 @@ const InferenceService = () => {
527544
},
528545
},
529546
]}
530-
style={{ width: '80%', marginBottom: 0 }}
547+
style={{ marginBottom: 0 }}
531548
>
532-
<InputNumber min={1} precision={0} placeholder="分配显卡数量" style={{ width: '100%' }} />
549+
<div className='flex items-center gap-[8px]'>
550+
<Select placeholder="分配显卡数量" style={{ width: '80%' }} options={[{ label: '1', value: 1 }, { label: '2', value: 2 }, { label: '4', value: 4 }, { label: '8', value: 8 }]} />
551+
<Tooltip
552+
placement="top"
553+
title={
554+
<div className='text-xs leading-relaxed max-w-[280px]'>
555+
<p>运行大模型占用的显存主要由以下组成(以Qwen3-32B、精度为FP16为例计算,占用显存约为64+8+2=74G):</p>
556+
<p>1)模型权重:32B × 2 = 64 GB,固定不变。</p>
557+
<p>2)KV缓存:2 × 并发数 × 32K × 64 × 128 × 8 × 2,示例为并发1上下文32K,约8G;并发翻倍显存同步增加。</p>
558+
<p>3)激活值与开销:推理中间计算与框架额外占用约1-2G。</p>
559+
</div>
560+
}
561+
>
562+
<QuestionCircleOutlined style={{ color: '#0E5DD8' }} />
563+
</Tooltip>
564+
</div>
533565
</Form.Item>
534566
</div>
535567
</Form.Item>
@@ -540,6 +572,22 @@ const InferenceService = () => {
540572
</Form>
541573
</div>
542574
</Modal>
575+
<Modal
576+
open={riskModalOpen}
577+
title="启动风险提示"
578+
okText="坚持启动"
579+
cancelText="取消"
580+
onOk={() => pendingValues && submitFormValues(pendingValues)}
581+
onCancel={() => {
582+
setRiskModalOpen(false)
583+
setPendingValues(null)
584+
}}
585+
>
586+
<div className='leading-relaxed'>
587+
<p>当前模型不在官方支持清单内,启动推理服务时可能无法成功。</p>
588+
<p>是否仍然选择继续启动?</p>
589+
</div>
590+
</Modal>
543591
<ChatModal agentId={testInfo?.id} modelName={testInfo?.name} visible={visible} onOk={() => setVisible(false)} onCancel={() => setVisible(false)} />
544592
</div>
545593
</Spin>

front/app/components/taskStream/board/history-preview-panel/tracing-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type HistoryDataFormat = {
1111
inputs: string
1212
outputs: string
1313
status: string
14-
consumed_time: number
14+
elapsed_time: number
1515
prompt_tokens: number
1616
completion_tokens: number
1717
sessionid: string
@@ -86,7 +86,7 @@ const convertHistoryDataToNodeMonitoring = (rawData: HistoryDataFormat): History
8686
process_record: null,
8787
outputs: item.outputs,
8888
status: item.status,
89-
consumed_time: item.consumed_time,
89+
elapsed_time: item.elapsed_time,
9090
execution_metadata: {
9191
total_tokens: item.prompt_tokens + item.completion_tokens,
9292
total_price: 0,

front/app/components/taskStream/board/task-summary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ const WorkflowPreview = () => {
362362
varOutputs={varOutputs}
363363
status={workflowLiveData?.result?.status || ''}
364364
error={workflowLiveData?.result?.error as any}
365-
consumed_time={workflowLiveData?.result?.consumed_time}
365+
elapsed_time={workflowLiveData?.result?.elapsed_time}
366366
total_tokens={workflowLiveData?.result?.total_tokens}
367367
created_at={workflowLiveData?.result?.created_at}
368368
created_by={(workflowLiveData?.result?.created_by as any)?.name}

front/app/components/taskStream/driveFlow/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ const WorkflowExecutionPanel: FC<WorkflowExecutionPanelProps> = ({
212212
simple_error: executionDetail.error,
213213
}
214214
: undefined}
215-
consumed_time={executionDetail.consumed_time}
215+
elapsed_time={executionDetail.elapsed_time}
216216
total_tokens={executionDetail.total_tokens}
217217
created_at={executionDetail.created_at}
218218
created_by={determineExecutor}

front/app/components/taskStream/driveFlow/result-panel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { fetchTraceList } from '@/infrastructure/api//log'
1212
import './index.scss'
1313

1414
export type ExecutionResultProps = {
15-
consumed_time?: number
15+
elapsed_time?: number
1616
created_at?: number
1717
created_by?: string
1818
error?: { detail_error: string; simple_error: string }
@@ -28,7 +28,7 @@ export type ExecutionResultProps = {
2828
}
2929

3030
const ExecutionResult: FC<ExecutionResultProps> = ({
31-
consumed_time,
31+
elapsed_time,
3232
created_at,
3333
created_by,
3434
error,
@@ -81,7 +81,7 @@ const ExecutionResult: FC<ExecutionResultProps> = ({
8181
<div className='px-4 py-2'>
8282
<ExecutionStatus
8383
status={status}
84-
time={consumed_time}
84+
time={elapsed_time}
8585
tokens={total_tokens}
8686
error={error}
8787
/>
@@ -149,7 +149,7 @@ const ExecutionResult: FC<ExecutionResultProps> = ({
149149
status={status}
150150
executor={created_by}
151151
startTime={created_at}
152-
time={consumed_time}
152+
time={elapsed_time}
153153
tokens={total_tokens}
154154
steps={steps}
155155
presentSteps={presentSteps}

0 commit comments

Comments
 (0)