fix(style): model status

This commit is contained in:
jialin
2024-07-08 19:47:47 +08:00
parent 9ad9539b51
commit 734368dd49
25 changed files with 109 additions and 83 deletions
@@ -1,9 +1,9 @@
import IconFont from '@/components/icon-font';
import HotKeys from '@/config/hotkeys';
import {
CodeOutlined,
DeleteOutlined,
EnterOutlined,
MacCommandOutlined,
PlusOutlined
} from '@ant-design/icons';
import { useIntl } from '@umijs/max';
@@ -74,7 +74,7 @@ const ChatFooter: React.FC<ChatFooterProps> = (props) => {
<Button disabled={disabled} type="primary" onClick={onSubmit}>
{intl.formatMessage({ id: 'common.button.submit' })}
<span className="m-l-5 opct-7">
<MacCommandOutlined /> + <EnterOutlined />
<IconFont type="icon-command"></IconFont> + <EnterOutlined />
</span>
</Button>
</Space>
@@ -85,6 +85,7 @@ const MessageList: React.FC<MessageProps> = (props) => {
uid: messageId.current
}
]);
console.log('messageList=====', messageList, messageId.current, chunk);
return false;
};
const submitMessage = async () => {
@@ -115,7 +116,6 @@ const MessageList: React.FC<MessageProps> = (props) => {
return;
}
const { reader, decoder } = result;
await readStreamData(reader, decoder, (chunk: any) => {
joinMessage(chunk);
});
@@ -207,7 +207,10 @@ const MessageList: React.FC<MessageProps> = (props) => {
autoSize={true}
onFocus={handleFocus}
onBlur={handleBlur}
placeholder={intl.formatMessage({ id: 'playground.system.tips' })}
style={{ minHeight: 40 }}
placeholder={intl.formatMessage({
id: 'playground.system.tips'
})}
onChange={handleSystemMessageChange}
></Input.TextArea>
</TransitionWrapper>
@@ -31,18 +31,6 @@ const MessageItem: React.FC<{
const [currentIsFocus, setCurrentIsFocus] = useState(isFocus);
const inputRef = useRef<any>(null);
useHotkeys(
HotKeys.SUBMIT,
() => {
onSubmit();
},
{
enabled: currentIsFocus && !loading,
enableOnFormTags: currentIsFocus && !loading,
preventDefault: true
}
);
useEffect(() => {
if (inputRef.current && isFocus) {
inputRef.current.focus();
@@ -110,6 +98,20 @@ const MessageItem: React.FC<{
const handleDelete = () => {
onDelete();
};
useHotkeys(
HotKeys.SUBMIT,
() => {
inputRef.current.blur();
onSubmit();
},
{
enabled: currentIsFocus,
enableOnFormTags: currentIsFocus,
preventDefault: true
}
);
return (
<div className="message-item">
<div className="role-type">
@@ -124,6 +126,7 @@ const MessageItem: React.FC<{
value={messageContent}
autoSize={true}
variant="filled"
readOnly={loading}
onChange={handleMessageChange}
onFocus={handleFocus}
onBlur={handleBlur}
@@ -116,6 +116,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
},
formatOnType: true,
formatOnPaste: true,
fontWeight: '700',
scrollbar: {
verticalSliderSize: 8
}
@@ -130,13 +131,13 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
<Modal
title={title}
open={open}
centered={true}
onCancel={handleClose}
destroyOnClose={true}
closeIcon={true}
maskClosable={false}
keyboard={false}
width={'max(50%, 600px)'}
style={{ top: '80px' }}
width={660}
footer={null}
>
<div style={{ marginBottom: '10px' }}>
@@ -151,7 +152,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
onChangeLang={handleOnChangeLang}
>
<Editor
height="500px"
height="min(500px, 90vh)"
theme="vs-dark"
className="monaco-editor"
defaultLanguage="shell"