4.8.21 feature (#3742)

* model config

* feat: normalization embedding

* adapt unstrea  reasoning response

* remove select app

* perf: dataset search code

* fix: multiple audio video show

* perf: query extension output

* perf: link check

* perf: faq doc

* fix: ts

* feat: support reasoning text output

* feat: workflow support reasoning output
This commit is contained in:
Archer
2025-02-11 13:53:08 +08:00
committed by GitHub
parent 896a3f1472
commit 8738c32fb0
45 changed files with 640 additions and 570 deletions

View File

@@ -23,7 +23,6 @@ import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor';
import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/workflow/utils';
import SearchParamsTip from '@/components/core/dataset/SearchParamsTip';
import SettingLLMModel from '@/components/core/ai/SettingLLMModel';
import type { SettingAIDataType } from '@fastgpt/global/core/app/type.d';
import { TTSTypeEnum } from '@/web/core/app/constants';
import { workflowSystemVariables } from '@/web/core/app/utils';
import { useContextSelector } from 'use-context-selector';
@@ -164,12 +163,13 @@ const EditForm = ({
aiChatResponseFormat: appForm.aiSettings.aiChatResponseFormat,
aiChatJsonSchema: appForm.aiSettings.aiChatJsonSchema
}}
onChange={({ maxHistories = 6, aiChatReasoning = true, ...data }) => {
onChange={({ maxHistories = 6, ...data }) => {
setAppForm((state) => ({
...state,
aiSettings: {
...state.aiSettings,
...data
...data,
maxHistories
}
}));
}}

View File

@@ -106,10 +106,12 @@ const InputTypeConfig = ({
...listValue[index]
}));
const valueTypeSelectList = Object.values(FlowValueTypeMap).map((item) => ({
label: t(item.label as any),
value: item.value
}));
const valueTypeSelectList = Object.values(FlowValueTypeMap)
.filter((item) => !item.abandon)
.map((item) => ({
label: t(item.label as any),
value: item.value
}));
const showValueTypeSelect =
inputType === FlowNodeInputTypeEnum.reference ||

View File

@@ -66,9 +66,6 @@ const NodePluginConfig = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
>
<Container w={'360px'}>
<Instruction {...componentsProps} />
<Box pt={4}>
<FileSelectConfig {...componentsProps} />
</Box>
</Container>
</NodeCard>
);

View File

@@ -93,7 +93,9 @@ export const useReference = ({
),
value: node.nodeId,
children: filterWorkflowNodeOutputsByType(node.outputs, valueType)
.filter((output) => output.id !== NodeOutputKeyEnum.addOutputParam)
.filter(
(output) => output.id !== NodeOutputKeyEnum.addOutputParam && output.invalid !== true
)
.map((output) => {
return {
label: t(output.label as any),

View File

@@ -13,7 +13,7 @@ const SelectAiModelRender = ({ item, inputs = [], nodeId }: RenderInputProps) =>
(e: SettingAIDataType) => {
for (const key in e) {
const input = inputs.find((input) => input.key === key);
input &&
if (input) {
onChangeNode({
nodeId,
type: 'updateInput',
@@ -24,6 +24,7 @@ const SelectAiModelRender = ({ item, inputs = [], nodeId }: RenderInputProps) =>
value: e[key]
}
});
}
}
},
[inputs, nodeId, onChangeNode]

View File

@@ -1,4 +1,4 @@
import React, { useMemo, useState } from 'react';
import React, { useEffect, useMemo, useState } from 'react';
import type { FlowNodeOutputItemType } from '@fastgpt/global/core/workflow/type/io.d';
import { Box, Button, Flex } from '@chakra-ui/react';
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
@@ -14,6 +14,7 @@ import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
import dynamic from 'next/dynamic';
import { defaultOutput } from './FieldEditModal';
import { useSystemStore } from '@/web/common/system/useSystemStore';
const FieldEditModal = dynamic(() => import('./FieldEditModal'));
@@ -25,6 +26,7 @@ const RenderOutput = ({
flowOutputList: FlowNodeOutputItemType[];
}) => {
const { t } = useTranslation();
const { llmModelList } = useSystemStore();
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
const outputString = useMemo(() => JSON.stringify(flowOutputList), [flowOutputList]);
@@ -32,6 +34,32 @@ const RenderOutput = ({
return JSON.parse(outputString) as FlowNodeOutputItemType[];
}, [outputString]);
// Condition check
const inputs = useContextSelector(WorkflowContext, (v) => {
const node = v.nodeList.find((node) => node.nodeId === nodeId);
return JSON.stringify(node?.inputs);
});
useEffect(() => {
flowOutputList.forEach((output) => {
if (!output.invalidCondition || !inputs) return;
const parsedInputs = JSON.parse(inputs);
const invalid = output.invalidCondition({
inputs: parsedInputs,
llmModelList
});
onChangeNode({
nodeId,
type: 'replaceOutput',
key: output.key,
value: {
...output,
invalid
}
});
});
}, [copyOutputs, nodeId, inputs, llmModelList]);
const [editField, setEditField] = useState<FlowNodeOutputItemType>();
const RenderDynamicOutputs = useMemo(() => {
@@ -129,12 +157,14 @@ const RenderOutput = ({
return (
<>
{renderOutputs.map((output, i) => {
return output.label ? (
return output.label && output.invalid !== true ? (
<FormLabel
key={output.key}
required={output.required}
mb={i === renderOutputs.length - 1 ? 0 : 4}
position={'relative'}
_notLast={{
mb: 4
}}
>
<OutputLabel nodeId={nodeId} output={output} />
</FormLabel>

View File

@@ -125,7 +125,12 @@ export const getEditorVariables = ({
: sourceNodes
.map((node) => {
return node.outputs
.filter((output) => !!output.label && output.id !== NodeOutputKeyEnum.addOutputParam)
.filter(
(output) =>
!!output.label &&
output.invalid !== true &&
output.id !== NodeOutputKeyEnum.addOutputParam
)
.map((output) => {
return {
label: t((output.label as any) || ''),