The ollama plugin cannot engage in dialogue and returns empty. #11065

Closed
opened 2026-02-21 18:54:28 -05:00 by yindo · 0 comments
Owner

Originally created by @IamWWT on GitHub (Mar 14, 2025).

Self Checks

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

1. Is this request related to a challenge you're experiencing? Tell me about your story.

内网环境部署了dify 1.0.0,ollama模型插件安装后,创建一个原生对话应用不能成功输出,f12显示没有什么错误。查看api容器发现好像是有依赖文件要从外网下载,发现是这个文件openai_public.py,然后openai_public.py文件内容已经修改如下。但是我重启容器服务后,我docker cp拷贝这个文件检查发现确实文件修改成功了,但是仍旧报相同的错误。烦请告诉我我少了哪些操作呢?

I've deployed dify 1.0.0 in an intranet environment.
After installing the ollama model plugin, I attempted to create a native conversation application, but it failed to produce any output. The F12 developer tools did not indicate any errors. Upon examining the API container, it appears that certain dependent files need to be downloaded from the external network, including the file openai_public.py. I have modified the content of openai_public.py as follows. Despite restarting the container service and using docker cp to verify that the file has been successfully modified, the same error persists.

Could you please advise on any steps that I might have overlooked?

== openai_public.py: The modifications are as follows::

def gpt2():
    mergeable_ranks = data_gym_to_mergeable_bpe_ranks(
        #vocab_bpe_file="https://openaipublic.blob.core.windows.net/gpt-2/encodings/main/vocab.bpe",
        #encoder_json_file="https://openaipublic.blob.core.windows.net/gpt-2/encodings/main/encoder.json",
        vocab_bpe_file="/app/api_deps/vocab.bpe",
        encoder_json_file="/app/api_deps/encoder.json",
        vocab_bpe_hash="1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5",
        encoder_json_hash="196139668be63f3b5d6574427317ae82f612a97c5d1cdaf36ed2256dbf636783",
    )
    return {
        "name": "gpt2",
        "explicit_n_vocab": 50257,
        "pat_str": r50k_pat_str,
        "mergeable_ranks": mergeable_ranks,
        "special_tokens": {ENDOFTEXT: 50256},
    }

=== ERROR of container docker-api-1 as following:

