Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The length of the tag does not match the actual error reported #8187

Closed
5 tasks done
hwzhuhao opened this issue Sep 10, 2024 · 1 comment · Fixed by #8188
Closed
5 tasks done

The length of the tag does not match the actual error reported #8187

hwzhuhao opened this issue Sep 10, 2024 · 1 comment · Fixed by #8188
Labels
🐞 bug Something isn't working

Comments

@hwzhuhao
Copy link
Contributor

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.7.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1.add tag with 1testtesttesttesttesttesttesttesttesttest for workflow.

✔️ Expected Behavior

create tag successful

❌ Actual Behavior

tag

Copy link

dosubot bot commented Sep 10, 2024

I found a similar unsolved discussion that might be relevant to your issue: Why this not work, which was last updated on September 5, 2024 [1].

Regarding the tag length validation, it is implemented in two places in the codebase:

  1. In the _validate_name function within the api/controllers/console/tag/tags.py file. This function checks if the tag name is between 1 to 50 characters.
def _validate_name(name):
    if not name or len(name) < 1 or len(name) > 50:
        raise ValueError("Name must be between 1 to 50 characters.")
    return name
  1. In the TagInput component within the web/app/components/base/tag-input/index.tsx file. This component checks if the tag length exceeds 20 characters and displays an error message if it does.
const handleKeyDown = (e: KeyboardEvent) => {
  if (isSpecialMode && e.key === 'Enter')
    setValue(`${value}↵`)

  if (e.key === customizedConfirmKey) {
    if (isSpecialMode)
      e.preventDefault()

    const valueTrimmed = value.trim()
    if (!valueTrimmed || (items.find(item => item === valueTrimmed)))
      return

    if (valueTrimmed.length > 20) {
      notify({ type: 'error', message: t('datasetDocuments.segment.keywordError') })
      return
    }

    onChange([...items, valueTrimmed])
    setTimeout(() => {
      setValue('')
    })
  }
}

It seems there might be a discrepancy between the backend and frontend validations. The backend allows up to 50 characters, while the frontend restricts it to 20 characters [2][3].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the 🐞 bug Something isn't working label Sep 10, 2024
Scorpion1221 added a commit to yybht155/dify that referenced this issue Sep 10, 2024
* commit 'dabfd74622a613c7198f06791ad70424ac94f54f': (222 commits)
  feat: Parallel Execution of Nodes in Workflows (langgenius#8192)
  docs: replace docker-compose with docker compose (langgenius#8195)
  refactor(api/core): Improve type hints and apply ruff formatter in agent runner and model manager. (langgenius#8166)
  filter excel empty sheet (langgenius#8194)
  fix: The length of the tag should between 1 and 50 (langgenius#8187) (langgenius#8188)
  nvidia rerank top n missed (langgenius#8185)
  fix: Version '2.6.2-2' for 'expat' was not found (langgenius#8182)
  code merge error (langgenius#8183)
  add volcengine tos storage (langgenius#8164)
  chore: bump super-linter to v7 (langgenius#8148)
  feat(api/core/model_runtime/entities/defaults.py): Add TOP_K in default parameters. (langgenius#8167)
  Fix variable typo (cont) (langgenius#8161)
  update qwen-long (langgenius#8157)
  Update LICENSE - remove 'SaaS' from restriction term definition (langgenius#8143)
  fix: html raw render (langgenius#8138)
  chore: translate i18n files (langgenius#8135)
  fix: user-select style and pre-create iframe in embed.js (langgenius#8093)
  Modify model parameters in Spark LLMs and zhipuai LLMs (langgenius#8078)
  chore: offline n to 1 retrieval (langgenius#8134)
  fix: ollama text embedding 500 error (langgenius#8131)
  ...

# Conflicts:
#	api/configs/app_config.py
#	api/configs/feature/__init__.py
#	api/core/helper/code_executor/code_executor.py
#	api/services/conversation_service.py
#	web/yarn.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant