mirror of
https://github.com/langgenius/dify.git
synced 2025-12-12 02:41:25 +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) => {
|
||||
if(!valueSelector)
|
||||
return false
|
||||
return valueSelector[0] === 'rag'
|
||||
}
|
||||
|
||||
@ -498,7 +500,7 @@ const formatItem = (
|
||||
case 'rag': {
|
||||
res.vars = data.ragVariables.map((ragVar: RAGPipelineVariable) => {
|
||||
return {
|
||||
variable: `rag.${ragVar.variable}`,
|
||||
variable: `rag.shared.${ragVar.variable}`,
|
||||
type: inputVarTypeToVarType(ragVar.type as any),
|
||||
des: ragVar.label,
|
||||
isRagVariable: true,
|
||||
@ -636,10 +638,11 @@ export const toNodeOutputVars = (
|
||||
let ragVariablesInDataSource: RAGPipelineVariable[] = []
|
||||
if (node.data.type === BlockEnum.DataSource)
|
||||
ragVariablesInDataSource = ragVariables.filter(ragVariable => ragVariable.belong_to_node_id === node.id)
|
||||
console.log(ragVariables, ragVariablesInDataSource, node.id)
|
||||
return {
|
||||
...formatItem(node, isChatMode, filterVar, ragVariablesInDataSource.map(
|
||||
(ragVariable: RAGPipelineVariable) => ({
|
||||
variable: ragVariable.variable,
|
||||
variable: `rag.${node.id}.${ragVariable.variable}`,
|
||||
type: inputVarTypeToVarType(ragVariable.type as any),
|
||||
description: ragVariable.label,
|
||||
isRagVariable: true,
|
||||
|
||||
@ -183,7 +183,7 @@ const VarReferencePicker: FC<Props> = ({
|
||||
}
|
||||
}, [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(() => {
|
||||
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>
|
||||
)}
|
||||
{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 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