mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(platform): UI fixes; Fix default value on input fields & fix enum custom fields (#8182)
* fix(platform): Fix default value on input fields & fix enum custom fields * fix(platform): Fix default value on input fields & fix enum custom fields
This commit is contained in:
@@ -92,7 +92,12 @@ class AIStructuredResponseGeneratorBlock(Block):
|
||||
description="Expected format of the response. If provided, the response will be validated against this format. "
|
||||
"The keys should be the expected fields in the response, and the values should be the description of the field.",
|
||||
)
|
||||
model: LlmModel = LlmModel.GPT4_TURBO
|
||||
model: LlmModel = SchemaField(
|
||||
title="LLM Model",
|
||||
default=LlmModel.GPT4_TURBO,
|
||||
description="The language model to use for answering the prompt.",
|
||||
advanced=False,
|
||||
)
|
||||
api_key: BlockSecret = SecretField(value="")
|
||||
sys_prompt: str = ""
|
||||
retry: int = 3
|
||||
@@ -307,7 +312,12 @@ class AIStructuredResponseGeneratorBlock(Block):
|
||||
class AITextGeneratorBlock(Block):
|
||||
class Input(BlockSchema):
|
||||
prompt: str
|
||||
model: LlmModel = LlmModel.GPT4_TURBO
|
||||
model: LlmModel = SchemaField(
|
||||
title="LLM Model",
|
||||
default=LlmModel.GPT4_TURBO,
|
||||
description="The language model to use for answering the prompt.",
|
||||
advanced=False,
|
||||
)
|
||||
api_key: BlockSecret = SecretField(value="")
|
||||
sys_prompt: str = ""
|
||||
retry: int = 3
|
||||
@@ -355,7 +365,11 @@ class AITextGeneratorBlock(Block):
|
||||
class AITextSummarizerBlock(Block):
|
||||
class Input(BlockSchema):
|
||||
text: str
|
||||
model: LlmModel = LlmModel.GPT4_TURBO
|
||||
model: LlmModel = SchemaField(
|
||||
title="LLM Model",
|
||||
default=LlmModel.GPT4_TURBO,
|
||||
description="The language model to use for summarizing the text.",
|
||||
)
|
||||
api_key: BlockSecret = SecretField(value="")
|
||||
# TODO: Make this dynamic
|
||||
max_tokens: int = 4000 # Adjust based on the model's context window
|
||||
@@ -492,6 +506,7 @@ class AIConversationBlock(Block):
|
||||
description="List of messages in the conversation.", min_length=1
|
||||
)
|
||||
model: LlmModel = SchemaField(
|
||||
title="LLM Model",
|
||||
default=LlmModel.GPT4_TURBO,
|
||||
description="The language model to use for the conversation.",
|
||||
)
|
||||
|
||||
@@ -49,7 +49,7 @@ const NodeObjectInputTree: FC<NodeObjectInputTreeProps> = ({
|
||||
className,
|
||||
displayName,
|
||||
}) => {
|
||||
object ??= ("default" in schema ? schema.default : null) ?? {};
|
||||
object ||= ("default" in schema ? schema.default : null) ?? {};
|
||||
return (
|
||||
<div className={cn(className, "w-full flex-col")}>
|
||||
{displayName && <strong>{displayName}</strong>}
|
||||
@@ -105,7 +105,7 @@ export const NodeGenericInputField: FC<{
|
||||
className,
|
||||
displayName,
|
||||
}) => {
|
||||
displayName ??= propSchema.title || beautifyString(propKey);
|
||||
displayName ||= propSchema.title || beautifyString(propKey);
|
||||
|
||||
if ("allOf" in propSchema) {
|
||||
// If this happens, that is because Pydantic wraps $refs in an allOf if the
|
||||
@@ -573,6 +573,7 @@ const NodeStringInput: FC<{
|
||||
className,
|
||||
displayName,
|
||||
}) => {
|
||||
value ||= schema.default || "";
|
||||
return (
|
||||
<div className={className}>
|
||||
{schema.enum ? (
|
||||
@@ -642,6 +643,7 @@ export const NodeTextBoxInput: FC<{
|
||||
className,
|
||||
displayName,
|
||||
}) => {
|
||||
value ||= schema.default || "";
|
||||
return (
|
||||
<div className={className}>
|
||||
<div
|
||||
@@ -686,8 +688,8 @@ const NodeNumberInput: FC<{
|
||||
className,
|
||||
displayName,
|
||||
}) => {
|
||||
value ??= schema.default;
|
||||
displayName ??= schema.title || beautifyString(selfKey);
|
||||
value ||= schema.default;
|
||||
displayName ||= schema.title || beautifyString(selfKey);
|
||||
return (
|
||||
<div className={className}>
|
||||
<div className="nodrag flex items-center justify-between space-x-3">
|
||||
@@ -723,7 +725,7 @@ const NodeBooleanInput: FC<{
|
||||
className,
|
||||
displayName,
|
||||
}) => {
|
||||
value ??= schema.default ?? false;
|
||||
value ||= schema.default ?? false;
|
||||
return (
|
||||
<div className={className}>
|
||||
<div className="nodrag flex items-center">
|
||||
@@ -757,6 +759,7 @@ const NodeFallbackInput: FC<{
|
||||
className,
|
||||
displayName,
|
||||
}) => {
|
||||
value ||= (schema as BlockIOStringSubSchema)?.default;
|
||||
return (
|
||||
<NodeStringInput
|
||||
selfKey={selfKey}
|
||||
|
||||
Reference in New Issue
Block a user