Commit 3671e550 by Archer Committed by GitHub

4.8.10 test (#2618)

* perf: menu arrow ui

* perf: http node placeholder

* perf: http node form input

* perf: chatBox performance
parent 3bcc3430
......@@ -49,7 +49,7 @@ const Markdown = ({
const formatSource = useMemo(() => {
const formatSource = source
.replace(
/([\u4e00-\u9fa5\u3000-\u303f])([\w\u0020-\u007e])|([a-zA-Z0-9\u0020-\u007e])([\u4e00-\u9fa5\u3000-\u303f])/g,
/([\u4e00-\u9fa5\u3000-\u303f])([a-zA-Z0-9])|([a-zA-Z0-9])([\u4e00-\u9fa5\u3000-\u303f])/g,
'$1$3 $2$4'
) // Chinese and english chars separated by space
.replace(/\n*(\[QUOTE SIGN\]\(.*\))/g, '$1');
......
......@@ -9,11 +9,13 @@ import { formatChatValue2InputType } from '../utils';
import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
import { ChatBoxContext } from '../Provider';
import { useContextSelector } from 'use-context-selector';
import { SendPromptFnType } from '../type';
export type ChatControllerProps = {
isLastChild: boolean;
chat: ChatSiteItemType;
showVoiceIcon?: boolean;
onSendMessage: SendPromptFnType;
onRetry?: () => void;
onDelete?: () => void;
onMark?: () => void;
......@@ -25,7 +27,6 @@ export type ChatControllerProps = {
const ChatController = ({
chat,
isLastChild,
showVoiceIcon,
onReadUserDislike,
onCloseUserLike,
......
......@@ -217,8 +217,8 @@ function ExportPopover({
return (
<MyPopover
placement={'right-start'}
offset={[-5, 5]}
hasArrow={false}
offset={[0, 0]}
hasArrow
trigger={'hover'}
w={'8.6rem'}
Trigger={
......
......@@ -448,20 +448,16 @@ const RenderForm = ({
setList((prevList) => {
if (!newKey) {
setUpdateTrigger((prev) => !prev);
toast({
status: 'warning',
title: t('common:core.module.http.Key cannot be empty')
});
return prevList;
}
const checkExist = prevList.find((item, i) => i !== index && item.key == newKey);
if (checkExist) {
// toast({
// status: 'warning',
// title: t('common:core.module.http.Key cannot be empty')
// });
} else if (prevList.find((item, i) => i !== index && item.key == newKey)) {
setUpdateTrigger((prev) => !prev);
toast({
status: 'warning',
title: t('common:core.module.http.Key already exists')
});
return prevList;
}
return prevList.map((item, i) => (i === index ? { ...item, key: newKey } : item));
});
......@@ -470,14 +466,15 @@ const RenderForm = ({
[t, toast]
);
// Add new params/headers key
const handleAddNewProps = useCallback(
(key: string, value: string = '') => {
(value: string) => {
setList((prevList) => {
if (!key) {
if (!value) {
return prevList;
}
const checkExist = prevList.find((item) => item.key === key);
const checkExist = prevList.find((item) => item.key === value);
if (checkExist) {
setUpdateTrigger((prev) => !prev);
toast({
......@@ -486,7 +483,7 @@ const RenderForm = ({
});
return prevList;
}
return [...prevList, { key, type: 'string', value }];
return [...prevList, { key: value, type: 'string', value: '' }];
});
setShouldUpdateNode(true);
......@@ -520,17 +517,15 @@ const RenderForm = ({
<Tr key={`${input.key}${index}`}>
<Td p={0} w={'50%'} borderRight={'1px solid'} borderColor={'myGray.200'}>
<HttpInput
placeholder={
index !== list.length
? t('common:core.module.http.Props name_and_tips')
: t('common:core.module.http.Add props_and_tips')
}
placeholder={t('common:textarea_variable_picker_tip')}
value={item.key}
variableLabels={variables}
variables={variables}
onBlur={(val) => {
handleKeyChange(index, val);
if (index === list.length) {
// Last item blur, add the next item.
if (index === list.length && val) {
handleAddNewProps(val);
setUpdateTrigger((prev) => !prev);
}
......@@ -541,11 +536,7 @@ const RenderForm = ({
<Td p={0} w={'50%'}>
<Box display={'flex'} alignItems={'center'}>
<HttpInput
placeholder={
index !== list.length
? t('common:core.module.http.Props value_and_tips')
: ''
}
placeholder={t('common:textarea_variable_picker_tip')}
value={item.value}
variables={variables}
variableLabels={variables}
......@@ -694,6 +685,7 @@ const RenderBody = ({
{(typeInput?.value === ContentTypes.xml || typeInput?.value === ContentTypes.raw) && (
<PromptEditor
value={jsonBody.value}
placeholder={t('common:textarea_variable_picker_tip')}
onChange={(e) => {
startSts(() => {
onChangeNode({
......
......@@ -204,7 +204,6 @@ const InputDataModal = ({
a: '',
indexes: []
});
console.log('执行onSuccess');
onSuccess(e);
},
errorToast: t('common:common.error.unKnow')
......
......@@ -17,6 +17,8 @@ export const useCopyData = () => {
title: string | null = t('common:common.Copy Successful'),
duration = 1000
) => {
data = data.trim();
try {
if ((hasHttps() || !isProduction) && navigator.clipboard) {
await navigator.clipboard.writeText(data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment