diff --git a/src/pages/llmodels/components/instance-item.tsx b/src/pages/llmodels/components/instance-item.tsx index 906e54ed..995c18d6 100644 --- a/src/pages/llmodels/components/instance-item.tsx +++ b/src/pages/llmodels/components/instance-item.tsx @@ -11,7 +11,7 @@ import { Col, Row, Space, Tooltip } from 'antd'; import dayjs from 'dayjs'; import _ from 'lodash'; import React from 'react'; -import { InstanceStatusMap, status } from '../config'; +import { InstanceStatusMap, InstanceStatusMapValue, status } from '../config'; import { ModelInstanceListItem } from '../config/types'; interface InstanceItemProps { @@ -23,11 +23,6 @@ interface InstanceItemProps { ) => void; } -const testStatus = { - state: InstanceStatusMap.Downloading, - text: 'Downloading' -}; - const InstanceItem: React.FC = ({ list, handleChildSelect @@ -112,7 +107,7 @@ const InstanceItem: React.FC = ({ } statusValue={{ status: status[item.state] as any, - text: item.state, + text: InstanceStatusMapValue[item.state], message: item.state_message }} > diff --git a/src/pages/llmodels/config/index.ts b/src/pages/llmodels/config/index.ts index 9ae996ae..711f1622 100644 --- a/src/pages/llmodels/config/index.ts +++ b/src/pages/llmodels/config/index.ts @@ -22,14 +22,25 @@ export const modelSourceMap: Record = { }; export const InstanceStatusMap = { - Initializing: 'Initializing', - Pending: 'Pending', - Running: 'Running', - Scheduled: 'Scheduled', - Error: 'Error', - Downloading: 'Downloading', - Unknown: 'Unknown', - Analyzing: 'Analyzing' + Initializing: 'initializing', + Pending: 'pending', + Running: 'running', + Scheduled: 'scheduled', + Error: 'error', + Downloading: 'downloading', + Unknown: 'unknown', + Analyzing: 'analyzing' +}; + +export const InstanceStatusMapValue = { + [InstanceStatusMap.Initializing]: 'Initializing', + [InstanceStatusMap.Pending]: 'Pending', + [InstanceStatusMap.Running]: 'Running', + [InstanceStatusMap.Scheduled]: 'Scheduled', + [InstanceStatusMap.Error]: 'Error', + [InstanceStatusMap.Downloading]: 'Downloading', + [InstanceStatusMap.Unknown]: 'Unknown', + [InstanceStatusMap.Analyzing]: 'Analyzing' }; export const status: any = { diff --git a/src/pages/playground/components/params-settings.tsx b/src/pages/playground/components/params-settings.tsx index bf2f4ec5..b4dd1e54 100644 --- a/src/pages/playground/components/params-settings.tsx +++ b/src/pages/playground/components/params-settings.tsx @@ -150,7 +150,7 @@ const ParamsSettings: React.FC = ({ name="model" - rules={[{ required: true }]} + rules={[{ required: false }]} > = ({ name="temperature" - rules={[{ required: true }]} + rules={[{ required: false }]} > = ({ name="max_tokens" - rules={[{ required: true }]} + rules={[{ required: false }]} > = ({ name="top_p" - rules={[{ required: true }]} + rules={[{ required: false }]} > = ({ name="seed" - rules={[{ required: true }]} + rules={[{ required: false }]} > = ({ name="stop" - rules={[{ required: true }]} + rules={[{ required: false }]} > { const [searchParams] = useSearchParams(); const selectModel = searchParams.get('model') || ''; const [params, setParams] = useState({}); + const [collapse, setCollapse] = useState(false); return ( - <> - -
-
- -
-
+ +
+
+ +
+
+ +
- -
- +
+
+ +
- - +
+ ); }; diff --git a/src/pages/playground/style/play-ground.less b/src/pages/playground/style/play-ground.less index b8a5672d..fa41e0d5 100644 --- a/src/pages/playground/style/play-ground.less +++ b/src/pages/playground/style/play-ground.less @@ -2,6 +2,28 @@ display: flex; align-items: flex-start; + .left { + position: relative; + display: flex; + justify-content: flex-start; + width: 391px; + + .collapse-btn { + position: absolute; + top: 0; + left: 0; + z-index: 1; + } + + transition: width 0.3s ease; + + &.collapse { + width: 0; + padding-left: 32px; + transition: width 0.3s ease; + } + } + .chat { flex: 1; display: flex; @@ -9,16 +31,38 @@ } .params { - padding: 20px; - padding-top: 0; + overflow: hidden; + height: calc(100vh - 136px); + + .collapse { + width: 0; + overflow: hidden; + } + } + + .params-box { + padding-inline: 32px; + height: 100%; + overflow-y: auto; } .divider-line { width: 1px; + &.collapse { + width: 0; + transition: width 0.3s; + } + .ant-divider { margin: 0; - min-height: calc(100vh - 136px); + height: calc(100vh - 136px); } } } + +.playground-container { + .ant-pro-page-container-children-container { + padding-right: 0; + } +} diff --git a/src/pages/resources/components/workers.tsx b/src/pages/resources/components/workers.tsx index bba41dac..9085e2c6 100644 --- a/src/pages/resources/components/workers.tsx +++ b/src/pages/resources/components/workers.tsx @@ -10,6 +10,7 @@ import { Button, Input, Modal, Space, Table, Tooltip, message } from 'antd'; import _ from 'lodash'; import { memo, useEffect, useState } from 'react'; import { deleteWorker, queryWorkersList } from '../apis'; +import { WorkerStatusMapValue, status } from '../config'; import { Filesystem, GPUDeviceItem, ListItem } from '../config/types'; const { Column } = Table; @@ -218,10 +219,9 @@ const Resources: React.FC = () => { return ( ); diff --git a/src/pages/resources/config/index.ts b/src/pages/resources/config/index.ts new file mode 100644 index 00000000..bcf6bbe2 --- /dev/null +++ b/src/pages/resources/config/index.ts @@ -0,0 +1,16 @@ +import { StatusMaps } from '@/config'; + +export const WorkerStatusMap = { + ready: 'ready', + not_ready: 'not_ready' +}; + +export const WorkerStatusMapValue = { + [WorkerStatusMap.ready]: 'Ready', + [WorkerStatusMap.not_ready]: 'Not Ready' +}; + +export const status: any = { + [WorkerStatusMap.ready]: StatusMaps.success, + [WorkerStatusMap.not_ready]: StatusMaps.error +}; diff --git a/src/pages/resources/config/types.ts b/src/pages/resources/config/types.ts index 1f7ed6cc..b9ca50ce 100644 --- a/src/pages/resources/config/types.ts +++ b/src/pages/resources/config/types.ts @@ -64,6 +64,7 @@ export interface ListItem { labels: object; state: string; ip: string; + state_message: string; status: { cpu: { total: number;