Reverse Invocation Model。The received response is incomplete。 #150

Open
opened 2026-02-16 00:20:08 -05:00 by yindo · 0 comments
Owner

Originally created by @Kun-Zhang-x on GitHub (Jun 27, 2025).

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

1.5.0

Cloud or Self Hosted

Cloud

Steps to reproduce

dify_plugin==0.3.5

Custom plugin:

class RookieDataAlchemyTool(Tool):
    def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessage]:
        model_info = tool_parameters.get('model')
        print(f"model_info={model_info}")
        # 初始化模板加载器
        prompt_loader = PromptLoader()
        # 构建模板上下文
        context = {
            'raw_data': tool_parameters['data'],
            'title': tool_parameters.get('title', ''),
            'chart_type': self._get_chart_english(tool_parameters['chart_type']),
            'custom_requirements': tool_parameters.get('custom_requirements', '')
        }
        system_prompt = prompt_loader.get_prompt(context)
        response = self.session.model.llm.invoke(
            model_config=model_info,
            prompt_messages=[
                SystemPromptMessage(content=system_prompt),
            ],
            stream=False
        )
        print(f"response={response}")
        print(f"content={response.message.content}")

        json_res = self.robust_json_parser(response.message.content)
        yield self.create_text_message(self._add_echarts_code_fence(json_res))

remote debug:

INSTALL_METHOD=remote
REMOTE_INSTALL_HOST=debug.dify.ai
REMOTE_INSTALL_PORT=5003
REMOTE_INSTALL_KEY=0334de78-cb06-*******-51ecb7ad7272

 uv run python -m main

log:

(.venv) PS E:\00tools\pycharm\py-XM\rookie_data_alchemy> uv run python -m main
{"event": "log", "data": {"level": "INFO", "message": "Installed tool: rookie_data_alchemy", "timestamp": 1751009641.3030796}}
INFO:dify_plugin.plugin:Installed tool: rookie_data_alchemy

model_info={'completion_params': {'enable_thinking': False, 'temperature': 0.3}, 'mode': 'chat', 'model': 'qwen3-32b', 'model_type': 'llm', 'provider': 'langgenius/tongyi/tongyi', 'type': 'model-selector'}

response=model='qwen3-32b' prompt_messages=[] message=AssistantPromptMessage(role=<PromptMessageRole.ASSISTANT: 'assistant'>, content='{', name=None, tool_calls=[]) usage=LLMUsage(
prompt_tokens=0, prompt_unit_price=Decimal('0.0'), prompt_price_unit=Decimal('0.0'), prompt_price=Decimal('0'), completion_tokens=0, completion_unit_price=Decimal('0.0'), completion_price_unit=Decimal('0.0'), completion_price=Decimal('0'), total_tokens=0, total_price=Decimal('0'), currency='USD', latency=0.0) system_fingerprint=None

content={

✔️ Expected Behavior

Obtained the complete content

Actual Behavior

Only obtained one "{"

Originally created by @Kun-Zhang-x on GitHub (Jun 27, 2025). ### 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 1.5.0 ### Cloud or Self Hosted Cloud ### Steps to reproduce **dify_plugin==0.3.5** Custom plugin: ``` class RookieDataAlchemyTool(Tool): def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessage]: model_info = tool_parameters.get('model') print(f"model_info={model_info}") # 初始化模板加载器 prompt_loader = PromptLoader() # 构建模板上下文 context = { 'raw_data': tool_parameters['data'], 'title': tool_parameters.get('title', ''), 'chart_type': self._get_chart_english(tool_parameters['chart_type']), 'custom_requirements': tool_parameters.get('custom_requirements', '') } system_prompt = prompt_loader.get_prompt(context) response = self.session.model.llm.invoke( model_config=model_info, prompt_messages=[ SystemPromptMessage(content=system_prompt), ], stream=False ) print(f"response={response}") print(f"content={response.message.content}") json_res = self.robust_json_parser(response.message.content) yield self.create_text_message(self._add_echarts_code_fence(json_res)) ``` remote debug: ``` INSTALL_METHOD=remote REMOTE_INSTALL_HOST=debug.dify.ai REMOTE_INSTALL_PORT=5003 REMOTE_INSTALL_KEY=0334de78-cb06-*******-51ecb7ad7272 uv run python -m main ``` log: ``` (.venv) PS E:\00tools\pycharm\py-XM\rookie_data_alchemy> uv run python -m main {"event": "log", "data": {"level": "INFO", "message": "Installed tool: rookie_data_alchemy", "timestamp": 1751009641.3030796}} INFO:dify_plugin.plugin:Installed tool: rookie_data_alchemy model_info={'completion_params': {'enable_thinking': False, 'temperature': 0.3}, 'mode': 'chat', 'model': 'qwen3-32b', 'model_type': 'llm', 'provider': 'langgenius/tongyi/tongyi', 'type': 'model-selector'} response=model='qwen3-32b' prompt_messages=[] message=AssistantPromptMessage(role=<PromptMessageRole.ASSISTANT: 'assistant'>, content='{', name=None, tool_calls=[]) usage=LLMUsage( prompt_tokens=0, prompt_unit_price=Decimal('0.0'), prompt_price_unit=Decimal('0.0'), prompt_price=Decimal('0'), completion_tokens=0, completion_unit_price=Decimal('0.0'), completion_price_unit=Decimal('0.0'), completion_price=Decimal('0'), total_tokens=0, total_price=Decimal('0'), currency='USD', latency=0.0) system_fingerprint=None content={ ``` ### ✔️ Expected Behavior Obtained the complete content ### ❌ Actual Behavior Only obtained one "{"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#150