图片理解报错Exception:'OllamaImage' object has no attribute 'upload_file_and_get_url'

image
视频理解报错

执行详情看看,报错是图片理解报的错吗,换一个模型测试会出现同样的问题吗


image
模型使用的qwen-vl 32B

看一下/opt/maxkb/logs 看看有没有详细报错

Traceback (most recent call last):
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 434, in hand_event_node_result
list(result)
File “/opt/maxkb-app/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py”, line 41, in write_context_stream
for chunk in response:
File “/opt/py3/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py”, line 510, in stream
for chunk in self._stream(input_messages, stop=stop, **kwargs):
File “/opt/maxkb-app/apps/models_provider/impl/base_chat_open_ai.py”, line 129, in _stream
for chunk in super()._stream(*args, **kwargs):
File “/opt/py3/lib/python3.11/site-packages/langchain_openai/chat_models/base.py”, line 1093, in _stream
response = self.client.create(**payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_utils/_utils.py”, line 286, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/resources/chat/completions/completions.py”, line 1147, in create
return self._post(
^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_base_client.py”, line 1259, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_base_client.py”, line 1047, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: ‘invalid image input’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}
Traceback (most recent call last):
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 434, in hand_event_node_result
list(result)
File “/opt/maxkb-app/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py”, line 41, in write_context_stream
for chunk in response:
File “/opt/py3/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py”, line 510, in stream
for chunk in self._stream(input_messages, stop=stop, **kwargs):
File “/opt/maxkb-app/apps/models_provider/impl/base_chat_open_ai.py”, line 129, in _stream
for chunk in super()._stream(*args, **kwargs):
File “/opt/py3/lib/python3.11/site-packages/langchain_openai/chat_models/base.py”, line 1093, in _stream
response = self.client.create(**payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_utils/_utils.py”, line 286, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/resources/chat/completions/completions.py”, line 1147, in create
return self._post(
^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_base_client.py”, line 1259, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_base_client.py”, line 1047, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: ‘invalid image input’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}
Traceback (most recent call last):
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 434, in hand_event_node_result
list(result)
File “/opt/maxkb-app/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py”, line 41, in write_context_stream
for chunk in response:
File “/opt/py3/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py”, line 510, in stream
for chunk in self._stream(input_messages, stop=stop, **kwargs):
File “/opt/maxkb-app/apps/models_provider/impl/base_chat_open_ai.py”, line 129, in _stream
for chunk in super()._stream(*args, **kwargs):
File “/opt/py3/lib/python3.11/site-packages/langchain_openai/chat_models/base.py”, line 1093, in _stream
response = self.client.create(**payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_utils/_utils.py”, line 286, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/resources/chat/completions/completions.py”, line 1147, in create
return self._post(
^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_base_client.py”, line 1259, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/openai/_base_client.py”, line 1047, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: ‘invalid image input’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}
File “/usr/local/lib/python3.11/threading.py”, line 1002, in _bootstrap
self._bootstrap_inner()
File “/usr/local/lib/python3.11/threading.py”, line 1045, in _bootstrap_inner
self.run()
File “/usr/local/lib/python3.11/threading.py”, line 982, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/lib/python3.11/concurrent/futures/thread.py”, line 83, in _worker
work_item.run()
File “/usr/local/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/opt/py3/lib/python3.11/site-packages/gunicorn/workers/gthread.py”, line 281, in handle
keepalive = self.handle_request(req, conn)
File “/opt/py3/lib/python3.11/site-packages/gunicorn/workers/gthread.py”, line 333, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/wsgi.py”, line 124, in call
response = self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/base.py”, line 140, in get_response
response = self._middleware_chain(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/utils/deprecation.py”, line 120, in call
response = response or self.get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/opt/py3/lib/python3.11/site-packages/django/core/handlers/base.py”, line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/opt/py3/lib/python3.11/site-packages/django/views/decorators/csrf.py”, line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
File “/opt/py3/lib/python3.11/site-packages/django/views/generic/base.py”, line 105, in view
return self.dispatch(request, *args, **kwargs)
File “/opt/py3/lib/python3.11/site-packages/rest_framework/views.py”, line 503, in dispatch
self.initial(request, *args, **kwargs)
File “/opt/py3/lib/python3.11/site-packages/rest_framework/views.py”, line 420, in initial
self.perform_authentication(request)
File “/opt/py3/lib/python3.11/site-packages/rest_framework/views.py”, line 330, in perform_authentication
request.user
File “/opt/py3/lib/python3.11/site-packages/rest_framework/request.py”, line 232, in user
self._authenticate()
File “/opt/py3/lib/python3.11/site-packages/rest_framework/request.py”, line 385, in _authenticate
user_auth_tuple = authenticator.authenticate(self)
File “/opt/maxkb-app/apps/common/auth/authenticate.py”, line 91, in authenticate
traceback.print_stack()
2025-12-09 10:13:27 [log WARNING] Unauthorized: /admin/api/user/profile
Traceback (most recent call last):
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 381, in hand_event_node_result
current_result = node_result_future.result()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 43, in result
raise self.e
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 467, in run_node_future
result = self.run_node(node)
^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 473, in run_node
result = node.run()
^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/i_step_node.py”, line 243, in run
result = self._run()
^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/i_video_understand_node.py”, line 40, in _run
return self.execute(video=res, **self.node_params_serializer.data, **self.flow_params_serializer.data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py”, line 90, in execute
message_list = self.generate_message_list(video_model, system, prompt,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py”, line 189, in generate_message_list
videos = self._process_videos(video, video_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py”, line 182, in _process_videos
url = video_model.upload_file_and_get_url(file.get_bytes(), file.file_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/pydantic/main.py”, line 1026, in getattr
raise AttributeError(f’{type(self).name!r} object has no attribute {item!r}‘)
AttributeError: ‘OllamaImage’ object has no attribute ‘upload_file_and_get_url’
Traceback (most recent call last):
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 381, in hand_event_node_result
current_result = node_result_future.result()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 43, in result
raise self.e
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 467, in run_node_future
result = self.run_node(node)
^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/workflow_manage.py”, line 473, in run_node
result = node.run()
^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/i_step_node.py”, line 243, in run
result = self._run()
^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/i_video_understand_node.py”, line 40, in _run
return self.execute(video=res, **self.node_params_serializer.data, **self.flow_params_serializer.data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py”, line 90, in execute
message_list = self.generate_message_list(video_model, system, prompt,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py”, line 189, in generate_message_list
videos = self._process_videos(video, video_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py”, line 182, in _process_videos
url = video_model.upload_file_and_get_url(file.get_bytes(), file.file_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/py3/lib/python3.11/site-packages/pydantic/main.py”, line 1026, in getattr
raise AttributeError(f’{type(self).name!r} object has no attribute {item!r}')
AttributeError: ‘OllamaImage’ object has no attribute ‘upload_file_and_get_url’

代码调用了 OllamaImage.upload_file_and_get_url(),但你这个 Ollama 本地视觉模型没有这个方法,只有远程 GPT-4V 类的视觉模型才有。 你确认模型类型,看看实例到底是 OllamaImage 还是 OpenAIVision