Can't create starter messages for existing assistants. (#3825)

* fix: move starter messages out of advanced options for better visibility

Co-Authored-By: Chris Weaver <chris@onyx.app>

* fix: ensure starter message input field is visible in edit flow

Co-Authored-By: Chris Weaver <chris@onyx.app>

* chore: fix prettier formatting

Co-Authored-By: Chris Weaver <chris@onyx.app>

* chore: fix prettier formatting for starter messages description

Co-Authored-By: Chris Weaver <chris@onyx.app>

* chore: fix prettier formatting for starter messages initialization

Co-Authored-By: Chris Weaver <chris@onyx.app>

* fix: prevent unintended deletion of second message in StarterMessagesList

Co-Authored-By: Chris Weaver <chris@onyx.app>

* Fix empty starter messages

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Chris Weaver <chris@onyx.app>
Co-authored-by: Weves <chrisweaver101@gmail.com>
This commit is contained in:
devin-ai-integration[bot] 2025-01-30 10:26:54 -08:00 committed by GitHub
parent aabf8a99bc
commit 0ed2886ad0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 12 deletions

View File

@ -232,11 +232,9 @@ export function AssistantEditor({
existingPersona?.llm_model_provider_override ?? null, existingPersona?.llm_model_provider_override ?? null,
llm_model_version_override: llm_model_version_override:
existingPersona?.llm_model_version_override ?? null, existingPersona?.llm_model_version_override ?? null,
starter_messages: existingPersona?.starter_messages ?? [ starter_messages: existingPersona?.starter_messages?.length
{ ? existingPersona.starter_messages
message: "", : [{ message: "" }],
},
],
enabled_tools_map: enabledToolsMap, enabled_tools_map: enabledToolsMap,
icon_color: existingPersona?.icon_color ?? defautIconColor, icon_color: existingPersona?.icon_color ?? defautIconColor,
icon_shape: existingPersona?.icon_shape ?? defaultIconShape, icon_shape: existingPersona?.icon_shape ?? defaultIconShape,
@ -1099,7 +1097,9 @@ export function AssistantEditor({
)} )}
</div> </div>
</div> </div>
<Separator /> <Separator />
<div className="w-full flex flex-col"> <div className="w-full flex flex-col">
<div className="flex gap-x-2 items-center"> <div className="flex gap-x-2 items-center">
<div className="block font-medium text-sm"> <div className="block font-medium text-sm">
@ -1110,6 +1110,7 @@ export function AssistantEditor({
<SubLabel> <SubLabel>
Sample messages that help users understand what this Sample messages that help users understand what this
assistant can do and how to interact with it effectively. assistant can do and how to interact with it effectively.
New input fields will appear automatically as you type.
</SubLabel> </SubLabel>
<div className="w-full"> <div className="w-full">

View File

@ -64,19 +64,16 @@ export default function StarterMessagesList({
size="icon" size="icon"
onClick={() => { onClick={() => {
arrayHelpers.remove(index); arrayHelpers.remove(index);
if (
index === values.length - 2 &&
!values[values.length - 1].message
) {
arrayHelpers.pop();
}
}} }}
className={`text-gray-400 hover:text-red-500 ${ className={`text-gray-400 hover:text-red-500 ${
index === values.length - 1 && !starterMessage.message index === values.length - 1 && !starterMessage.message
? "opacity-50 cursor-not-allowed" ? "opacity-50 cursor-not-allowed"
: "" : ""
}`} }`}
disabled={index === values.length - 1 && !starterMessage.message} disabled={
(index === values.length - 1 && !starterMessage.message) ||
(values.length === 1 && index === 0) // should never happen, but just in case
}
> >
<FiTrash2 className="h-4 w-4" /> <FiTrash2 className="h-4 w-4" />
</Button> </Button>