diff --git a/config/theme.ts b/config/theme.ts index 72829ab9..60496ff7 100644 --- a/config/theme.ts +++ b/config/theme.ts @@ -46,7 +46,9 @@ export default { }, token: { colorPrimary: '#007BFF', - borderRadius: 6, + colorSuccess: '#54cc98', + borderRadius: 4, + borderRadiusSM: 2, fontSize: 12, motion: true } diff --git a/src/components/icon-font/index.tsx b/src/components/icon-font/index.tsx index 9aab093d..98887b2b 100644 --- a/src/components/icon-font/index.tsx +++ b/src/components/icon-font/index.tsx @@ -1,7 +1,7 @@ import { createFromIconfontCN } from '@ant-design/icons'; const IconFont = createFromIconfontCN({ - scriptUrl: '//at.alicdn.com/t/c/font_4613488_fcpq8y25444.js' + scriptUrl: '//at.alicdn.com/t/c/font_4613488_7vr8v36d7xp.js' }); export default IconFont; diff --git a/src/components/label-selector/label-item.tsx b/src/components/label-selector/label-item.tsx index be888bdf..4caf6b00 100644 --- a/src/components/label-selector/label-item.tsx +++ b/src/components/label-selector/label-item.tsx @@ -77,7 +77,7 @@ const LabelItem: React.FC = ({ title={intl.formatMessage({ id: 'resources.table.key.tips' })} > = ({
{valueAddon ?? ( diff --git a/src/config/hotkeys.ts b/src/config/hotkeys.ts index 607b993f..e04f5265 100644 --- a/src/config/hotkeys.ts +++ b/src/config/hotkeys.ts @@ -1,23 +1,26 @@ import { platformCall } from '@/utils'; + const platform = platformCall(); const KeybindingsMap = { - CREATE: ['alt+ctrl+N', 'alt+meta+N'], - CLEAR: ['alt+ctrl+K', 'alt+meta+K'], - RIGHT: ['ctrl+RIGHT', 'meta+RIGHT'], - SAVE: ['ctrl+S', 'meta+S'], - SUBMIT: ['ctrl+enter', 'meta+enter'], - SAVEAS: ['alt+ctrl+S', 'alt+meta+S'], - OPEN: ['alt+ctrl+O', 'alt+meta+O'], - CANCEL: ['ctrl+W', 'meta+W'], + CREATE: ['Alt+Ctrl+N', 'Alt+Meta+N'], + CLEAR: ['Alt+Ctrl+K', 'Alt+Meta+K'], + RIGHT: ['Ctrl+RIGHT', 'Meta+RIGHT'], + SAVE: ['Ctrl+S', 'Meta+S'], + SUBMIT: ['Ctrl+Enter', 'Meta+Enter'], + SAVEAS: ['Alt+Ctrl+S', 'Alt+Meta+S'], + OPEN: ['Alt+Ctrl+O', 'Alt+Meta+O'], + CANCEL: ['Ctrl+W', 'Meta+W'], DELETE: ['delete'], - COPY: ['ctrl+C', 'meta+C'], - REFRESH: ['ctrl+R', 'meta+R'], - EDIT: ['ctrl+E', 'meta+E'], - SEARCH: ['ctrl+K', 'meta+K'], - RESET: ['alt+ctrl+R', 'alt+meta+R'], - INPUT: ['ctrl+K', 'meta+K'], - NEW1: ['ctrl+1', 'meta+1'], - NEW2: ['ctrl+2', 'meta+2'] + COPY: ['Ctrl+C', 'Meta+C'], + REFRESH: ['Ctrl+R', 'Meta+R'], + EDIT: ['Ctrl+E', 'Meta+E'], + SEARCH: ['Ctrl+K', 'Meta+K'], + RESET: ['Alt+Ctrl+R', 'Alt+Meta+R'], + INPUT: ['Ctrl+K', 'Meta+K'], + NEW1: ['Ctrl+1', 'Meta+1'], + NEW2: ['Ctrl+2', 'Meta+2'], + FOCUS: ['/', '/'], + ADD: ['Alt+Ctrl+Enter', 'Alt+Meta+Enter'] }; type KeyBindingType = keyof typeof KeybindingsMap; @@ -36,11 +39,11 @@ const KeybiningList: KeybindingValue[] = Object.entries(KeybindingsMap).map( keybinding: keybinding, command: key, textKeybinding: platform.isMac - ? keybinding.replace('meta', 'Cmd').replace('alt', 'Option') - : keybinding.replace('ctrl', 'Ctrl'), + ? keybinding.replace('Meta', 'Cmd').replace('Alt', 'Option') + : keybinding.replace('Ctrl', 'Ctrl'), iconKeybinding: platform.isMac - ? keybinding.replace('meta', '⌘').replace('alt', '⌥') - : keybinding.replace('ctrl', 'Ctrl') + ? keybinding.replace('Meta', '⌘').replace('Alt', '⌥') + : keybinding.replace('Ctrl', 'Ctrl') } as KeybindingValue; } ); diff --git a/src/global.less b/src/global.less index cc985df9..cea07b16 100644 --- a/src/global.less +++ b/src/global.less @@ -5,7 +5,7 @@ html { --ant-color-text-secondary: rgba(0, 0, 0, 65%); --ant-color-text-tertiary: rgba(0, 0, 0, 45%); --ant-color-text-quaternary: rgba(0, 0, 0, 25%); - --ant-color-fill: rgba(0, 0, 0, 15%); + --ant-color-fill: rgba(223, 168, 168, 15%); --ant-color-fill-secondary: rgba(0, 0, 0, 6%); --ant-color-fill-tertiary: rgba(0, 0, 0, 4%); --ant-color-fill-quaternary: rgba(0, 0, 0, 2%); @@ -21,11 +21,12 @@ html { --color-logs-text: #d4d4d4; --layout-content-blockpadding: 32px; --layout-content-inlinepadding: 32px; - --menu-border-radius-base: 6px; - --border-radius-base: 6px; + --border-radius-modal: 6px; + --menu-border-radius-base: 4px; + --border-radius-base: 4px; --border-radius-middle: 20px; - --border-radius-small: 6px; - --border-radius-mdium: 6px; + --border-radius-small: 4px; + --border-radius-mdium: 4px; --border-radius-mini: 4px; --color-white-1: rgba(255, 255, 255, 100%); --color-fill-sider: #f4f5f4; @@ -39,11 +40,11 @@ html { --font-size-base: 12px; --font-size-large: 16px; --font-size-middle: 14px; - --table-td-radius: 6px; - --checkbox-border-radius: 4px; + --table-td-radius: 4px; + --checkbox-border-radius: 2px; --ant-table-cell-padding-inline: 16px; --ant-table-cell-padding-block: 6px; - --ant-table-header-border-radius: 6px; + --ant-table-header-border-radius: 4px; --ant-table-header-split-color: #f0f0f0; --ant-table-row-selected-bg: #e6f6ff; --ant-table-row-selected-hover-bg: #e6f6ff; @@ -59,7 +60,7 @@ html { --ant-input-active-border-color: #007bff; --ant-input-hover-border-color: #2997ff; --box-shadow-base: 0 4px 6px rgba(227, 232, 240, 70%); - --ant-border-radius-lg: 6px; + --ant-border-radius-lg: 4px; --ant-menu-item-color: var(--color-text-1); --color-selected-bg: rgba(230, 230, 230, 88%); // --box-shadow-base: none; @@ -75,7 +76,7 @@ html { &.ant-menu-css-var { // --ant-menu-item-selected-bg: var(--color-white-1); - --ant-menu-item-border-radius: 6px; + --ant-menu-item-border-radius: 4px; --ant-menu-item-selected-color: var(--ant-color-primary); --ant-menu-item-color: var(--color-text-1); } @@ -92,7 +93,7 @@ html { --ant-font-size-xl: 20px; --ant-font-size: var(--font-size-base); --ant-padding-sm: 14px; - --ant-border-radius-lg: 6px; + --ant-border-radius-lg: 4px; --ant-color-text: #000; --ant-color-error: #ff4d4f; --ant-color-bg-mask: rgba(0, 0, 0, 35%); @@ -113,6 +114,10 @@ html { --ant-table-row-hover-bg: #e6e6e6; } + &.ant-progress { + --ant-progress-line-border-radius: 2px; + } + &.ant-modal-css-var { --ant-modal-title-font-size: 14px; --ant-modal-header-margin-bottom: 20px; @@ -126,7 +131,7 @@ html { .css-var-ri.ant-menu-css-var, .css-var-rh.ant-menu-css-var { --ant-menu-item-height: 46px; - --ant-menu-item-border-radius: 6px; + --ant-menu-item-border-radius: 4px; --ant-menu-item-selected-color: var(--ant-color-primary); --ant-menu-item-color: var(--color-text-1); --ant-menu-item-active-bg: rgba(0, 0, 0, 4%); @@ -148,6 +153,9 @@ html { body * { font-weight: var(--font-weight-normal); + font-family: 'noto sans', sans-serif; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; } body { @@ -305,7 +313,7 @@ body { .collapse-wrap { display: none; position: absolute; - top: 8px; + top: 12px; } &:hover { @@ -460,7 +468,29 @@ body { } // ======== monaco editor style ============ .monaco-editor { - border-radius: 16px; + border-radius: 8px; +} + +.custome-scrollbar { + &::-webkit-scrollbar { + width: 8px; + } + + &::-webkit-scrollbar-thumb { + background-color: transparent; + border-radius: 4px; + } + + &::-webkit-scrollbar-track { + background-color: transparent; + } + + &:hover { + &::-webkit-scrollbar-thumb { + background-color: var(--color-scrollbar-thumb); + border-radius: 4px; + } + } } .ant-message-notice-wrapper { diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index eba2a100..bac25311 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -23,7 +23,7 @@ import { } from '@umijs/max'; import { Button, Modal } from 'antd'; import { useAtom } from 'jotai'; -import { useMemo, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import Exception from './Exception'; import './Layout.css'; import { LogoIcon, SLogoIcon } from './Logo'; @@ -93,6 +93,7 @@ export default (props: any) => { const intl = useIntl(); const { clientRoutes, pluginManager } = useAppData(); const [collapsed, setCollapsed] = useState(false); + const [collapseValue, setCollapseValue] = useState(false); const initialInfo = (useModel && useModel('@@initialState')) || { initialState: undefined, @@ -167,6 +168,51 @@ export default (props: any) => { () => matchRoutes(route?.children || [], location.pathname)?.pop?.()?.route, [location.pathname] ); + + const renderMenuHeader = useCallback( + (logo, title) => { + return ( + <> + {logo} +
+ +
+ + ); + }, + [collapsed] + ); + + const actionRender = useCallback( + (layoutProps) => { + const dom = getRightRenderContent({ + runtimeConfig, + loading, + initialState, + setInitialState, + intl, + siderWidth: layoutProps.siderWidth, + collapsed: layoutProps.collapsed + }); + + return dom; + }, + [intl] + ); + return (
@@ -183,21 +229,7 @@ export default (props: any) => { e.preventDefault(); navigate('/'); }} - menuHeaderRender={(logo, title) => { - return ( - <> - {logo} -
- -
- - ); - }} + menuHeaderRender={renderMenuHeader} collapsed={collapsed} onPageChange={(route) => { const { location } = history; @@ -258,19 +290,7 @@ export default (props: any) => { fixSiderbar fixedHeader {...runtimeConfig} - actionsRender={(layoutProps) => { - const dom = getRightRenderContent({ - runtimeConfig, - loading, - initialState, - setInitialState, - intl, - siderWidth: layoutProps.siderWidth, - collapsed: layoutProps.collapsed - }); - - return dom; - }} + actionsRender={actionRender} > = ({ paddingInline: 'var(--ant-table-cell-padding-inline)' }} > - + {item.name} diff --git a/src/pages/login/components/styles.less b/src/pages/login/components/styles.less index a9347ea2..ad9f6c9a 100644 --- a/src/pages/login/components/styles.less +++ b/src/pages/login/components/styles.less @@ -1,6 +1,6 @@ :local(.login-form-wrapper) { margin: 0 auto; - border-radius: 8px; + border-radius: var(--border-radius-modal); width: max-content; height: max-content; padding: 32px; diff --git a/src/pages/playground/components/ground-left.tsx b/src/pages/playground/components/ground-left.tsx index a848d547..211566b2 100644 --- a/src/pages/playground/components/ground-left.tsx +++ b/src/pages/playground/components/ground-left.tsx @@ -1,9 +1,7 @@ -import HotKeys from '@/config/hotkeys'; import useContainerScroll from '@/hooks/use-container-scorll'; import { fetchChunkedData, readStreamData } from '@/utils/fetch-chunk-data'; -import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; import { useIntl, useSearchParams } from '@umijs/max'; -import { Button, Tooltip } from 'antd'; +import { Spin } from 'antd'; import classNames from 'classnames'; import _ from 'lodash'; import { @@ -14,7 +12,6 @@ import { useRef, useState } from 'react'; -import { useHotkeys } from 'react-hotkeys-hook'; import 'simplebar-react/dist/simplebar.min.css'; import { CHAT_API } from '../apis'; import { Roles } from '../config'; @@ -25,6 +22,7 @@ import MessageInput from './message-input'; import MessageContent from './multiple-chat/message-content'; import SystemMessage from './multiple-chat/system-message'; import ParamsSettings from './params-settings'; +import ReferenceParams from './reference-params'; import ViewCodeModal from './view-code-modal'; interface MessageProps { @@ -43,14 +41,12 @@ const GroundLeft: React.FC = forwardRef((props, ref) => { const selectModel = searchParams.get('model') || ''; const [parameters, setParams] = useState({}); const [systemMessage, setSystemMessage] = useState(''); - const [collapsed, setCollapsed] = useState(true); const [show, setShow] = useState(false); const [loading, setLoading] = useState(false); const [activeIndex, setActiveIndex] = useState(-1); const [tokenResult, setTokenResult] = useState(null); const [currentIsFocus, setCurrentIsFocus] = useState(false); const [collapse, setCollapse] = useState(false); - const systemRef = useRef(null); const contentRef = useRef(''); const controllerRef = useRef(null); const scroller = useRef(null); @@ -81,9 +77,6 @@ const GroundLeft: React.FC = forwardRef((props, ref) => { } }; }); - const handleSystemMessageChange = (e: any) => { - setSystemMessage(e.target.value); - }; const setMessageId = () => { messageId.current = messageId.current + 1; @@ -223,10 +216,7 @@ const GroundLeft: React.FC = forwardRef((props, ref) => { } setMessageId(); setMessageList([]); - }; - - const handleView = () => { - setShow(true); + setTokenResult(null); }; const handleSendMessage = (message: { role: string; content: string }) => { @@ -235,53 +225,10 @@ const GroundLeft: React.FC = forwardRef((props, ref) => { submitMessage(currentMessage); }; - const handleSubmit = () => { - submitMessage(); - }; - const handleCloseViewCode = () => { setShow(false); }; - const handleDelete = (index: number) => { - messageList.splice(index, 1); - setMessageList([...messageList]); - }; - - const handleUpdateMessage = (index: number, message: MessageItem) => { - messageList[index] = message; - setMessageList([...messageList]); - }; - - const renderLabel = () => { - return ( -
- - {intl.formatMessage({ id: 'playground.system' })} - - - - -
- ); - }; - - const handleFocus = () => { - setCurrentIsFocus(true); - }; - - const handleBlur = () => { - setCurrentIsFocus(false); - }; - const handleSelectModel = () => {}; const handlePresetPrompt = (list: { role: string; content: string }[]) => { @@ -299,95 +246,30 @@ const GroundLeft: React.FC = forwardRef((props, ref) => { setMessageList(userMsg); }; - useHotkeys( - HotKeys.SUBMIT, - () => { - handleSubmit(); - }, - { - enabled: currentIsFocus && !loading, - enableOnFormTags: currentIsFocus && !loading, - preventDefault: true - } - ); - - useHotkeys( - HotKeys.CREATE.join(','), - () => { - handleNewMessage(); - }, - { - enabled: !loading, - enableOnFormTags: !loading, - preventDefault: true - } - ); - - useHotkeys( - HotKeys.CLEAR.join(','), - () => { - handleClear(); - }, - { - enabled: !loading, - enableOnFormTags: !loading, - preventDefault: true - } - ); - return (
-
+
- {/* - - */}
- {/* {messageList.map((item, index) => { - return ( - handleDelete(index)} - updateMessage={(message: MessageItem) => - handleUpdateMessage(index, message) - } - onSubmit={handleSubmit} - message={item} - /> - ); - })} */} = forwardRef((props, ref) => { editable={true} loading={loading} /> - {/* {loading && ( - -
-
- )} */} + {loading && ( + +
+
+ )}
+ {tokenResult && ( +
+ +
+ )}
= ({ @@ -91,19 +92,26 @@ const MessageInput: React.FC = ({ modelList, showModelSelection, disabled, - isEmpty + isEmpty, + scope }) => { const { TextArea } = Input; const intl = useIntl(); const platform = platformCall(); // const [disabled, setDisabled] = useState(false); const [open, setOpen] = useState(false); + const [focused, setFocused] = useState(false); const [message, setMessage] = useState({ role: Roles.User, content: '', imgs: [] }); const imgCountRef = useRef(0); + const inputRef = useRef(null); + + const isDisabled = useMemo(() => { + return disabled ? true : !message.content && isEmpty; + }, [disabled, message.content, isEmpty]); const resetMessage = () => { setMessage({ @@ -162,7 +170,7 @@ const MessageInput: React.FC = ({ }; const handleAddMessage = () => { - console.log('add message'); + console.log('add message=====1'); addMessage({ ...message }); resetMessage(); }; @@ -279,12 +287,42 @@ const MessageInput: React.FC = ({ ); useHotkeys( - HotKeys.SUBMIT.join(','), + HotKeys.SUBMIT, () => { console.log('submit message', loading); + inputRef.current?.blur?.(); handleSendMessage(); }, - { enabled: true } + { + enabled: !loading && !isDisabled, + enableOnFormTags: focused, + preventDefault: true + } + ); + useHotkeys( + HotKeys.ADD, + (e: any) => { + e.preventDefault(); + e.stopPropagation(); + console.log('add message', loading); + inputRef.current?.blur?.(); + handleAddMessage(); + }, + { + enabled: !loading, + enableOnFormTags: focused, + preventDefault: true + } + ); + + useHotkeys( + HotKeys.FOCUS, + () => { + inputRef.current?.focus?.({ + cursor: 'end' + }); + }, + { preventDefault: true } ); return ( @@ -357,37 +395,46 @@ const MessageInput: React.FC = ({ > )} - - {!loading ? ( - + + {!loading ? ( + + [{KeyMap.SUBMIT.textKeybinding}]{' '} + {intl.formatMessage({ id: 'common.button.submit' })} + + } + > + + ) : ( )}
@@ -396,16 +443,25 @@ const MessageInput: React.FC = ({ dataList={message.imgs || []} onDelete={handleDeleteImg} > - +
+ + {!message.content && !focused && ( + + Type / to input message + + )} +
setOpen(false)} diff --git a/src/pages/playground/components/multiple-chat/content-item.tsx b/src/pages/playground/components/multiple-chat/content-item.tsx index 1cc85782..d8af5956 100644 --- a/src/pages/playground/components/multiple-chat/content-item.tsx +++ b/src/pages/playground/components/multiple-chat/content-item.tsx @@ -1,11 +1,10 @@ import CopyButton from '@/components/copy-button'; -import IconFont from '@/components/icon-font'; -import { CloseOutlined, SwapOutlined, UserOutlined } from '@ant-design/icons'; +import { MinusCircleOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; import { Button, Input, Tooltip } from 'antd'; import classNames from 'classnames'; import _ from 'lodash'; -import React, { useCallback, useRef, useState } from 'react'; +import React, { useCallback, useRef } from 'react'; import { Roles } from '../../config'; import { MessageItem } from '../../config/types'; import '../../style/content-item.less'; @@ -30,9 +29,6 @@ const ContentItem: React.FC = ({ const intl = useIntl(); const inputRef = useRef(null); const imgCountRef = useRef(0); - const [imgList, setImgList] = useState< - { uid: number | string; dataUrl: string }[] - >([]); const handleMessageChange = (e: any) => { updateMessage?.({ @@ -91,9 +87,7 @@ const ContentItem: React.FC = ({ dataUrl: img }; }); - // setImgList((pre) => { - // return [...pre, ...list]; - // }); + updateMessage?.({ role: data.role, content: data.content, @@ -124,9 +118,6 @@ const ContentItem: React.FC = ({ const handleUpdateImgList = useCallback( (list: { uid: number | string; dataUrl: string }[]) => { - // setImgList((preList) => { - // return [...preList, ...list]; - // }); console.log('list===========', data.imgs, list); updateMessage?.({ role: data.role, @@ -140,7 +131,6 @@ const ContentItem: React.FC = ({ const handleDeleteImg = (uid: number | string) => { const list = _.filter(data.imgs, (item: MessageItem) => item.uid !== uid); - // setImgList(list); updateMessage?.({ role: data.role, content: data.content, @@ -185,16 +175,8 @@ const ContentItem: React.FC = ({ return (
-
- - {Roles.User === data.role ? ( - - ) : ( - - )} - +
{intl.formatMessage({ id: `playground.${data.role}` })} -
{editable && ( @@ -215,7 +197,7 @@ const ContentItem: React.FC = ({ size="small" type="text" onClick={onDelete} - icon={} + icon={} > )} diff --git a/src/pages/playground/components/multiple-chat/index.tsx b/src/pages/playground/components/multiple-chat/index.tsx index 7ab38b98..22a44ae1 100644 --- a/src/pages/playground/components/multiple-chat/index.tsx +++ b/src/pages/playground/components/multiple-chat/index.tsx @@ -242,6 +242,7 @@ const MultiCompare: React.FC = ({ modelList }) => {
= forwardRef( const submitMessage = async (currentParams: { parameters: Record; - currentMessage: { role: string; content: string }; + currentMessage: Omit; }) => { console.log('currentMessage==========3', currentParams); const { parameters, currentMessage } = currentParams; @@ -278,17 +278,14 @@ const ModelItem: React.FC = forwardRef( const handlePresetMessageList = (list: MessageItem[]) => { currentMessageRef.current = {} as MessageItem; - const messages = _.map( - list, - (item: { role: string; content: string }) => { - setMessageId(); - return { - role: item.role, - content: item.content, - uid: messageId.current - }; - } - ); + const messages = _.map(list, (item: Omit) => { + setMessageId(); + return { + role: item.role, + content: item.content, + uid: messageId.current + }; + }); setTokenResult(null); setMessageList(messages); }; diff --git a/src/pages/playground/components/multiple-chat/system-message.tsx b/src/pages/playground/components/multiple-chat/system-message.tsx index 02e14651..0d9aafd8 100644 --- a/src/pages/playground/components/multiple-chat/system-message.tsx +++ b/src/pages/playground/components/multiple-chat/system-message.tsx @@ -1,15 +1,18 @@ import { CloseOutlined } from '@ant-design/icons'; -import { Button, Divider, Input } from 'antd'; +import { useIntl } from '@umijs/max'; +import { Button, Divider, Input, Tooltip } from 'antd'; import React, { useState } from 'react'; import '../../style/sys-message.less'; interface SystemMessageProps { + style?: React.CSSProperties; systemMessage: string; setSystemMessage: (value: string) => void; } const SystemMessage: React.FC = (props) => { - const { systemMessage, setSystemMessage } = props; + const { systemMessage, setSystemMessage, style } = props; + const intl = useIntl(); const systemMessageRef = React.useRef(null); const [autoSize, setAutoSize] = useState<{ minRows: number; @@ -43,13 +46,16 @@ const SystemMessage: React.FC = (props) => { }; return ( -
+
{
+ + {intl.formatMessage({ id: 'playground.systemMessage' })} + = (props) => { {!autoSize.focus && (
+ + {intl.formatMessage({ id: 'playground.systemMessage' })} + {systemMessage || ( - Type system message here + {intl.formatMessage({ id: 'playground.system.tips' })} )}
{systemMessage && ( - + + + )}
)} diff --git a/src/pages/playground/components/thumb-img.tsx b/src/pages/playground/components/thumb-img.tsx index faa64740..c06b599c 100644 --- a/src/pages/playground/components/thumb-img.tsx +++ b/src/pages/playground/components/thumb-img.tsx @@ -1,4 +1,4 @@ -import { CloseCircleOutlined } from '@ant-design/icons'; +import { CloseCircleOutlined, EyeOutlined } from '@ant-design/icons'; import { Image } from 'antd'; import _ from 'lodash'; import React, { useCallback } from 'react'; @@ -25,7 +25,14 @@ const ThumbImg: React.FC<{ return ( - + + }} + /> handleOnDelete(item.uid)}> diff --git a/src/pages/playground/index.tsx b/src/pages/playground/index.tsx index 678f4d78..fe59c941 100644 --- a/src/pages/playground/index.tsx +++ b/src/pages/playground/index.tsx @@ -109,9 +109,7 @@ const Playground: React.FC = () => { useHotkeys( HotKeys.RIGHT.join(','), () => { - setCollapse((pre) => { - return !pre; - }); + groundLeftRef.current?.setCollapse?.(); }, { preventDefault: true @@ -136,7 +134,8 @@ const Playground: React.FC = () => { }} extra={renderExtra()} className={classNames('playground-container', { - compare: activeKey === 'compare' + compare: activeKey === 'compare', + chat: activeKey === 'chat' })} >
diff --git a/src/pages/playground/style/content-item.less b/src/pages/playground/style/content-item.less index 7e9554e4..406b94a0 100644 --- a/src/pages/playground/style/content-item.less +++ b/src/pages/playground/style/content-item.less @@ -15,10 +15,6 @@ cursor: pointer; padding: 2px 4px; border-radius: var(--border-radius-mini); - - &:hover { - background-color: var(--ant-color-fill-secondary); - } } .actions { diff --git a/src/pages/playground/style/ground-left.less b/src/pages/playground/style/ground-left.less index a3fa17a3..62cd94a7 100644 --- a/src/pages/playground/style/ground-left.less +++ b/src/pages/playground/style/ground-left.less @@ -7,6 +7,7 @@ border-left: 1px solid var(--ant-color-split); transition: width 0.3s ease; height: calc(100vh - 72px); + padding-top: 16px; overflow-y: auto; .box { @@ -42,6 +43,7 @@ flex-direction: column; padding-inline: var(--layout-content-inlinepadding); overflow-y: auto; + padding-top: 16px; .content { flex: 1; diff --git a/src/pages/playground/style/message-input.less b/src/pages/playground/style/message-input.less index 889ccffb..8bc4965f 100644 --- a/src/pages/playground/style/message-input.less +++ b/src/pages/playground/style/message-input.less @@ -68,4 +68,24 @@ justify-content: flex-end; } } + + .input-box { + width: 100%; + display: flex; + position: relative; + + .holder { + pointer-events: none; + position: absolute; + top: 0; + left: 6px; + color: var(--ant-color-text-quaternary); + + kbd { + border: 1px solid var(--ant-color-border); + border-radius: 3px; + padding: 0 2px; + } + } + } } diff --git a/src/pages/playground/style/play-ground.less b/src/pages/playground/style/play-ground.less index bd01b7da..79b0693f 100644 --- a/src/pages/playground/style/play-ground.less +++ b/src/pages/playground/style/play-ground.less @@ -78,6 +78,25 @@ padding-block: 0; } + .ant-page-header { + position: relative; + height: 72px; + } + + &.chat { + .ant-page-header { + &::after { + position: absolute; + content: ''; + left: 32px; + right: 32px; + bottom: 0; + height: 1px; + background-color: var(--ant-color-split); + } + } + } + &.compare { .ant-pro-page-container-children-container { padding-inline: 0; diff --git a/src/pages/playground/style/sys-message.less b/src/pages/playground/style/sys-message.less index 0482a738..26b599ac 100644 --- a/src/pages/playground/style/sys-message.less +++ b/src/pages/playground/style/sys-message.less @@ -24,12 +24,26 @@ top: 6px; } + .system-label { + font-weight: var(--font-weight-bold); + padding-left: 16px; + } + .sys-content { + flex: 1; height: 38px; + width: 300px; line-height: 18px; padding: 10px 14px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; + color: var(--ant-color-text-secondary); + + .title { + font-weight: var(--font-weight-bold); + padding-right: 10px; + color: var(--ant-color-text); + } } } diff --git a/src/pages/playground/style/thumb-img.less b/src/pages/playground/style/thumb-img.less index e2248495..ae2d9561 100644 --- a/src/pages/playground/style/thumb-img.less +++ b/src/pages/playground/style/thumb-img.less @@ -11,10 +11,6 @@ overflow: hidden; border-radius: var(--border-radius-base); cursor: pointer; - // background-position: center; - // background-size: cover; - // background-repeat: no-repeat; - // border: 1px solid var(--ant-color-border); } .del { @@ -26,12 +22,22 @@ background-color: var(--color-white-1); display: none; border-radius: 50%; + height: 16px; + width: 16px; overflow: hidden; + pointer-events: all; } &:hover { + .ant-image .ant-image-mask { + opacity: 1; + transition: opacity var(--ant-motion-duration-slow); + } + .del { - display: block; + display: flex; + justify-content: center; + align-items: center; } } }