Skip to content

Commit ead3bb8

Browse files
authored
[elsa] fix(LlmNodeState): add conditional enableLog control and initialization (#156)
1 parent 5f0c927 commit ead3bb8

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

framework/elsa/fit-elsa-react/src/components/llm/LlmOutput.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ function _LlmOutput({outputItems, enableLogData, disabled}) {
9393
className="jade-panel"
9494
>
9595
<div className={"jade-custom-panel-content"}>
96-
<Form.Item className='jade-form-item' name={`enableLog-${enableLogData.id}`}>
96+
{enableLogData && <Form.Item className="jade-form-item" name={`enableLog-${enableLogData.id}`}>
9797
<Checkbox checked={enableLogData.value} disabled={disabled}
98-
onChange={e => dispatch({ type: 'updateLogStatus', value: e.target.checked})}><span
98+
onChange={e => dispatch({type: 'updateLogStatus', value: e.target.checked})}><span
9999
className={'jade-font-size'}>{t('pushResultToChat')}</span></Checkbox>
100-
</Form.Item>
100+
</Form.Item>}
101101
<JadeObservableTree data={outputItems}/>
102102
{/* 430演示大模型输出不允许用户操作,写死*/}
103103
{/* <Row gutter={16}>*/}

framework/elsa/fit-elsa-react/src/flow/compatibility/compatibilityProcessors.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,24 @@ export const llmCompatibilityProcessor = (shapeData, graph, pageHandler) => {
364364
}
365365
};
366366

367+
const addEnableLog = (inputParams) => {
368+
if (!inputParams.some(item => item.name === 'enableLog')) {
369+
inputParams.push({
370+
id: uuidv4(),
371+
from: FROM_TYPE.INPUT,
372+
name: 'enableLog',
373+
type: DATA_TYPES.BOOLEAN,
374+
value: true,
375+
});
376+
}
377+
}
378+
367379
const inputParams = self.shapeData.flowMeta.jober.converter.entity.inputParams;
368380
const outputObject = self.shapeData.flowMeta.jober.converter.entity.outputParams.find(i => i.name === 'output');
369381
ensureParam(inputParams, DEFAULT_MAX_MEMORY_ROUNDS);
370382
ensureParam(inputParams, DEFAULT_LLM_KNOWLEDGE_BASES);
371383
ensureParam(outputObject.value, DEFAULT_LLM_REFERENCE_OUTPUT);
384+
addEnableLog(inputParams);
372385
if (!self.shapeData.flowMeta.jober.converter.entity.tempReference) {
373386
self.shapeData.flowMeta.jober.converter.entity.tempReference = {};
374387
}

0 commit comments

Comments
 (0)