Add properly random icons to assistant creation page (#2044)

This commit is contained in:
pablodanswer
2024-08-04 23:30:17 -07:00
committed by GitHub
parent 6d67d472cd
commit 66e4dded91
2 changed files with 10 additions and 4 deletions

View File

@@ -100,6 +100,14 @@ export function AssistantEditor({
"#6FFFFF", "#6FFFFF",
]; ];
// state to persist across formik reformatting
const [defautIconColor, _setDeafultIconColor] = useState(
colorOptions[Math.floor(Math.random() * colorOptions.length)]
);
const [defaultIconShape, _setDeafultIconShape] = useState(
generateRandomIconShape().encodedGrid
);
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled(); const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
// EE only // EE only
@@ -207,8 +215,8 @@ export function AssistantEditor({
existingPersona?.llm_model_version_override ?? null, existingPersona?.llm_model_version_override ?? null,
starter_messages: existingPersona?.starter_messages ?? [], starter_messages: existingPersona?.starter_messages ?? [],
enabled_tools_map: enabledToolsMap, enabled_tools_map: enabledToolsMap,
icon_color: existingPersona?.icon_color ?? "#FF6FBF", icon_color: existingPersona?.icon_color ?? defautIconColor,
icon_shape: existingPersona?.icon_shape ?? 123242312, icon_shape: existingPersona?.icon_shape ?? defaultIconShape,
uploaded_image: null, uploaded_image: null,
// search_tool_enabled: existingPersona // search_tool_enabled: existingPersona

View File

@@ -77,11 +77,9 @@ const ToggleSwitch = () => {
}; };
export default function FunctionalWrapper({ export default function FunctionalWrapper({
// children,
initiallyToggled, initiallyToggled,
content, content,
}: { }: {
// children: React.ReactNode;
content: (toggledSidebar: boolean, toggle: () => void) => ReactNode; content: (toggledSidebar: boolean, toggle: () => void) => ReactNode;
initiallyToggled: boolean; initiallyToggled: boolean;
}) { }) {