fix: allow longer workflow prompt fragments
This commit is contained in:
parent
672632ffe0
commit
f112a63c75
@ -31,6 +31,7 @@ import {
|
||||
Video,
|
||||
} from "lucide-react";
|
||||
import {
|
||||
AGENT_WORKFLOW_PROMPT_FRAGMENT_MAX_LENGTH,
|
||||
defaultAgentWorkflowConstraintSettings,
|
||||
AGENT_WORKFLOW_MAX_OPTION_DEPTH,
|
||||
AGENT_WORKFLOW_MAX_TREE_DEPTH,
|
||||
@ -3222,9 +3223,16 @@ export function AgentWorkflowSettingsClient({
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label className="text-xs">Prompt 片段</Label>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<Label className="text-xs">Prompt 片段</Label>
|
||||
<span className="text-[10px] text-muted-foreground">
|
||||
{(option.promptFragment || "").length} /{" "}
|
||||
{AGENT_WORKFLOW_PROMPT_FRAGMENT_MAX_LENGTH}
|
||||
</span>
|
||||
</div>
|
||||
<Textarea
|
||||
value={option.promptFragment || ""}
|
||||
maxLength={AGENT_WORKFLOW_PROMPT_FRAGMENT_MAX_LENGTH}
|
||||
onChange={(e) =>
|
||||
updateOption(step.key, option.key, (currentOption) => ({
|
||||
...currentOption,
|
||||
|
||||
@ -32,6 +32,7 @@ import {
|
||||
} from "@/lib/agents/secondary-type-config";
|
||||
import {
|
||||
AGENT_WORKFLOW_UI_CONFIG_KEY,
|
||||
AGENT_WORKFLOW_PROMPT_FRAGMENT_MAX_LENGTH,
|
||||
defaultAgentWorkflowUiConfig,
|
||||
normalizeAgentWorkflowUiConfig,
|
||||
} from "@/lib/agents/workflow-ui-config";
|
||||
@ -709,7 +710,12 @@ const agentWorkflowOptionSchema: z.ZodTypeAny = z.lazy(() =>
|
||||
previewImageUrl: z.string().trim().max(1000).nullable().optional(),
|
||||
enabled: z.boolean().optional(),
|
||||
sortOrder: z.number().min(0).max(999).optional(),
|
||||
promptFragment: z.string().trim().max(1000).nullable().optional(),
|
||||
promptFragment: z
|
||||
.string()
|
||||
.trim()
|
||||
.max(AGENT_WORKFLOW_PROMPT_FRAGMENT_MAX_LENGTH)
|
||||
.nullable()
|
||||
.optional(),
|
||||
blockedOptionKeys: z.array(z.string().trim().min(1).max(64)).max(100).optional(),
|
||||
children: z.array(agentWorkflowOptionSchema).max(100).optional(),
|
||||
})
|
||||
|
||||
@ -14,6 +14,7 @@ import type {
|
||||
export const AGENT_WORKFLOW_UI_CONFIG_KEY = "agent_workflow_ui_config";
|
||||
export const AGENT_WORKFLOW_MAX_TREE_DEPTH = 8;
|
||||
export const AGENT_WORKFLOW_MAX_OPTION_DEPTH = 8;
|
||||
export const AGENT_WORKFLOW_PROMPT_FRAGMENT_MAX_LENGTH = 20_000;
|
||||
export const defaultAgentWorkflowCategoryLabels: AgentWorkflowCategoryLabels = {
|
||||
firstCategory: "品牌",
|
||||
secondCategory: "店铺",
|
||||
@ -855,7 +856,7 @@ export function normalizeAgentWorkflowUiConfig(value: unknown): AgentWorkflowUiC
|
||||
defaultOption?.buttonName ||
|
||||
`选项${optionIndex + 1}`;
|
||||
const promptFragment =
|
||||
normalizeText(optionRecord.promptFragment, 1000) ||
|
||||
normalizeText(optionRecord.promptFragment, AGENT_WORKFLOW_PROMPT_FRAGMENT_MAX_LENGTH) ||
|
||||
defaultOption?.promptFragment ||
|
||||
buttonName;
|
||||
const hasRawBlockedOptionKeys = Array.isArray(optionRecord.blockedOptionKeys);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user