mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 02:43:49 +08:00
feat: support prompt readonly
This commit is contained in:
parent
4bef2eed25
commit
7bb1decaf8
@ -112,43 +112,47 @@ const Editor: FC<Props> = ({
|
|||||||
)}
|
)}
|
||||||
hideResize={isExpand}
|
hideResize={isExpand}
|
||||||
>
|
>
|
||||||
<PromptEditor
|
<>
|
||||||
className={cn('min-h-[84px]')}
|
<PromptEditor
|
||||||
style={isExpand ? { height: editorExpandHeight - 5 } : {}}
|
className={cn('min-h-[84px]')}
|
||||||
value={value}
|
style={isExpand ? { height: editorExpandHeight - 5 } : {}}
|
||||||
outToolDisabled
|
value={value}
|
||||||
contextBlock={{
|
outToolDisabled
|
||||||
show: justVar ? false : isShowContext,
|
contextBlock={{
|
||||||
selectable: !hasSetBlockStatus?.context,
|
show: justVar ? false : isShowContext,
|
||||||
datasets: [],
|
selectable: !hasSetBlockStatus?.context,
|
||||||
onAddContext: () => { },
|
datasets: [],
|
||||||
}}
|
onAddContext: () => { },
|
||||||
variableBlock={{
|
}}
|
||||||
variables: variables.map(item => ({
|
variableBlock={{
|
||||||
name: item,
|
variables: variables.map(item => ({
|
||||||
value: item,
|
name: item,
|
||||||
})),
|
value: item,
|
||||||
externalTools: [],
|
})),
|
||||||
onAddExternalTool: () => { },
|
externalTools: [],
|
||||||
}}
|
onAddExternalTool: () => { },
|
||||||
historyBlock={{
|
}}
|
||||||
show: justVar ? false : isShowHistory,
|
historyBlock={{
|
||||||
selectable: !hasSetBlockStatus?.history,
|
show: justVar ? false : isShowHistory,
|
||||||
history: {
|
selectable: !hasSetBlockStatus?.history,
|
||||||
user: 'Human',
|
history: {
|
||||||
assistant: 'Assistant',
|
user: 'Human',
|
||||||
},
|
assistant: 'Assistant',
|
||||||
onEditRole: () => { },
|
},
|
||||||
}}
|
onEditRole: () => { },
|
||||||
queryBlock={{
|
}}
|
||||||
show: justVar ? false : isShowQuery,
|
queryBlock={{
|
||||||
selectable: !hasSetBlockStatus?.query,
|
show: justVar ? false : isShowQuery,
|
||||||
}}
|
selectable: !hasSetBlockStatus?.query,
|
||||||
onChange={onChange}
|
}}
|
||||||
onBlur={setBlur}
|
onChange={onChange}
|
||||||
onFocus={setFocus}
|
onBlur={setBlur}
|
||||||
editable={!readOnly}
|
onFocus={setFocus}
|
||||||
/>
|
editable={!readOnly}
|
||||||
|
/>
|
||||||
|
{/* to patch Editor not support dynamic change editable status */}
|
||||||
|
{readOnly && <div className='absolute inset-0 z-10'></div>}
|
||||||
|
</>
|
||||||
</PromptEditorHeightResizeWrap>
|
</PromptEditorHeightResizeWrap>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -45,6 +45,7 @@ const Panel: FC<NodePanelProps<AnswerNodeType>> = ({
|
|||||||
</Field>
|
</Field>
|
||||||
<Split />
|
<Split />
|
||||||
<Editor
|
<Editor
|
||||||
|
readOnly={readOnly}
|
||||||
justVar
|
justVar
|
||||||
title={t(`${i18nPrefix}.answer`)!}
|
title={t(`${i18nPrefix}.answer`)!}
|
||||||
value={inputs.answer}
|
value={inputs.answer}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user