Skip to content

Commit

Permalink
listing file extensions, moving version history up (#9148)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas <[email protected]>
  • Loading branch information
overmode and overmode authored Dec 5, 2024
1 parent 14309a9 commit 930d9a5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
78 changes: 39 additions & 39 deletions front/components/assistant_builder/InstructionScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,45 @@ export function InstructionScreen({
</Page.P>
</div>
<div className="flex-grow" />
{configsWithUniqueInstructions &&
configsWithUniqueInstructions.length > 1 &&
currentConfig && (
<div className="mr-2 mt-2 self-end">
<PromptHistory
history={configsWithUniqueInstructions}
onConfigChange={(config) => {
// 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}
/>
</div>
)}
<div className="mt-2 self-end">
<AdvancedSettings
owner={owner}
Expand All @@ -299,45 +338,6 @@ export function InstructionScreen({
</div>
<div className="flex h-full flex-col gap-1">
<div className="relative h-full min-h-[240px] grow gap-1 p-px">
{configsWithUniqueInstructions &&
configsWithUniqueInstructions.length > 1 &&
currentConfig && (
<div className="absolute right-2 top-2 z-10">
<PromptHistory
history={configsWithUniqueInstructions}
onConfigChange={(config) => {
// 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}
/>
</div>
)}
<EditorContent
editor={editor}
className="absolute bottom-0 left-0 right-0 top-0"
Expand Down
2 changes: 1 addition & 1 deletion front/components/data_source/DocumentUploadOrEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export const DocumentUploadOrEditModal = ({
<div>
<Page.SectionHeader
title="Text content"
description={`Copy paste content or upload a file (text or PDF). Up to ${
description={`Copy paste content or upload a file (${supportedPlainTextExtensions.join(", ")}). \n Up to ${
plan.limits.dataSources.documents.sizeMb === -1
? "2"
: plan.limits.dataSources.documents.sizeMb
Expand Down

0 comments on commit 930d9a5

Please sign in to comment.