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
46.88k stars 6.63k forks source link

HTTP Request block removes r"<\|.*?\|>" from json/raw text HTTP requests #8503

Open vdlfvkfdvfdjbs opened 1 week ago

vdlfvkfdvfdjbs commented 1 week ago

Self Checks

Dify version

0.8.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Create an "HTTP Request" block and send json/raw text that includes r"<|.*?|>" type of string, for example {"text": "hello <|cats|> world"} will be sent as {"text": "hello world"}.

✔️ Expected Behavior

for {"text": "hello <|cats|> world"} to be sent as {"text": "hello <|cats|> world"}

❌ Actual Behavior

{"text": "hello <|cats|> world"} is sent as {"text": "hello world"}

dosubot[bot] commented 1 week ago

@vdlfvkfdvfdjbs Hello! I'm here to help you with any bugs, questions, or contributions you have for the project.

The issue you're experiencing, where the HTTP Request block removes the pattern "<|.*?|>" from JSON/raw text HTTP requests, is not explicitly documented in the codebase. However, it is possible that this behavior is due to some form of sanitization or processing logic applied to the request payload.

To investigate further, you can check the following areas in the codebase:

  1. HttpExecutor Class: This class is responsible for executing HTTP requests and might contain logic that processes or sanitizes the request payload.

    • File: api/core/workflow/nodes/http_request/http_executor.py [1].
  2. EditBody Component: This component handles the processing and sanitization of JSON and raw text bodies in the frontend.

    • File: web/app/components/workflow/nodes/http/components/edit-body/index.tsx [2].
  3. Unit Tests: There are unit tests that specifically test the handling of special characters or patterns in the HTTP Request block. These tests might provide insights into how such patterns are processed.

    • File: api/tests/integration_tests/workflow/nodes/test_http.py [3].

If you need to address this issue immediately, you might consider adding custom handling for the "<|.*?|>" pattern in the relevant parts of the codebase. Otherwise, you can report this as a bug to the maintainers for further investigation.

To continue talking to Dosu, mention @dosu.