Skip to content

Commit 674d834

Browse files
RonnyChan96surpercodehang
authored andcommitted
[elsa] fix(LlmNodeState): add conditional enableLog control and initialization (#156)
1 parent 7f2dd9f commit 674d834

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
@@ -62,11 +62,11 @@ function _LlmOutput({outputItems, enableLogData, disabled}) {
6262
forceRender
6363
>
6464
<div className={"jade-custom-panel-content"}>
65-
<Form.Item className='jade-form-item' name={`enableLog-${enableLogData.id}`}>
65+
{enableLogData && <Form.Item className="jade-form-item" name={`enableLog-${enableLogData.id}`}>
6666
<Checkbox checked={enableLogData.value} disabled={disabled}
67-
onChange={e => dispatch({ type: 'updateLogStatus', value: e.target.checked})}><span
67+
onChange={e => dispatch({type: 'updateLogStatus', value: e.target.checked})}><span
6868
className={'jade-font-size'}>{t('pushResultToChat')}</span></Checkbox>
69-
</Form.Item>
69+
</Form.Item>}
7070
<JadeObservableTree data={outputItems}/>
7171
</div>
7272
</Panel>

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

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

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

0 commit comments

Comments
 (0)