From 73dec62a19c0fc0fd9d8630200efadd1cfffe5fc Mon Sep 17 00:00:00 2001 From: breeg554 Date: Tue, 5 Nov 2024 10:56:59 +0100 Subject: [PATCH] update messages rendering --- apps/api/lib/buildel/blocks/chat.ex | 6 +- .../lib/buildel/blocks/fields/editor_field.ex | 2 +- .../components/form/fields/editor.field.tsx | 4 +- .../components/form/schema/SchemaFields.tsx | 63 +++++++++++-------- 4 files changed, 42 insertions(+), 33 deletions(-) diff --git a/apps/api/lib/buildel/blocks/chat.ex b/apps/api/lib/buildel/blocks/chat.ex index 43797d91f..9f2caabd8 100644 --- a/apps/api/lib/buildel/blocks/chat.ex +++ b/apps/api/lib/buildel/blocks/chat.ex @@ -213,15 +213,15 @@ defmodule Buildel.Blocks.Chat do "properties" => %{ "role" => %{ "type" => "string", - "title" => "Role", + "title" => "", "enum" => ["user", "assistant"], "enumPresentAs" => "radio", "default" => "user" }, "content" => EditorField.new(%{ - title: "Content", - description: "The content of the message.", + title: "", + description: "", suggestions: [ Suggestion.inputs(), Suggestion.metadata(), diff --git a/apps/api/lib/buildel/blocks/fields/editor_field.ex b/apps/api/lib/buildel/blocks/fields/editor_field.ex index 953d13386..7c47631e9 100644 --- a/apps/api/lib/buildel/blocks/fields/editor_field.ex +++ b/apps/api/lib/buildel/blocks/fields/editor_field.ex @@ -88,7 +88,7 @@ defmodule Buildel.Blocks.Fields.EditorField do @type t :: %EditorField{} @create_fields ~w(title description default min_length editor_language suggestions displayWhen readonly)a - @required_fields ~w(title description)a + @required_fields ~w()a @spec new(attrs :: map()) :: t def new(%{} = attrs \\ %{}) do diff --git a/apps/web-remix/app/components/form/fields/editor.field.tsx b/apps/web-remix/app/components/form/fields/editor.field.tsx index d0c4d0b11..2fb1a6213 100644 --- a/apps/web-remix/app/components/form/fields/editor.field.tsx +++ b/apps/web-remix/app/components/form/fields/editor.field.tsx @@ -56,8 +56,8 @@ export const EditorField = ({ return ( <> -
- {label} +
+ {label} - {rhfFields.map((item, index) => ( -
- - } - disabled={rhfFields.length <= field.minItems || rest.disabled} - onClick={(e) => { - e.preventDefault(); - remove(index); - }} - /> -
- ))} + + {field.description} +
0 })} + > + {rhfFields.map((item, index) => ( +
+ } + disabled={rhfFields.length <= field.minItems || rest.disabled} + onClick={(e) => { + e.preventDefault(); + remove(index); + }} + /> + + +
+ ))} +