feat: 聊天页优化 — 欢迎页、标题自动生成、消息操作
This commit is contained in:
68
src/web/consoles/workbench/components/chat/ChatInputArea.tsx
Normal file
68
src/web/consoles/workbench/components/chat/ChatInputArea.tsx
Normal file
@@ -0,0 +1,68 @@
|
||||
import { Button, Flex, Input, Select } from "antd";
|
||||
|
||||
interface ChatInputAreaProps {
|
||||
displayModelId: null | string;
|
||||
input: string;
|
||||
isLoading: boolean;
|
||||
modelOptions: Array<{ label: string; value: string }>;
|
||||
onInputChange: (value: string) => void;
|
||||
onModelChange: (value: string) => void;
|
||||
onSend: () => void;
|
||||
onStop: () => void;
|
||||
}
|
||||
|
||||
export function ChatInputArea({
|
||||
displayModelId,
|
||||
input,
|
||||
isLoading,
|
||||
modelOptions,
|
||||
onInputChange,
|
||||
onModelChange,
|
||||
onSend,
|
||||
onStop,
|
||||
}: ChatInputAreaProps) {
|
||||
return (
|
||||
<div className="chat-input-area">
|
||||
<Input.TextArea
|
||||
autoSize={{ maxRows: 6, minRows: 1 }}
|
||||
className="chat-textarea"
|
||||
disabled={isLoading}
|
||||
onChange={(e) => onInputChange(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
void onSend();
|
||||
}
|
||||
}}
|
||||
placeholder="输入消息..."
|
||||
value={input}
|
||||
/>
|
||||
<Flex align="center" gap={8} justify="space-between">
|
||||
<Select
|
||||
className="chat-model-select"
|
||||
disabled={isLoading}
|
||||
onChange={onModelChange}
|
||||
options={modelOptions}
|
||||
placeholder="选择模型"
|
||||
value={displayModelId}
|
||||
/>
|
||||
<Flex align="center" gap={8}>
|
||||
{isLoading ? (
|
||||
<Button
|
||||
danger
|
||||
onClick={() => {
|
||||
onStop?.();
|
||||
}}
|
||||
>
|
||||
停止
|
||||
</Button>
|
||||
) : (
|
||||
<Button onClick={() => void onSend()} type="primary">
|
||||
发送
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
</Flex>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user