视觉模型API调用错误，输入的messages没有任何问题

### Reminder

- [x] I have read the above rules and searched the existing issues.

### System Info

使用qwen官方的API没有任何问题，但是llamafactory的API就一直出错：
INFO:     127.0.0.1:46236 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/routing.py", line 714, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/routing.py", line 734, in app
    await route.handle(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/api/app.py", line 110, in create_chat_completion
    return await create_chat_completion_response(request, chat_model)
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/api/chat.py", line 184, in create_chat_completion_response
    responses = await chat_model.achat(
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/chat/chat_model.py", line 92, in achat
    return await self.engine.chat(messages, system, tools, images, videos, audios, **input_kwargs)
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/chat/hf_engine.py", line 366, in chat
    return await asyncio.to_thread(self._chat, *input_args)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/xiaolong/.conda/envs/llama_factory/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/chat/hf_engine.py", line 229, in _chat
    gen_kwargs, prompt_length = HuggingfaceEngine._process_args(
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/chat/hf_engine.py", line 109, in _process_args
    prompt_ids, _ = template.encode_oneturn(tokenizer, paired_messages, system, tools)
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/data/template.py", line 64, in encode_oneturn
    encoded_messages = self._encode(tokenizer, messages, system, tools)
  File "/home/xiaolong/project/LLaMA-Factory/src/llamafactory/data/template.py", line 135, in _encode
    elements += self.format_system.apply(content=(system + tool_text))
TypeError: can only concatenate list (not "str") to list

### Reproduction

```text
Put your message here.
```


### Others

_No response_

Labels: solved
State: closed