22
33import React , { useState , useRef } from 'react' ;
44import { Button , Upload , message , Tooltip } from 'antd' ;
5- import { LoadingOutlined , CloseCircleFilled } from '@ant-design/icons' ;
5+ import { LoadingOutlined , CloseCircleFilled , CloseCircleOutlined } from '@ant-design/icons' ;
66import { createStyles } from 'antd-style' ;
77import type { UploadProps } from 'antd' ;
88import { ActionIcon } from '@lobehub/ui' ;
@@ -35,21 +35,21 @@ const useStyles = createStyles(({ css, token }) => ({
3535 box-shadow : 0 2px 6px rgba (0 , 0 , 0 , 0.1 );
3636 border : 1px solid ${ token . colorBorderSecondary } ;
3737 transition : transform 0.2s ease;
38-
38+
3939 & : hover {
4040 transform : scale (1.02 );
41-
41+
4242 .remove-button {
4343 opacity : 1 ;
4444 }
4545 }
46-
46+
4747 img {
4848 width : 100% ;
4949 height : 100% ;
5050 object-fit : cover;
5151 }
52-
52+
5353 .remove-button {
5454 position : absolute;
5555 top : 4px ;
@@ -65,7 +65,7 @@ const useStyles = createStyles(({ css, token }) => ({
6565 cursor : pointer;
6666 opacity : 0.7 ;
6767 transition : all 0.2s ease;
68-
68+
6969 & : hover {
7070 background : rgba (0 , 0 , 0 , 0.8 );
7171 opacity : 1 ;
@@ -81,13 +81,13 @@ const useStyles = createStyles(({ css, token }) => ({
8181 padding : ${ token . paddingSM } px ${ token . paddingMD } px;
8282 border-color : ${ token . colorBorderSecondary } ;
8383 transition : all 0.3s ;
84-
84+
8585 & : hover , & : focus {
8686 border-color : ${ token . colorPrimary } ;
8787 box-shadow : 0 0 0 2px rgba (24 , 144 , 255 , 0.1 );
8888 }
8989 }
90-
90+
9191 .ant-btn {
9292 border-radius : ${ token . borderRadiusLG } px;
9393 }
@@ -251,11 +251,15 @@ const ChatInput: React.FC<ChatInputProps> = ({
251251 onSend = { handleSend }
252252 disabled = { disabled }
253253 loading = { loading }
254- textAreaRightAddons = { < ChatInputArea . SendButton
255- icon = { < ArrowUp /> }
256- onSend = { handleSend }
257- onStop = { handleStop }
258- /> }
254+ textAreaRightAddons = {
255+ < ChatInputArea . SendButton
256+ disabled = { imageUploading || disabled }
257+ loading = { loading }
258+ icon = { < ArrowUp /> }
259+ onSend = { handleSend }
260+ onStop = { handleStop }
261+ />
262+ }
259263 topAddons = {
260264 < ChatInputActionBar
261265 leftAddons = {
@@ -284,9 +288,8 @@ const ChatInput: React.FC<ChatInputProps> = ({
284288 < Tooltip title = "清空消息" >
285289 < ActionIcon
286290 className = { styles . actionButton }
287- style = { {
291+ style = { {
288292 marginLeft : 'auto' ,
289- marginRight : '20px' ,
290293 color : 'red' ,
291294 } }
292295 icon = { < Trash2
@@ -295,6 +298,16 @@ const ChatInput: React.FC<ChatInputProps> = ({
295298 onClick = { onClear }
296299 />
297300 </ Tooltip >
301+ { loading && (
302+ < Tooltip title = "停止生成" >
303+ < ActionIcon
304+ className = { styles . actionButton }
305+ style = { { color : 'grey' } }
306+ icon = { < CloseCircleOutlined /> }
307+ onClick = { handleStop }
308+ />
309+ </ Tooltip >
310+ ) }
298311 </ >
299312 }
300313 />
0 commit comments