langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
35.59k stars 4.8k forks source link

Link to nodes documentation needs to be updated #5597

Closed johnpccd closed 3 days ago

johnpccd commented 3 days ago

Self Checks

Dify version

0.6.11

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In a workflow, create an iteration node, right click and click "Help link"

✔️ Expected Behavior

Navigate to correct page in documentation: /guides/workflow/node/iteration

❌ Actual Behavior

Wrong link opened: /features/workflow/node/iteration

johnpccd commented 3 days ago

https://github.com/langgenius/dify/blob/b2e2298822b4ea9a925cc98e9c1f6cf889377cc2/web/app/components/workflow/nodes/_base/hooks/use-node-help-link.ts#L11

dosubot[bot] commented 3 days ago

Hey @johnpccd! I'm here to help you with any bugs, questions, or contributions. Let's get started!

To update the help link for the iteration node in Dify version 0.6.11, you need to modify the linkMap object in the useNodeHelpLink hook. Specifically, you should update the entry for BlockEnum.Iteration to navigate to the correct documentation page.

Here is the updated code:

import { useMemo } from 'react'
import { useGetLanguage } from '@/context/i18n'
import { BlockEnum } from '@/app/components/workflow/types'

export const useNodeHelpLink = (nodeType: BlockEnum) => {
  const language = useGetLanguage()
  const prefixLink = useMemo(() => {
    if (language === 'zh_Hans')
      return 'https://docs.dify.ai/v/zh-hans/guides/workflow/node/'

    return 'https://docs.dify.ai/guides/workflow/node/'
  }, [language])
  const linkMap = useMemo(() => {
    if (language === 'zh_Hans') {
      return {
        [BlockEnum.Start]: 'start',
        [BlockEnum.End]: 'end',
        [BlockEnum.Answer]: 'answer',
        [BlockEnum.LLM]: 'llm',
        [BlockEnum.KnowledgeRetrieval]: 'knowledge_retrieval',
        [BlockEnum.QuestionClassifier]: 'question_classifier',
        [BlockEnum.IfElse]: 'ifelse',
        [BlockEnum.Code]: 'code',
        [BlockEnum.TemplateTransform]: 'template',
        [BlockEnum.VariableAssigner]: 'variable_assigner',
        [BlockEnum.VariableAggregator]: 'variable_assigner',
        [BlockEnum.Iteration]: 'iteration', // Update this line
        [BlockEnum.ParameterExtractor]: 'parameter_extractor',
        [BlockEnum.HttpRequest]: 'http_request',
        [BlockEnum.Tool]: 'tools',
      }
    }

    return {
      [BlockEnum.Start]: 'start',
      [BlockEnum.End]: 'end',
      [BlockEnum.Answer]: 'answer',
      [BlockEnum.LLM]: 'llm',
      [BlockEnum.KnowledgeRetrieval]: 'knowledge-retrieval',
      [BlockEnum.QuestionClassifier]: 'question-classifier',
      [BlockEnum.IfElse]: 'if-else',
      [BlockEnum.Code]: 'code',
      [BlockEnum.TemplateTransform]: 'template',
      [BlockEnum.VariableAssigner]: 'variable-assigner',
      [BlockEnum.VariableAggregator]: 'variable-assigner',
      [BlockEnum.Iteration]: 'iteration', // Update this line
      [BlockEnum.ParameterExtractor]: 'parameter-extractor',
      [BlockEnum.HttpRequest]: 'http-request',
      [BlockEnum.Tool]: 'tools',
    }
  }, [language])

  return `${prefixLink}${linkMap[nodeType]}`
}

Replace 'iteration' with the actual path to the correct documentation page for the iteration node [1][2].

To continue talking to Dosu, mention @dosu.

crazywoola commented 3 days ago

Could you submit a pr to fix this?

johnpccd commented 3 days ago

Could you submit a pr to fix this?

https://github.com/langgenius/dify/pull/5623