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
45.09k stars 6.33k forks source link

Unable to access a knowledge base because of some version issue #7136

Open PeriwigXu opened 1 month ago

PeriwigXu commented 1 month ago

Self Checks

Dify version

0.6.16

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I was trying to config my knowledge base, but it told me there was a client-side exception. knowledgebase-exception I guess it was caused by some version mistakes of certain python packages, but I'm not sure how to solve it. The error message is below.

✔️ Expected Behavior

No response

❌ Actual Behavior

difyapi | /app/api/core/workflow/nodes/llm/llm_node.py:305: DeprecationWarning: This method is deprecated, use get instead. difyapi | variable_value = variable_pool.get_any(variable_selector.value_selector) difyapi | /app/api/core/workflow/nodes/llm/llm_node.py:353: DeprecationWarning: This method is deprecated, use get instead. difyapi | context_value = variable_pool.get_any(node_data.context.variable_selector) difyapi | /app/api/.venv/lib/python3.10/site-packages/pydantic/main.py:1282: PydanticDeprecatedSince20: The copy method is deprecated; use model_copy instead. See the docstring of BaseModel.copy for details about how to handle include and exclude. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/ difyapi | warnings.warn( difyapi | /app/api/.venv/lib/python3.10/site-packages/pydantic/main.py:1358: PydanticDeprecatedSince20: The validate method is deprecated; use model_validate instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/ difyapi | warnings.warn(

dosubot[bot] commented 1 month ago

To resolve the client-side exception and deprecation warnings you're encountering in Dify v0.6.16, follow these steps:

  1. Update Python Packages: Ensure that the Python packages are updated to their latest compatible versions. You can do this by updating the requirements.txt file and using Poetry to manage dependencies.

    poetry shell
    poetry add $(cat requirements.txt)
    poetry add $(cat requirements-dev.txt) --group dev
  2. Handle Deprecation Warnings: The deprecation warnings indicate that certain methods are deprecated and should be replaced. Specifically:

    • Replace copy with model_copy.
    • Replace validate with model_validate.

    Update your code to use these new methods as per the Pydantic V2 Migration Guide.

  3. Configure SSL/TLS: Ensure that your self-hosted instance is using secure connections. Update your environment variables to use https URLs and configure SSL/TLS in your Docker setup.

    Example environment variables:

    CONSOLE_API_URL=https://api.console.dify.ai
    CONSOLE_WEB_URL=https://console.dify.ai
    SERVICE_API_URL=https://api.dify.ai
    APP_API_URL=https://app.dify.ai
    APP_WEB_URL=https://api.app.dify.ai

    Example Nginx configuration for SSL termination:

    server {
       listen 443 ssl;
       server_name your_domain.com;
    
       ssl_certificate /path/to/your/certificate.crt;
       ssl_certificate_key /path/to/your/private.key;
    
       location / {
           proxy_pass http://your_application_container:5001;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
       }
    }
  4. Check Vector Search Settings: Ensure that the vector search settings are correctly configured for English queries. Adjust the TopK, Score threshold, and Rerank model settings as needed.

    TopK: 3
    Score threshold: 0.5
    Rerank model: <API_KEY>

By following these steps, you should be able to resolve the client-side exception and deprecation warnings, ensuring a secure and functional setup for your knowledge base [1][2][3][4].

To continue talking to Dosu, mention @dosu.

crazywoola commented 1 month ago

Hello can you paste the errors in web console? It seems to be a frontend issue.

PeriwigXu commented 1 month ago

Hello can you paste the errors in web console? It seems to be a frontend issue.

Sure frontend_err

crazywoola commented 1 month ago

@dosu Generate a fix for this

Hello can you paste the errors in web console? It seems to be a frontend issue.

Sure frontend_err

dosubot[bot] commented 1 month ago

To address the frontend issues you're encountering, follow these steps:

  1. Deprecation Warnings for -ms-high-contrast-adjust: These warnings are related to CSS properties that are no longer supported. Update your CSS to remove or replace deprecated properties.

  2. 403 Error for Failed Resource Load: This error indicates a permission issue. Ensure that the resource URL is correct and that the server has the necessary permissions to access it. Check your server configuration and authentication settings.

  3. TypeError: Cannot Read Properties of Undefined (Reading 'extension'): This error suggests that a variable is being accessed before it is defined. Use optional chaining to prevent this error:

    const extension = someObject?.extension;
  4. TypeError: Cannot Read Properties of Null (Reading 'postMessage'): Similar to the previous error, this indicates that a null value is being accessed. Ensure that the object is not null before accessing its properties:

    if (someObject !== null) {
       someObject.postMessage(...);
    }
  5. General Debugging Steps:

    • Use Browser Developer Tools: Set breakpoints and inspect variables to identify where the errors are occurring.
    • Check for Undefined or Null Values: Add checks in your code to handle undefined or null values gracefully.
    • Review Code for Common Issues: Ensure that your code safely accesses properties and handles potential errors.

By following these steps, you should be able to resolve the client-side exceptions and improve the stability of your frontend application [1].

To continue talking to Dosu, mention @dosu.

yinlianggood commented 3 weeks ago

升级到最新版本,可以解决这个问题? 昨天新建的知识库还是正常的, 今天就打开报这个错了