|
@@ -37,6 +37,7 @@ import AutoIcon from "../icons/auto.svg";
|
|
|
import BottomIcon from "../icons/bottom.svg";
|
|
import BottomIcon from "../icons/bottom.svg";
|
|
|
import StopIcon from "../icons/pause.svg";
|
|
import StopIcon from "../icons/pause.svg";
|
|
|
import RobotIcon from "../icons/robot.svg";
|
|
import RobotIcon from "../icons/robot.svg";
|
|
|
|
|
+import AddIcon from "../icons/add.svg";
|
|
|
import SizeIcon from "../icons/size.svg";
|
|
import SizeIcon from "../icons/size.svg";
|
|
|
import PluginIcon from "../icons/plugin.svg";
|
|
import PluginIcon from "../icons/plugin.svg";
|
|
|
|
|
|
|
@@ -174,7 +175,8 @@ export function SessionConfigModel(props: { onClose: () => void }) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 提示词
|
|
// 提示词
|
|
|
-const CallWord: React.FC = () => {
|
|
|
|
|
|
|
+const CallWord = (props: { setUserInput: (value: string) => void }) => {
|
|
|
|
|
+ const { setUserInput } = props
|
|
|
const list = [
|
|
const list = [
|
|
|
{
|
|
{
|
|
|
title: '信息公布',
|
|
title: '信息公布',
|
|
@@ -222,7 +224,7 @@ const CallWord: React.FC = () => {
|
|
|
fontSize: 12
|
|
fontSize: 12
|
|
|
}}
|
|
}}
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
-
|
|
|
|
|
|
|
+ setUserInput(item.text)
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
{item.title}
|
|
{item.title}
|
|
@@ -485,6 +487,7 @@ function useScrollToBottom(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function ChatActions(props: {
|
|
export function ChatActions(props: {
|
|
|
|
|
+ setUserInput: (value: string) => void;
|
|
|
uploadImage: () => void;
|
|
uploadImage: () => void;
|
|
|
setAttachImages: (images: string[]) => void;
|
|
setAttachImages: (images: string[]) => void;
|
|
|
setUploading: (uploading: boolean) => void;
|
|
setUploading: (uploading: boolean) => void;
|
|
@@ -578,13 +581,13 @@ export function ChatActions(props: {
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={styles["chat-input-actions"]}>
|
|
<div className={styles["chat-input-actions"]}>
|
|
|
- {couldStop && (
|
|
|
|
|
|
|
+ {/* {couldStop && (
|
|
|
<ChatAction
|
|
<ChatAction
|
|
|
onClick={stopAll}
|
|
onClick={stopAll}
|
|
|
text={Locale.Chat.InputActions.Stop}
|
|
text={Locale.Chat.InputActions.Stop}
|
|
|
icon={<StopIcon />}
|
|
icon={<StopIcon />}
|
|
|
/>
|
|
/>
|
|
|
- )}
|
|
|
|
|
|
|
+ )} */}
|
|
|
|
|
|
|
|
{!props.hitBottom && (
|
|
{!props.hitBottom && (
|
|
|
<ChatAction
|
|
<ChatAction
|
|
@@ -594,12 +597,6 @@ export function ChatActions(props: {
|
|
|
/>
|
|
/>
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
|
- <ChatAction
|
|
|
|
|
- onClick={() => { }}
|
|
|
|
|
- text='新建对话'
|
|
|
|
|
- icon={<RobotIcon />}
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
{/* {props.hitBottom && (
|
|
{/* {props.hitBottom && (
|
|
|
<ChatAction
|
|
<ChatAction
|
|
|
onClick={props.showPromptModal}
|
|
onClick={props.showPromptModal}
|
|
@@ -632,13 +629,13 @@ export function ChatActions(props: {
|
|
|
}
|
|
}
|
|
|
/> */}
|
|
/> */}
|
|
|
|
|
|
|
|
- <CallWord />
|
|
|
|
|
|
|
+ <CallWord setUserInput={props.setUserInput} />
|
|
|
|
|
|
|
|
- <ChatAction
|
|
|
|
|
|
|
+ {/* <ChatAction
|
|
|
onClick={props.showPromptHints}
|
|
onClick={props.showPromptHints}
|
|
|
text={Locale.Chat.InputActions.Prompt}
|
|
text={Locale.Chat.InputActions.Prompt}
|
|
|
icon={<PromptIcon />}
|
|
icon={<PromptIcon />}
|
|
|
- />
|
|
|
|
|
|
|
+ /> */}
|
|
|
|
|
|
|
|
{/* <ChatAction
|
|
{/* <ChatAction
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
@@ -1003,7 +1000,6 @@ function _Chat() {
|
|
|
|
|
|
|
|
// check if should send message
|
|
// check if should send message
|
|
|
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
|
- // if ArrowUp and no userInput, fill with last input
|
|
|
|
|
if (
|
|
if (
|
|
|
e.key === "ArrowUp" &&
|
|
e.key === "ArrowUp" &&
|
|
|
userInput.length <= 0 &&
|
|
userInput.length <= 0 &&
|
|
@@ -1018,6 +1014,7 @@ function _Chat() {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
const onRightClick = (e: any, message: ChatMessage) => {
|
|
const onRightClick = (e: any, message: ChatMessage) => {
|
|
|
// copy to clipboard
|
|
// copy to clipboard
|
|
|
if (selectOrCopy(e.currentTarget, getMessageTextContent(message))) {
|
|
if (selectOrCopy(e.currentTarget, getMessageTextContent(message))) {
|
|
@@ -1378,7 +1375,7 @@ function _Chat() {
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.chat} key={session.id}>
|
|
<div className={styles.chat} key={session.id}>
|
|
|
<div className="window-header" data-tauri-drag-region>
|
|
<div className="window-header" data-tauri-drag-region>
|
|
|
- {isMobileScreen && (
|
|
|
|
|
|
|
+ {/* {isMobileScreen && (
|
|
|
<div className="window-actions">
|
|
<div className="window-actions">
|
|
|
<div className={"window-action-button"}>
|
|
<div className={"window-action-button"}>
|
|
|
<IconButton
|
|
<IconButton
|
|
@@ -1389,12 +1386,12 @@ function _Chat() {
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- )}
|
|
|
|
|
|
|
+ )} */}
|
|
|
|
|
|
|
|
<div className={`window-header-title ${styles["chat-body-title"]}`}>
|
|
<div className={`window-header-title ${styles["chat-body-title"]}`}>
|
|
|
<div
|
|
<div
|
|
|
className={`window-header-main-title ${styles["chat-body-main-title"]}`}
|
|
className={`window-header-main-title ${styles["chat-body-main-title"]}`}
|
|
|
- onClickCapture={() => setIsEditingMessage(true)}
|
|
|
|
|
|
|
+ // onClickCapture={() => setIsEditingMessage(true)}
|
|
|
>
|
|
>
|
|
|
建科招聘智能助理
|
|
建科招聘智能助理
|
|
|
</div>
|
|
</div>
|
|
@@ -1403,6 +1400,16 @@ function _Chat() {
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="window-actions">
|
|
<div className="window-actions">
|
|
|
|
|
+ <IconButton
|
|
|
|
|
+ icon={<AddIcon />}
|
|
|
|
|
+ bordered
|
|
|
|
|
+ title='新建对话'
|
|
|
|
|
+ aria='新建对话'
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ localStorage.clear()
|
|
|
|
|
+ location.reload()
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
{/* {!isMobileScreen && (
|
|
{/* {!isMobileScreen && (
|
|
|
<div className="window-action-button">
|
|
<div className="window-action-button">
|
|
|
<IconButton
|
|
<IconButton
|
|
@@ -1424,7 +1431,7 @@ function _Chat() {
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
</div> */}
|
|
</div> */}
|
|
|
- {showMaxIcon && (
|
|
|
|
|
|
|
+ {/* {showMaxIcon && (
|
|
|
<div className="window-action-button">
|
|
<div className="window-action-button">
|
|
|
<IconButton
|
|
<IconButton
|
|
|
icon={config.tightBorder ? <MinIcon /> : <MaxIcon />}
|
|
icon={config.tightBorder ? <MinIcon /> : <MaxIcon />}
|
|
@@ -1438,7 +1445,7 @@ function _Chat() {
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
- )}
|
|
|
|
|
|
|
+ )} */}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
{/* <PromptToast
|
|
{/* <PromptToast
|
|
@@ -1516,7 +1523,22 @@ function _Chat() {
|
|
|
</div> */}
|
|
</div> */}
|
|
|
{isUser ? (
|
|
{isUser ? (
|
|
|
// 在这里换头像
|
|
// 在这里换头像
|
|
|
- <Avatar avatar={config.avatar} />
|
|
|
|
|
|
|
+ <div style={{ position: 'relative' }}>
|
|
|
|
|
+ <MaskAvatar
|
|
|
|
|
+ avatar={session.mask.avatar}
|
|
|
|
|
+ />
|
|
|
|
|
+ <div
|
|
|
|
|
+ style={{
|
|
|
|
|
+ position: 'absolute',
|
|
|
|
|
+ zIndex: 2,
|
|
|
|
|
+ top: '50%',
|
|
|
|
|
+ left: '50%',
|
|
|
|
|
+ transform: ' translate(-50%, -50%)',
|
|
|
|
|
+ fontSize: 14
|
|
|
|
|
+ }}>
|
|
|
|
|
+ 我
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
) : (
|
|
) : (
|
|
|
<>
|
|
<>
|
|
|
{["system"].includes(message.role) ? (
|
|
{["system"].includes(message.role) ? (
|
|
@@ -1532,7 +1554,7 @@ function _Chat() {
|
|
|
</>
|
|
</>
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
|
- {showActions && (
|
|
|
|
|
|
|
+ {/* {showActions && (
|
|
|
<div className={styles["chat-message-actions"]}>
|
|
<div className={styles["chat-message-actions"]}>
|
|
|
<div className={styles["chat-input-actions"]}>
|
|
<div className={styles["chat-input-actions"]}>
|
|
|
{message.streaming ? (
|
|
{message.streaming ? (
|
|
@@ -1573,7 +1595,7 @@ function _Chat() {
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- )}
|
|
|
|
|
|
|
+ )} */}
|
|
|
</div>
|
|
</div>
|
|
|
{showTyping && (
|
|
{showTyping && (
|
|
|
<div className={styles["chat-message-status"]}>
|
|
<div className={styles["chat-message-status"]}>
|
|
@@ -1589,7 +1611,7 @@ function _Chat() {
|
|
|
message.content.length === 0 &&
|
|
message.content.length === 0 &&
|
|
|
!isUser
|
|
!isUser
|
|
|
}
|
|
}
|
|
|
- onContextMenu={(e) => onRightClick(e, message)}
|
|
|
|
|
|
|
+ // onContextMenu={(e) => onRightClick(e, message)}
|
|
|
onDoubleClickCapture={() => {
|
|
onDoubleClickCapture={() => {
|
|
|
if (!isMobileScreen) return;
|
|
if (!isMobileScreen) return;
|
|
|
setUserInput(getMessageTextContent(message));
|
|
setUserInput(getMessageTextContent(message));
|
|
@@ -1644,9 +1666,10 @@ function _Chat() {
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles["chat-input-panel"]}>
|
|
<div className={styles["chat-input-panel"]}>
|
|
|
- <PromptHints prompts={promptHints} onPromptSelect={onPromptSelect} />
|
|
|
|
|
|
|
+ {/* <PromptHints prompts={promptHints} onPromptSelect={onPromptSelect} /> */}
|
|
|
|
|
|
|
|
<ChatActions
|
|
<ChatActions
|
|
|
|
|
+ setUserInput={setUserInput}
|
|
|
uploadImage={uploadImage}
|
|
uploadImage={uploadImage}
|
|
|
setAttachImages={setAttachImages}
|
|
setAttachImages={setAttachImages}
|
|
|
setUploading={setUploading}
|
|
setUploading={setUploading}
|
|
@@ -1743,4 +1766,4 @@ export function Chat() {
|
|
|
const chatStore = useChatStore();
|
|
const chatStore = useChatStore();
|
|
|
const sessionIndex = chatStore.currentSessionIndex;
|
|
const sessionIndex = chatStore.currentSessionIndex;
|
|
|
return <_Chat key={sessionIndex}></_Chat>;
|
|
return <_Chat key={sessionIndex}></_Chat>;
|
|
|
-}
|
|
|
|
|
|
|
+}
|