fix: var render (#5857)

* fix: timeselector ui error

* var update node

* fix: var render

* fix: prompt editor

* perf: init

* fix: retry input

* fix: prompt editor

* fix: editor
This commit is contained in:
Archer
2025-11-04 22:15:47 +08:00
committed by GitHub
parent a499d05a02
commit 44e87e3053
15 changed files with 205 additions and 80 deletions

View File

@@ -651,11 +651,12 @@ const ChatBox = ({
// retry input
const onDelMessage = useCallback(
(contentId: string) => {
(contentId: string, delFile = true) => {
return delChatRecordById({
appId,
chatId,
contentId,
delFile,
...outLinkAuthData
});
},
@@ -672,7 +673,7 @@ const ChatBox = ({
await Promise.all(
delHistory.map((item) => {
if (item.dataId) {
return onDelMessage(item.dataId);
return onDelMessage(item.dataId, false);
}
})
);

View File

@@ -31,7 +31,8 @@ export const formatChatValue2InputType = (value?: ChatItemValueItemType[]): Chat
type: item.file.type,
name: item.file.name,
icon: getFileIcon(item.file.name),
url: item.file.url
url: item.file.url,
key: item.file.key
}
: undefined
)

View File

@@ -88,6 +88,7 @@ export type DeleteChatItemProps = OutLinkChatAuthProps & {
appId: string;
chatId: string;
contentId?: string;
delFile?: boolean;
};
export type AdminUpdateFeedbackParams = AdminFbkType & {

View File

@@ -34,6 +34,7 @@ import {
import { InputTypeEnum } from '@/components/core/app/formRender/constant';
import { WorkflowActionsContext } from '../../context/workflowActionsContext';
import { useMemoEnhance } from '@fastgpt/web/hooks/useMemoEnhance';
import { useMemoizedFn } from 'ahooks';
const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
const { inputs = [], nodeId } = data;
@@ -105,7 +106,7 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
[inputs, nodeId, onChangeNode]
);
const ValueRender = useCallback(
const ValueRender = useMemoizedFn(
({ updateItem, index }: { updateItem: TUpdateListItem; index: number }) => {
const { inputType, formParams = {} } = (() => {
const value = updateItem.variable;
@@ -279,7 +280,6 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
return (
<Box minW={'250px'} maxW={'400px'} borderRadius={'sm'}>
<InputRender
// @ts-ignore
inputType={inputType}
{...formParams}
isRichText={false}
@@ -294,18 +294,7 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
</Flex>
</Container>
);
},
[
appDetail.chatConfig,
externalProviderWorkflowVariables,
getNodeById,
nodeId,
onUpdateList,
systemConfigNode,
t,
updateList,
variables
]
}
);
const Render = useMemo(() => {

View File

@@ -174,7 +174,7 @@ async function migrateSystemPluginsToTools(typeToGroupMap: Map<string, string>):
pluginId: plugin.pluginId?.startsWith(AppToolSourceEnum.community)
? plugin.pluginId.replace(AppToolSourceEnum.community, AppToolSourceEnum.systemTool)
: plugin.pluginId,
status: !plugin.isActive ? PluginStatusEnum.Offline : PluginStatusEnum.Normal,
status: plugin.isActive === false ? PluginStatusEnum.Offline : PluginStatusEnum.Normal,
defaultInstalled: false,
originCost: plugin.originCost || 0,
currentCost: plugin.currentCost || 0,
@@ -182,7 +182,7 @@ async function migrateSystemPluginsToTools(typeToGroupMap: Map<string, string>):
pluginOrder: plugin.pluginOrder,
systemKeyCost: plugin.systemKeyCost || 0,
customConfig: plugin.customConfig ? { ...plugin.customConfig } : {},
inputListVal: plugin.inputListVal || {}
inputListVal: plugin.inputListVal
};
// 迁移 templateType → tags

View File

@@ -9,8 +9,8 @@ import { MongoChatItemResponse } from '@fastgpt/service/core/chat/chatItemRespon
import { ChatItemValueTypeEnum, ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
import { getS3ChatSource } from '@fastgpt/service/common/s3/sources/chat';
async function handler(req: ApiRequestProps<{}, DeleteChatItemProps>, res: NextApiResponse) {
const { appId, chatId, contentId } = req.query;
async function handler(req: ApiRequestProps<DeleteChatItemProps>, res: NextApiResponse) {
const { appId, chatId, contentId, delFile = true } = req.body;
if (!contentId || !chatId) {
return Promise.reject('contentId or chatId is empty');
@@ -20,7 +20,7 @@ async function handler(req: ApiRequestProps<{}, DeleteChatItemProps>, res: NextA
req,
authToken: true,
authApiKey: true,
...req.query
...req.body
});
await mongoSessionRun(async (session) => {
@@ -36,7 +36,7 @@ async function handler(req: ApiRequestProps<{}, DeleteChatItemProps>, res: NextA
dataId: contentId
}).session(session);
if (item?.obj === ChatRoleEnum.Human) {
if (item?.obj === ChatRoleEnum.Human && delFile) {
const s3ChatSource = getS3ChatSource();
for (const value of item.value) {
if (value.type === ChatItemValueTypeEnum.file && value.file?.key) {

View File

@@ -2,7 +2,7 @@ import { NextAPI } from '@/service/middleware/entry';
import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';
import { authUserPer } from '@fastgpt/service/support/permission/user/auth';
import { MongoTeamInstalledPlugin } from '@fastgpt/service/core/plugin/schema/teamInstalledPluginSchema';
import { WritePermissionVal } from '@fastgpt/global/support/permission/constant';
import { ReadPermissionVal, WritePermissionVal } from '@fastgpt/global/support/permission/constant';
import type { ToggleInstallPluginBodyType } from '@fastgpt/global/openapi/core/plugin/team/api';
export type ToggleInstallPluginBody = ToggleInstallPluginBodyType;
@@ -18,7 +18,7 @@ async function handler(
const { teamId } = await authUserPer({
req,
authToken: true,
per: WritePermissionVal
per: ReadPermissionVal
});
await MongoTeamInstalledPlugin.findOneAndUpdate(

View File

@@ -75,7 +75,7 @@ export const delClearChatHistories = (data: ClearHistoriesProps) =>
* delete one chat record
*/
export const delChatRecordById = (data: DeleteChatItemProps) =>
DELETE(`/core/chat/item/delete`, data);
POST(`/core/chat/item/delete`, data);
/**
* 修改历史记录: 标题/置顶