diff --git a/config/config.ts b/config/config.ts index 36546891..9dbc3ccd 100644 --- a/config/config.ts +++ b/config/config.ts @@ -14,7 +14,7 @@ const isProduction = env === 'production'; const t = Date.now(); export default defineConfig({ proxy: { - ...proxy() + ...proxy('http://192.168.50.166:8080') }, history: { type: 'hash' diff --git a/src/assets/styles/common.less b/src/assets/styles/common.less index 441b9621..59fffba9 100644 --- a/src/assets/styles/common.less +++ b/src/assets/styles/common.less @@ -93,6 +93,10 @@ align-items: center; } +.flex-wrap { + flex-wrap: wrap; +} + .flex-gap-2 { display: flex; gap: 2px; diff --git a/src/components/markdown-viewer/index.less b/src/components/markdown-viewer/index.less index 3b000b81..6fb99c44 100644 --- a/src/components/markdown-viewer/index.less +++ b/src/components/markdown-viewer/index.less @@ -1,6 +1,5 @@ .markdown-viewer { font-family: var(--font-family) !important; - white-space: pre-wrap; .hr { border: none; diff --git a/src/components/seal-table/styles/cell.less b/src/components/seal-table/styles/cell.less index a8335e81..323dc9fe 100644 --- a/src/components/seal-table/styles/cell.less +++ b/src/components/seal-table/styles/cell.less @@ -6,6 +6,8 @@ justify-content: flex-start; height: 68px; word-break: break-word; + min-width: 20px; + overflow: hidden; .cell-content { max-width: 100%; diff --git a/src/hooks/use-update-chunk-list.ts b/src/hooks/use-update-chunk-list.ts index 58da81f5..c19c9f6b 100644 --- a/src/hooks/use-update-chunk-list.ts +++ b/src/hooks/use-update-chunk-list.ts @@ -1,5 +1,4 @@ import { WatchEventType } from '@/config'; -import _ from 'lodash'; import { useEffect, useRef } from 'react'; interface ChunkedCollection { @@ -19,6 +18,7 @@ export function useUpdateChunkedList(options: { }) { const cacheDataListRef = useRef(options.dataList || []); const timerRef = useRef(null); + const countRef = useRef(0); useEffect(() => { cacheDataListRef.current = [...(options.dataList || [])]; @@ -30,74 +30,71 @@ export function useUpdateChunkedList(options: { options.setDataList?.([...cacheDataListRef.current]); }, 80); }; - const updateChunkedList = ( - data: ChunkedCollection, - dataList?: { id: string | number }[] - ) => { + const updateChunkedList = (data: ChunkedCollection) => { console.log('updateChunkedList=====', { ids: data?.ids, type: data?.type, - collection: data?.collection.length, - dataList: _.map(dataList, (o: any) => o.id) + collection: data?.collection }); let collections = data?.collection || []; if (options?.computedID) { - collections = _.map(collections, (item: any) => { + collections = collections?.map((item: any) => { item.id = options?.computedID?.(item); return item; }); } if (options?.filterFun) { - collections = _.filter(data?.collection, options?.filterFun); + collections = data?.collection?.filter(options?.filterFun); } if (options?.mapFun) { - collections = _.map(data?.collection, options?.mapFun); + collections = data?.collection?.map(options?.mapFun); } const ids = data?.ids || []; // CREATE if (data?.type === WatchEventType.CREATE) { - const newDataList: any[] = []; - _.each(collections, (item: any) => { - const updateIndex = _.findIndex( - cacheDataListRef.current, + const newDataList = collections.reduce((acc: any[], item: any) => { + const updateIndex = cacheDataListRef.current?.findIndex( (sItem: any) => sItem.id === item.id ); + const updateItem = { ...item }; if (updateIndex === -1) { - const updateItem = _.cloneDeep(item); - newDataList.push(updateItem); + acc.push(updateItem); + } else { + cacheDataListRef.current[updateIndex] = updateItem; } - console.log('create=========', updateIndex, collections); - }); - cacheDataListRef.current = [...newDataList, ...cacheDataListRef.current]; - // options.setDataList?.([...cacheDataListRef.current]); + + return acc; + }, []); + cacheDataListRef.current = [ + ...newDataList, + ...cacheDataListRef.current + ].slice(0, 10); } // DELETE if (data?.type === WatchEventType.DELETE) { - cacheDataListRef.current = _.filter( - cacheDataListRef.current, + cacheDataListRef.current = cacheDataListRef.current?.filter( (item: any) => { - return !_.includes(ids, item.id); + return !ids?.includes(item.id); } ); options.setDataList?.([...cacheDataListRef.current]); } // UPDATE if (data?.type === WatchEventType.UPDATE) { - _.each(collections, (item: any) => { - const updateIndex = _.findIndex( - cacheDataListRef.current, + collections?.forEach((item: any) => { + const updateIndex = cacheDataListRef.current?.findIndex( (sItem: any) => sItem.id === item.id ); + const updateItem = { ...item }; if (updateIndex > -1) { - const updateItem = _.cloneDeep(item); cacheDataListRef.current[updateIndex] = updateItem; } else if (updateIndex === -1) { - const updateItem = _.cloneDeep(item); - cacheDataListRef.current.push(updateItem); + cacheDataListRef.current = [ + updateItem, + ...cacheDataListRef.current.slice(0, 9) + ]; } }); - console.log('updateChunkedList=====update', cacheDataListRef.current); - // options.setDataList?.([...cacheDataListRef.current]); } debounceUpdateChunckedList(); diff --git a/src/locales/en-US/playground.ts b/src/locales/en-US/playground.ts index 5ae260a9..c86fd793 100644 --- a/src/locales/en-US/playground.ts +++ b/src/locales/en-US/playground.ts @@ -46,5 +46,5 @@ export default { 'playground.compare.applytoall': 'Apply to all models', 'playground.model.noavailable': 'No available models.', 'playground.model.noavailable.tips': - 'Please deploy a model first, and it is not an Embedding Only model.' + 'Please deploy a model first, and it should not be an embedding-only model.' }; diff --git a/src/locales/zh-CN/playground.ts b/src/locales/zh-CN/playground.ts index 7ca8269f..94f7a3fc 100644 --- a/src/locales/zh-CN/playground.ts +++ b/src/locales/zh-CN/playground.ts @@ -46,5 +46,5 @@ export default { 'playground.compare.applytoall': '应用到所有模型', 'playground.model.noavailable': '无可用模型', 'playground.model.noavailable.tips': - '请先部署模型,且不是 Embedding Only 模型' + '请先部署模型,且不是 Embedding Only 的模型' }; diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 3cff613d..e966163a 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -519,17 +519,20 @@ const Models: React.FC = ({ span={5} render={(text, record: ListItem) => { return ( - - - {text} + + + {text} - - {record.embedding_only && ( - + {record.embedding_only && ( + + Embedding Only - )} - + + )} ); }} diff --git a/src/pages/playground/components/message-input.tsx b/src/pages/playground/components/message-input.tsx index f151a921..af911131 100644 --- a/src/pages/playground/components/message-input.tsx +++ b/src/pages/playground/components/message-input.tsx @@ -1,12 +1,7 @@ import IconFont from '@/components/icon-font'; import HotKeys, { KeyMap } from '@/config/hotkeys'; import { platformCall } from '@/utils'; -import { - ClearOutlined, - ControlOutlined, - SendOutlined, - SwapOutlined -} from '@ant-design/icons'; +import { ClearOutlined, SendOutlined, SwapOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; import { Button, Divider, Input, Select, Tooltip } from 'antd'; import _ from 'lodash'; @@ -351,7 +346,7 @@ const MessageInput: React.FC = ({ > - - + */} {updateLayout && ( <> diff --git a/src/pages/playground/components/prompt-modal.tsx b/src/pages/playground/components/prompt-modal.tsx index fbe8ebb7..3465d414 100644 --- a/src/pages/playground/components/prompt-modal.tsx +++ b/src/pages/playground/components/prompt-modal.tsx @@ -1,7 +1,7 @@ +import useOverlayScroller from '@/hooks/use-overlay-scroller'; import { useIntl } from '@umijs/max'; import { Button, Modal, Typography } from 'antd'; import React from 'react'; -import SimpleBar from 'simplebar-react'; import 'simplebar-react/dist/simplebar.min.css'; import promptList from '../config/prompt'; import '../style/prompt-modal.less'; @@ -15,6 +15,15 @@ type ViewModalProps = { const AddWorker: React.FC = (props) => { const { open, onCancel } = props || {}; const intl = useIntl(); + const { initialize } = useOverlayScroller(); + const scrollerRef = React.useRef(null); + + React.useEffect(() => { + if (scrollerRef.current) { + initialize(scrollerRef.current); + } + }, [scrollerRef.current, initialize]); + const handleSelect = (item: { title: string; data: { role: string; content: string }[]; @@ -45,7 +54,7 @@ const AddWorker: React.FC = (props) => { }} footer={null} > - +
{promptList.map((item, index) => { return ( @@ -83,7 +92,7 @@ const AddWorker: React.FC = (props) => { ); })}
- +
); };