cannot save the code in code block #5131

Closed
opened 2026-02-21 18:09:31 -05:00 by yindo · 2 comments
Owner

Originally created by @MartinBTM on GitHub (Aug 20, 2024).

Originally assigned to: @zxhlyh on GitHub.

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.6.14

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

when I fill in some code in code block, it can not save when I switch to other page, I try to publish, also not work
see the pic below
20240821104303
20240821104229

✔️ Expected Behavior

save my code

Actual Behavior

Return to the initial status

Originally created by @MartinBTM on GitHub (Aug 20, 2024). Originally assigned to: @zxhlyh on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.14 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce when I fill in some code in code block, it can not save when I switch to other page, I try to publish, also not work see the pic below ![20240821104303](https://github.com/user-attachments/assets/64a9b8f0-78d0-4d88-9d48-25ef34cfc40f) ![20240821104229](https://github.com/user-attachments/assets/4990eb37-b94c-42a5-b7bd-6fcfbbb66d63) ### ✔️ Expected Behavior save my code ### ❌ Actual Behavior Return to the initial status
yindo added the 🐞 bug label 2026-02-21 18:09:31 -05:00
yindo closed this issue 2026-02-21 18:09:31 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 20, 2024):

@MartinBTM Hello there! I'm a bot here to help you with bugs, questions, or becoming a contributor. Let me know how I can assist you while you wait for a human maintainer.

To save the code in a code block in Dify version 0.6.14 when using the self-hosted Docker setup, you can follow these steps:

  1. Clone the Dify source code to your local machine:

    git clone https://github.com/langgenius/dify.git
    
  2. Navigate to the docker directory in the Dify source code and execute the following commands to start the middleware services (PostgresSQL, Redis, Weaviate):

    cd dify/docker
    cp middleware.env.example middleware.env
    docker compose -f docker-compose.middleware.yaml up -d
    
  3. Navigate to the api directory, copy the environment variable configuration file, generate a random secret key, and install dependencies:

    cd ../api
    cp .env.example .env
    openssl rand -base64 42 | sed -i 's/SECRET_KEY=.*/SECRET_KEY=<your_value>/' .env
    poetry env use 3.10
    poetry install
    
  4. Perform database migration:

    poetry shell
    flask db upgrade
    
  5. Start the API service:

    flask run --host 0.0.0.0 --port=5001 --debug
    
  6. Start the Worker service for asynchronous tasks:

    celery -A app.celery worker -P gevent -c 1 -Q dataset,generation,mail,ops_trace --loglevel INFO
    
  7. Navigate to the web directory, install dependencies, configure environment variables, build the code, and start the web service:

    cd ../web
    npm install
    cp .env.example .env.local
    npm run build
    npm run start
    
  8. Access Dify by visiting http://127.0.0.1:3000 in your web browser.

These steps should help you save and manage your code in a code block while using the self-hosted Docker setup for Dify version 0.6.14 [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 20, 2024): <!-- Greeting --> @MartinBTM Hello there! I'm a bot here to help you with bugs, questions, or becoming a contributor. Let me know how I can assist you while you wait for a human maintainer. <!-- Answer --> To save the code in a code block in Dify version 0.6.14 when using the self-hosted Docker setup, you can follow these steps: 1. Clone the Dify source code to your local machine: ```bash git clone https://github.com/langgenius/dify.git ``` 2. Navigate to the docker directory in the Dify source code and execute the following commands to start the middleware services (PostgresSQL, Redis, Weaviate): ```bash cd dify/docker cp middleware.env.example middleware.env docker compose -f docker-compose.middleware.yaml up -d ``` 3. Navigate to the `api` directory, copy the environment variable configuration file, generate a random secret key, and install dependencies: ```bash cd ../api cp .env.example .env openssl rand -base64 42 | sed -i 's/SECRET_KEY=.*/SECRET_KEY=<your_value>/' .env poetry env use 3.10 poetry install ``` 4. Perform database migration: ```bash poetry shell flask db upgrade ``` 5. Start the API service: ```bash flask run --host 0.0.0.0 --port=5001 --debug ``` 6. Start the Worker service for asynchronous tasks: ```bash celery -A app.celery worker -P gevent -c 1 -Q dataset,generation,mail,ops_trace --loglevel INFO ``` 7. Navigate to the `web` directory, install dependencies, configure environment variables, build the code, and start the web service: ```bash cd ../web npm install cp .env.example .env.local npm run build npm run start ``` 8. Access Dify by visiting `http://127.0.0.1:3000` in your web browser. These steps should help you save and manage your code in a code block while using the self-hosted Docker setup for Dify version 0.6.14 <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/docker-compose.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/local-source-code.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Aug 28, 2024):

Please upgrade to v0.7.1 to see if this is resolved.

@crazywoola commented on GitHub (Aug 28, 2024): Please upgrade to v0.7.1 to see if this is resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5131