From 930d9a53020a1e6522aeee03d6789cc218ea9083 Mon Sep 17 00:00:00 2001 From: Lucas Massemin Date: Thu, 5 Dec 2024 15:14:56 +0100 Subject: [PATCH] listing file extensions, moving version history up (#9148) Co-authored-by: Lucas --- .../assistant_builder/InstructionScreen.tsx | 78 +++++++++---------- .../data_source/DocumentUploadOrEditModal.tsx | 2 +- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/front/components/assistant_builder/InstructionScreen.tsx b/front/components/assistant_builder/InstructionScreen.tsx index d59c1f1baefb..32262b4f1499 100644 --- a/front/components/assistant_builder/InstructionScreen.tsx +++ b/front/components/assistant_builder/InstructionScreen.tsx @@ -282,6 +282,45 @@ export function InstructionScreen({
+ {configsWithUniqueInstructions && + configsWithUniqueInstructions.length > 1 && + currentConfig && ( +
+ { + // Remember the instructions of the version we're leaving, if overriden + if ( + currentConfig && + currentConfig.instructions !== builderState.instructions + ) { + setOverridenConfigInstructions((prev) => ({ + ...prev, + [currentConfig.version]: builderState.instructions, + })); + } + + // Bring new version's instructions to the editor, fetch overriden instructions if any + setCurrentConfig(config); + editorService.resetContent( + tipTapContentFromPlainText( + overridenConfigInstructions[config.version] || + config.instructions || + "" + ) + ); + setBuilderState((state) => ({ + ...state, + instructions: + overridenConfigInstructions[config.version] || + config.instructions || + "", + })); + }} + currentConfig={currentConfig} + /> +
+ )}
- {configsWithUniqueInstructions && - configsWithUniqueInstructions.length > 1 && - currentConfig && ( -
- { - // Remember the instructions of the version we're leaving, if overriden - if ( - currentConfig && - currentConfig.instructions !== builderState.instructions - ) { - setOverridenConfigInstructions((prev) => ({ - ...prev, - [currentConfig.version]: builderState.instructions, - })); - } - - // Bring new version's instructions to the editor, fetch overriden instructions if any - setCurrentConfig(config); - editorService.resetContent( - tipTapContentFromPlainText( - overridenConfigInstructions[config.version] || - config.instructions || - "" - ) - ); - setBuilderState((state) => ({ - ...state, - instructions: - overridenConfigInstructions[config.version] || - config.instructions || - "", - })); - }} - currentConfig={currentConfig} - /> -
- )}