(feature)(webapp) use nativeQuery field to determine whether it is a selection (#222)

This commit is contained in:
williamhliu
2023-10-14 16:37:28 +08:00
committed by GitHub
parent d9efe8f137
commit fdf48d7bfd
16 changed files with 63 additions and 38 deletions

View File

@@ -2,7 +2,6 @@ import { Form, Input, Modal } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { updateConversationName } from '../../service';
import type { ConversationDetailType } from '../../type';
import { CHAT_TITLE } from '../../constants';
const FormItem = Form.Item;
@@ -44,7 +43,7 @@ const ConversationModal: React.FC<Props> = ({ visible, editConversation, onClose
return (
<Modal
title={`修改${CHAT_TITLE}问答名称`}
title="修改问答名称"
open={visible}
onCancel={onClose}
onOk={onConfirm}
@@ -53,7 +52,7 @@ const ConversationModal: React.FC<Props> = ({ visible, editConversation, onClose
<Form {...layout} form={form}>
<FormItem name="conversationName" label="名称" rules={[{ required: true }]}>
<Input
placeholder={`请输入${CHAT_TITLE}问答名称`}
placeholder="请输入问答名称"
ref={conversationNameInputRef}
onPressEnter={onConfirm}
/>

View File

@@ -4,6 +4,7 @@ import classNames from 'classnames';
import LeftAvatar from './CopilotAvatar';
import Message from './Message';
import styles from './style.module.less';
import { userAvatarUrl } from '../../common/env';
type Props = {
position: 'left' | 'right';
@@ -15,6 +16,7 @@ const Text: React.FC<Props> = ({ position, data, quote }) => {
const textWrapperClass = classNames(styles.textWrapper, {
[styles.rightTextWrapper]: position === 'right',
});
const rightAvatarUrl = userAvatarUrl;
return (
<div className={textWrapperClass}>
{!isMobile && position === 'left' && <LeftAvatar />}
@@ -22,6 +24,9 @@ const Text: React.FC<Props> = ({ position, data, quote }) => {
{position === 'right' && quote && <div className={styles.quote}>{quote}</div>}
<div className={styles.text}>{data}</div>
</Message>
{!isMobile && position === 'right' && rightAvatarUrl && (
<Avatar shape="circle" size={40} src={rightAvatarUrl} className={styles.rightAvatar} />
)}
</div>
);
};

View File

@@ -43,16 +43,8 @@ export const AGENT_ICONS = [
export const HOLDER_TAG = '@_supersonic_@';
export const CHAT_TITLE = '';
export const DEFAULT_CONVERSATION_NAME = '新问答对话';
export const PAGE_TITLE = '问答对话';
export const WEB_TITLE = '问答对话';
export const MOBILE_TITLE = '问答对话';
export const PLACE_HOLDER = '请输入您的问题,或输入“/”切换助理';
export const SIMPLE_PLACE_HOLDER = '请输入您的问题';

View File

@@ -15,7 +15,6 @@ import { useThrottleFn } from 'ahooks';
import Conversation from './Conversation';
import ChatFooter from './ChatFooter';
import classNames from 'classnames';
import { CHAT_TITLE } from './constants';
import { cloneDeep } from 'lodash';
import AgentList from './AgentList';
import MobileAgents from './MobileAgents';
@@ -59,7 +58,7 @@ const Chat: ForwardRefRenderFunction<any, Props> = (
const [historyInited, setHistoryInited] = useState(false);
const [currentConversation, setCurrentConversation] = useState<
ConversationDetailType | undefined
>(isMobile ? { chatId: 0, chatName: `${CHAT_TITLE}问答` } : undefined);
>(isMobile ? { chatId: 0, chatName: '问答' } : undefined);
const [historyVisible, setHistoryVisible] = useState(false);
const [agentList, setAgentList] = useState<AgentType[]>([]);
const [currentAgent, setCurrentAgent] = useState<AgentType>();