mirror of
https://github.com/langgenius/dify.git
synced 2025-12-14 03:40:55 +00:00
fix: to new var format
This commit is contained in:
parent
91fefa0e37
commit
d4a1d045f8
@ -53,6 +53,8 @@ export const isConversationVar = (valueSelector: ValueSelector) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const isRagVariableVar = (valueSelector: ValueSelector) => {
|
export const isRagVariableVar = (valueSelector: ValueSelector) => {
|
||||||
|
if(!valueSelector)
|
||||||
|
return false
|
||||||
return valueSelector[0] === 'rag'
|
return valueSelector[0] === 'rag'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +500,7 @@ const formatItem = (
|
|||||||
case 'rag': {
|
case 'rag': {
|
||||||
res.vars = data.ragVariables.map((ragVar: RAGPipelineVariable) => {
|
res.vars = data.ragVariables.map((ragVar: RAGPipelineVariable) => {
|
||||||
return {
|
return {
|
||||||
variable: `rag.${ragVar.variable}`,
|
variable: `rag.shared.${ragVar.variable}`,
|
||||||
type: inputVarTypeToVarType(ragVar.type as any),
|
type: inputVarTypeToVarType(ragVar.type as any),
|
||||||
des: ragVar.label,
|
des: ragVar.label,
|
||||||
isRagVariable: true,
|
isRagVariable: true,
|
||||||
@ -636,10 +638,11 @@ export const toNodeOutputVars = (
|
|||||||
let ragVariablesInDataSource: RAGPipelineVariable[] = []
|
let ragVariablesInDataSource: RAGPipelineVariable[] = []
|
||||||
if (node.data.type === BlockEnum.DataSource)
|
if (node.data.type === BlockEnum.DataSource)
|
||||||
ragVariablesInDataSource = ragVariables.filter(ragVariable => ragVariable.belong_to_node_id === node.id)
|
ragVariablesInDataSource = ragVariables.filter(ragVariable => ragVariable.belong_to_node_id === node.id)
|
||||||
|
console.log(ragVariables, ragVariablesInDataSource, node.id)
|
||||||
return {
|
return {
|
||||||
...formatItem(node, isChatMode, filterVar, ragVariablesInDataSource.map(
|
...formatItem(node, isChatMode, filterVar, ragVariablesInDataSource.map(
|
||||||
(ragVariable: RAGPipelineVariable) => ({
|
(ragVariable: RAGPipelineVariable) => ({
|
||||||
variable: ragVariable.variable,
|
variable: `rag.${node.id}.${ragVariable.variable}`,
|
||||||
type: inputVarTypeToVarType(ragVariable.type as any),
|
type: inputVarTypeToVarType(ragVariable.type as any),
|
||||||
description: ragVariable.label,
|
description: ragVariable.label,
|
||||||
isRagVariable: true,
|
isRagVariable: true,
|
||||||
|
|||||||
@ -183,7 +183,7 @@ const VarReferencePicker: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
}, [value, hasValue, isConstant, isIterationVar, iterationNode, availableNodes, outputVarNodeId, startNode, isLoopVar, loopNode])
|
}, [value, hasValue, isConstant, isIterationVar, iterationNode, availableNodes, outputVarNodeId, startNode, isLoopVar, loopNode])
|
||||||
|
|
||||||
const isShowAPart = (value as ValueSelector).length > 2
|
const isShowAPart = (value as ValueSelector).length > 2 && !isRagVariableVar((value as ValueSelector))
|
||||||
|
|
||||||
const varName = useMemo(() => {
|
const varName = useMemo(() => {
|
||||||
if (!hasValue)
|
if (!hasValue)
|
||||||
|
|||||||
@ -165,7 +165,7 @@ const Item: FC<ItemProps> = ({
|
|||||||
<div title={itemData.des} className='system-sm-medium ml-1 w-0 grow truncate text-text-secondary'>{itemData.variable.replace('conversation.', '')}</div>
|
<div title={itemData.des} className='system-sm-medium ml-1 w-0 grow truncate text-text-secondary'>{itemData.variable.replace('conversation.', '')}</div>
|
||||||
)}
|
)}
|
||||||
{isRagVariable && (
|
{isRagVariable && (
|
||||||
<div title={itemData.des} className='system-sm-medium ml-1 w-0 grow truncate text-text-secondary'>{itemData.variable.replace('rag.', '')}</div>
|
<div title={itemData.des} className='system-sm-medium ml-1 w-0 grow truncate text-text-secondary'>{itemData.variable.split('.').slice(-1)[0]}</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className='ml-1 shrink-0 text-xs font-normal capitalize text-text-tertiary'>{itemData.type}</div>
|
<div className='ml-1 shrink-0 text-xs font-normal capitalize text-text-tertiary'>{itemData.type}</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user