Add workflow rename; Fix: userselect chatId unrefresh (#2672)

* feat: workflow node support rename

* perf: push data to training queue

* fix: userselect chatId unrefresh
This commit is contained in:
Archer
2024-09-11 15:27:47 +08:00
committed by GitHub
parent 11cbcca2d4
commit 02bf400bf3
14 changed files with 144 additions and 188 deletions

View File

@@ -53,7 +53,6 @@ const NodePluginConfig = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
selected={selected}
menuForbid={{
debug: true,
rename: true,
copy: true,
delete: true
}}

View File

@@ -91,7 +91,6 @@ const NodePluginInput = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
minW={'300px'}
selected={selected}
menuForbid={{
rename: true,
copy: true,
delete: true
}}

View File

@@ -48,7 +48,6 @@ const NodePluginOutput = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
selected={selected}
menuForbid={{
debug: true,
rename: true,
copy: true,
delete: true
}}

View File

@@ -53,7 +53,6 @@ const NodeUserGuide = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
selected={selected}
menuForbid={{
debug: true,
rename: true,
copy: true,
delete: true
}}

View File

@@ -68,7 +68,6 @@ const NodeStart = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
minW={'240px'}
selected={selected}
menuForbid={{
rename: true,
copy: true,
delete: true
}}

View File

@@ -33,7 +33,6 @@ type Props = FlowNodeItemType & {
selected?: boolean;
menuForbid?: {
debug?: boolean;
rename?: boolean;
copy?: boolean;
delete?: boolean;
};
@@ -154,37 +153,35 @@ const NodeCard = (props: Props) => {
<Box ml={3} fontSize={'md'} fontWeight={'medium'}>
{t(name as any)}
</Box>
{!menuForbid?.rename && (
<MyIcon
className="controller-rename"
display={'none'}
name={'edit'}
w={'14px'}
cursor={'pointer'}
ml={1}
color={'myGray.500'}
_hover={{ color: 'primary.600' }}
onClick={() => {
onOpenCustomTitleModal({
defaultVal: name,
onSuccess: (e) => {
if (!e) {
return toast({
title: t('app:modules.Title is required'),
status: 'warning'
});
}
onChangeNode({
nodeId,
type: 'attr',
key: 'name',
value: e
<MyIcon
className="controller-rename"
display={'none'}
name={'edit'}
w={'14px'}
cursor={'pointer'}
ml={1}
color={'myGray.500'}
_hover={{ color: 'primary.600' }}
onClick={() => {
onOpenCustomTitleModal({
defaultVal: name,
onSuccess: (e) => {
if (!e) {
return toast({
title: t('app:modules.Title is required'),
status: 'warning'
});
}
});
}}
/>
)}
onChangeNode({
nodeId,
type: 'attr',
key: 'name',
value: e
});
}
});
}}
/>
<Box flex={1} />
{hasNewVersion && (
<MyTooltip label={t('app:app.modules.click to update')}>

View File

@@ -130,7 +130,6 @@ const Chat = ({
const completionChatId = chatId || getNanoid();
// Just send a user prompt
const histories = messages.slice(-1);
const { responseText, responseData } = await streamFetch({
data: {
messages: histories,
@@ -146,10 +145,8 @@ const Chat = ({
const newTitle = getChatTitleFromChatMessage(GPTMessages2Chats(histories)[0]);
// new chat
if (completionChatId !== chatId) {
if (controller.signal.reason !== 'leave') {
onChangeChatId(completionChatId, true);
}
if (completionChatId !== chatId && controller.signal.reason !== 'leave') {
onChangeChatId(completionChatId, true);
}
loadHistories();