mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 22:35:54 +08:00
fix: initial paragraph can not input more than 48 chars (#2258)
This commit is contained in:
parent
409e0c8e1c
commit
45701a81e9
@ -1,7 +1,18 @@
|
|||||||
import { MAX_VAR_KEY_LENGHT, VAR_ITEM_TEMPLATE, getMaxVarNameLength } from '@/config'
|
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'
|
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_]+$/
|
const otherAllowedRegex = /^[a-zA-Z0-9_]+$/
|
||||||
|
|
||||||
export const getNewVar = (key: string, type: string) => {
|
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 {
|
return {
|
||||||
...VAR_ITEM_TEMPLATE,
|
...VAR_ITEM_TEMPLATE,
|
||||||
type: type || 'string',
|
type: type || 'string',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user