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
49.7k stars 7.1k forks source link

Can't save prompt when update to latest #4970

Closed Leonard-Li777 closed 4 months ago

Leonard-Li777 commented 4 months ago

Self Checks

Dify version

0.6.10

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

All LLM prompt miss and refull can't to save.

✔️ Expected Behavior

Restore LLM prompt and can save

❌ Actual Behavior

LLM can't save prompt

dosubot[bot] commented 4 months ago

Hey @Leonard-Li777! 👋 I'm here to help you with any bugs, questions, or contributions you have for the Dify repository. Let's squash those bugs together!

To resolve the issue of missing LLM prompts and the inability to save them after updating to Dify version 0.6.10 in a self-hosted Docker setup, ensure that the frontend and backend versions are up-to-date and consistent with each other. This is a common cause of such issues.

Steps to Resolve:

  1. Check Frontend and Backend Versions: Ensure that both the frontend and backend versions of your Dify setup are updated to the latest version and are consistent with each other. For Dify version 0.6.10, make sure the langgenius/dify-web and langgenius/dify-api images are both set to 0.6.10.

  2. Update Docker Containers: If the versions are inconsistent, you may need to pull the latest Docker images and restart the containers. Use the following commands to update and restart your Docker setup:

    docker-compose pull
    docker-compose up -d
  3. Verify Configuration: Ensure that your docker-compose.yaml file is correctly set up and that there are no discrepancies between the versions. Here is an example configuration for Dify version 0.6.10:

    version: '3'
    services:
     api:
       image: langgenius/dify-api:0.6.10
       restart: always
       environment:
         MODE: api
         LOG_LEVEL: INFO
         SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
         CONSOLE_WEB_URL: ''
         DB_USERNAME: postgres
         DB_PASSWORD: difyai123456
         DB_HOST: db
         DB_PORT: 5432
         DB_DATABASE: dify
         REDIS_HOST: redis
         REDIS_PORT: 6379
         REDIS_PASSWORD: difyai123456
         CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
       depends_on:
         - db
         - redis
       volumes:
         - ./volumes/app/storage:/app/api/storage
    
     web:
       image: langgenius/dify-web:0.6.10
       restart: always
       environment:
         CONSOLE_API_URL: ''
         APP_API_URL: ''
         SENTRY_DSN: ''
       ports:
         - "3000:3000"
    
     db:
       image: postgres:15-alpine
       restart: always
       environment:
         PGUSER: postgres
         POSTGRES_PASSWORD: difyai123456
         POSTGRES_DB: dify
         PGDATA: /var/lib/postgresql/data/pgdata
       volumes:
         - ./volumes/db/data:/var/lib/postgresql/data
       healthcheck:
         test: [ "CMD", "pg_isready" ]
         interval: 1s
         timeout: 3s
         retries: 30
    
     redis:
       image: redis:6-alpine
       restart: always
       volumes:
         - ./volumes/redis/data:/data
       command: redis-server --requirepass difyai123456
       healthcheck:
         test: [ "CMD", "redis-cli", "ping" ]
  4. Check Logs: If the issue persists after these steps, you may need to check the logs for any specific error messages that could provide more insight into the problem. Use the following command to view the logs:

    docker-compose logs
  5. Review Prompt Configuration: Ensure that the prompt configuration in your Dify setup is correctly implemented. The useConfig hook in the Dify codebase handles the prompt configuration. Verify that the handlePromptChange, handleAddVariable, and other related functions are working as expected. Here is a snippet from the useConfig hook:

    const handlePromptChange = useCallback((newPrompt: PromptItem[] | PromptItem) => {
     const newInputs = produce(inputRef.current, (draft) => {
       draft.prompt_template = newPrompt
     })
     setInputs(newInputs)
    }, [setInputs])
    
    const handleAddVariable = useCallback((payload: Variable) => {
     const newInputs = produce(inputRef.current, (draft) => {
       if (!draft.prompt_config) {
         draft.prompt_config = {
           jinja2_variables: [],
         }
       }
       if (!draft.prompt_config.jinja2_variables)
         draft.prompt_config.jinja2_variables = []
    
       draft.prompt_config.jinja2_variables.push(payload)
     })
     setInputs(newInputs)
    }, [setInputs])

If you continue to experience issues, consider reaching out to Dify's support or consulting the community for further assistance [1][2][3][4].

To continue talking to Dosu, mention @dosu.

crazywoola commented 4 months ago

Do you have a screenshot?

Leonard-Li777 commented 4 months ago

image

In fact, there is prompt, but it is not displayed

Leonard-Li777 commented 4 months ago

image

iamjoel commented 4 months ago

@Leonard-Li777 Can you provide more details steps to reduce this problem?

crazywoola commented 4 months ago

@Leonard-Li777 The exported dsl would be better.

Leonard-Li777 commented 4 months ago

follow step: git pull origin main docker compose down docker compose pull docker compose up -d

rename extend txt -> yml [联想记单词-Detail-2.0 (1).txt](https://github.com/user-attachments/files/15740773/-Detail-2.0.1.txt)

iamjoel commented 4 months ago

Fiexed. @Leonard-Li777