Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: initial paragraph can not input more than 48 chars (#2258)

crazywoola45701a81e967
diff --git a/web/utils/var.ts b/web/utils/var.ts
index fa98e0377db..b2a7871ad18 100644
--- a/web/utils/var.ts
+++ b/web/utils/var.ts
@@ -1,7 +1,18 @@
import { MAX_VAR_KEY_LENGHT, VAR_ITEM_TEMPLATE, getMaxVarNameLength } from '@/config'
import { CONTEXT_PLACEHOLDER_TEXT, HISTORY_PLACEHOLDER_TEXT, PRE_PROMPT_PLACEHOLDER_TEXT, QUERY_PLACEHOLDER_TEXT } from '@/app/components/base/prompt-editor/constants'
+
const otherAllowedRegex = /^[a-zA-Z0-9_]+$/
+
export const getNewVar = (key: string, type: string) => {
+ const { max_length, ...rest } = VAR_ITEM_TEMPLATE
+ if (type !== 'string') {
+ return {
+ ...rest,
+ type: type || 'string',
+ key,
+ name: key.slice(0, getMaxVarNameLength(key)),
+ }
+ }
return {
...VAR_ITEM_TEMPLATE,
type: type || 'string',