2025-03-14 09:02:40.245 ERROR [Thread-10 (_generate_worker)] [app_generator.py:243] - Unknown Error when generating
Traceback (most recent call last):
  File "/app/api/core/app/apps/chat/app_generator.py", line 223, in _generate_worker
    runner.run(
  File "/app/api/core/app/apps/chat/app_runner.py", line 58, in run
    self.get_pre_calculate_rest_tokens(
  File "/app/api/core/app/apps/base_app_runner.py", line 86, in get_pre_calculate_rest_tokens
    prompt_tokens = model_instance.get_llm_num_tokens(prompt_messages)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/model_manager.py", line 195, in get_llm_num_tokens
    self._round_robin_invoke(
  File "/app/api/core/model_manager.py", line 370, in _round_robin_invoke
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/model_runtime/model_providers/__base/large_language_model.py", line 299, in get_num_tokens
    return plugin_model_manager.get_llm_num_tokens(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/plugin/manager/model.py", line 231, in get_llm_num_tokens
    for resp in response:
                ^^^^^^^^
  File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
    self._handle_plugin_daemon_error(error.error_type, error.message)
  File "/app/api/core/plugin/manager/base.py", line 221, in _handle_plugin_daemon_error
    raise PluginInvokeError(description=message)
core.plugin.manager.exc.PluginInvokeError: PluginInvokeError: {"args":{},"error_type":"ConnectionError","message":"HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError(\"\u003curllib3.connection.HTTPSConnection object at 0x7fc82dd90860\u003e: Failed to resolve 'openaipublic.blob.core.windows.net' ([Errno -2] Name or service not known)\"))"}
2025-03-14 09:02:40.251 ERROR [Dummy-11] [base_app_generate_response_converter.py:123] - {"args":{},"error_type":"ConnectionError","message":"HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError(\"\u003curllib3.connection.HTTPSConnection object at 0x7fc82dd90860\u003e: Failed to resolve 'openaipublic.blob.core.windows.net' ([Errno -2] Name or service not known)\"))"}

Image

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @IamWWT on GitHub (Mar 14, 2025). ### Self Checks - [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. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. 内网环境部署了dify 1.0.0,ollama模型插件安装后,创建一个原生对话应用不能成功输出,f12显示没有什么错误。查看api容器发现好像是有依赖文件要从外网下载,发现是这个文件openai_public.py,然后openai_public.py文件内容已经修改如下。但是我重启容器服务后,我docker cp拷贝这个文件检查发现确实文件修改成功了,但是仍旧报相同的错误。烦请告诉我我少了哪些操作呢? I've deployed dify 1.0.0 in an intranet environment. After installing the ollama model plugin, I attempted to create a native conversation application, but it **failed to produce any output.** The F12 developer tools did not indicate any errors. Upon examining the API container, it appears that certain dependent files need to be downloaded from the external network, including the file **openai_public.py**. I have modified the content of openai_public.py as follows. Despite restarting the container service and using `docker cp` to verify that the file has been successfully modified, the same error persists. Could you please advise on any steps that I might have overlooked? == openai_public.py: The modifications are as follows:: ``` def gpt2(): mergeable_ranks = data_gym_to_mergeable_bpe_ranks( #vocab_bpe_file="https://openaipublic.blob.core.windows.net/gpt-2/encodings/main/vocab.bpe", #encoder_json_file="https://openaipublic.blob.core.windows.net/gpt-2/encodings/main/encoder.json", vocab_bpe_file="/app/api_deps/vocab.bpe", encoder_json_file="/app/api_deps/encoder.json", vocab_bpe_hash="1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5", encoder_json_hash="196139668be63f3b5d6574427317ae82f612a97c5d1cdaf36ed2256dbf636783", ) return { "name": "gpt2", "explicit_n_vocab": 50257, "pat_str": r50k_pat_str, "mergeable_ranks": mergeable_ranks, "special_tokens": {ENDOFTEXT: 50256}, } ``` === ERROR of container docker-api-1 as following: ``` 2025-03-14 09:02:40.245 ERROR [Thread-10 (_generate_worker)] [app_generator.py:243] - Unknown Error when generating Traceback (most recent call last): File "/app/api/core/app/apps/chat/app_generator.py", line 223, in _generate_worker runner.run( File "/app/api/core/app/apps/chat/app_runner.py", line 58, in run self.get_pre_calculate_rest_tokens( File "/app/api/core/app/apps/base_app_runner.py", line 86, in get_pre_calculate_rest_tokens prompt_tokens = model_instance.get_llm_num_tokens(prompt_messages) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_manager.py", line 195, in get_llm_num_tokens self._round_robin_invoke( File "/app/api/core/model_manager.py", line 370, in _round_robin_invoke return function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/__base/large_language_model.py", line 299, in get_num_tokens return plugin_model_manager.get_llm_num_tokens( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/plugin/manager/model.py", line 231, in get_llm_num_tokens for resp in response: ^^^^^^^^ File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/manager/base.py", line 221, in _handle_plugin_daemon_error raise PluginInvokeError(description=message) core.plugin.manager.exc.PluginInvokeError: PluginInvokeError: {"args":{},"error_type":"ConnectionError","message":"HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError(\"\u003curllib3.connection.HTTPSConnection object at 0x7fc82dd90860\u003e: Failed to resolve 'openaipublic.blob.core.windows.net' ([Errno -2] Name or service not known)\"))"} 2025-03-14 09:02:40.251 ERROR [Dummy-11] [base_app_generate_response_converter.py:123] - {"args":{},"error_type":"ConnectionError","message":"HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError(\"\u003curllib3.connection.HTTPSConnection object at 0x7fc82dd90860\u003e: Failed to resolve 'openaipublic.blob.core.windows.net' ([Errno -2] Name or service not known)\"))"} ``` ![Image](https://github.com/user-attachments/assets/d06fbcb0-962c-4d42-8cd9-d51800e9e0ae) ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo closed this issue 2026-02-21 18:54:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#11065