feat: llm support readonly

This commit is contained in:
Joel 2024-03-20 16:42:48 +08:00
parent 2e5acef1b6
commit beca05848c
2 changed files with 10 additions and 3 deletions

View File

@ -47,6 +47,7 @@ export type ModelParameterModalProps = {
debugWithMultipleModel?: boolean
onDebugWithMultipleModelChange?: () => void
renderTrigger?: (v: TriggerProps) => ReactNode
readonly?: boolean
}
const stopParameerRule: ModelParameterRule = {
default: [],
@ -81,6 +82,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
debugWithMultipleModel,
onDebugWithMultipleModelChange,
renderTrigger,
readonly,
}) => {
const { t } = useTranslation()
const { hasSettedApiKey } = useProviderContext()
@ -174,7 +176,11 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
>
<div className='relative'>
<PortalToFollowElemTrigger
onClick={() => setOpen(v => !v)}
onClick={() => {
if (readonly)
return
setOpen(v => !v)
}}
className='block'
>
{

View File

@ -26,9 +26,9 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
data,
}) => {
const { t } = useTranslation()
const readOnly = false
const {
readOnly,
inputs,
isChatModel,
isChatMode,
@ -127,13 +127,14 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
onCompletionParamsChange={handleCompletionParamsChange}
hideDebugWithMultipleModel
debugWithMultipleModel={false}
readonly={readOnly}
/>
</Field>
<Field
title={t(`${i18nPrefix}.variables`)}
operations={
<AddButton onClick={handleAddVariable} />
!readOnly ? <AddButton onClick={handleAddVariable} /> : undefined
}
>
<VarList