chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
32.23k stars 5.6k forks source link

无法正常使用图生文功能 #4502

Open seallijian opened 4 months ago

seallijian commented 4 months ago

升级到0.3.1版,发现对于普通文字问答,没问题,但对于有图生文,发现还是无法正常使用,比如我用的InternVL-Chat的模型,,问题都集中在 dialogue的client.chat.completions.create,无论流式输出是true或false,都会提示500错误,建议群主如果确定能支持图生文功能的话,能针对图生文的用法和注意事项给一个详细的解释。

liunux4odoo commented 4 months ago

请把后台 log 信息贴出来

seallijian commented 4 months ago
   await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34891e7a0>
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3485...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7fb348806980>>
          └ <fastapi.routing.APIRouter object at 0x7fb348806980>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34891e7a0>
          │     │      │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3485...
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │     └ <function Route.handle at 0x7fb34d9e84c0>
          └ APIRoute(path='/chat/chat/completions', name='chat_completions', methods=['POST'])
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34891e7a0>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3485...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <function request_response.<locals>.app at 0x7fb3489f0d30>
          └ APIRoute(path='/chat/chat/completions', name='chat_completions', methods=['POST'])
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
          │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34891e7a0>
          │                            │    │        │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3485...
          │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │                            │    └ <starlette.requests.Request object at 0x7fb348525090>
          │                            └ <function request_response.<locals>.app.<locals>.app at 0x7fb348993520>
          └ <function wrap_app_handling_exceptions at 0x7fb34d9a30a0>
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb3485209d0>
          │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3485...
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          └ <function request_response.<locals>.app.<locals>.app at 0x7fb348993520>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
    response = await func(request)
                     │    └ <starlette.requests.Request object at 0x7fb348525090>
                     └ <function get_request_handler.<locals>.app at 0x7fb3489f3250>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
                         └ <function run_endpoint_function at 0x7fb34d9e9360>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
                 │         │      └ {'body': OpenAIChatInput(user=None, extra_headers=None, extra_query=None, extra_json=None, timeout=None, messages=[{'content'...
                 │         └ <function chat_completions at 0x7fb348be13f0>
                 └ <fastapi.dependencies.models.Dependant object at 0x7fb348885f60>

> File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/chat_routes.py", line 185, in chat_completions
    add_message_to_db(
    └ <function add_message_to_db at 0x7fb34a88b250>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/db/session.py", line 28, in wrapper
    result = f(session, *args, **kwargs)
             │ │         │       └ {'chat_type': 'llm_chat', 'query': ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(Type...
             │ │         └ ()
             │ └ <sqlalchemy.orm.session.Session object at 0x7fb3463f94e0>
             └ <function add_message_to_db at 0x7fb34a88b1c0>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/db/repository/message_repository.py", line 32, in add_message_to_db
    session.commit()
    │       └ <function Session.commit at 0x7fb34cafcaf0>
    └ <sqlalchemy.orm.session.Session object at 0x7fb3463f94e0>

  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 2017, in commit
    trans.commit(_to_root=True)
    │     └ <function SessionTransaction.commit at 0x7fb34caefd00>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3463ec680>
  File "<string>", line 2, in commit
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                │  │      │      └ {'_to_root': True}
                │  │      └ ()
                │  └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3463ec680>
                └ <function SessionTransaction.commit at 0x7fb34caefc70>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 1302, in commit
    self._prepare_impl()
    │    └ <function SessionTransaction._prepare_impl at 0x7fb34caefbe0>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3463ec680>
  File "<string>", line 2, in _prepare_impl
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                │  │      │      └ {}
                │  │      └ ()
                │  └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3463ec680>
                └ <function SessionTransaction._prepare_impl at 0x7fb34caefac0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 1277, in _prepare_impl
    self.session.flush()
    │    │       └ <function Session.flush at 0x7fb34cafe830>
    │    └ <sqlalchemy.orm.session.Session object at 0x7fb3463f94e0>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3463ec680>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4341, in flush
    self._flush(objects)
    │    │      └ None
    │    └ <function Session._flush at 0x7fb34cafe9e0>
    └ <sqlalchemy.orm.session.Session object at 0x7fb3463f94e0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4476, in _flush
    with util.safe_reraise():
         │    └ <class 'sqlalchemy.util.langhelpers.safe_reraise'>
         └ <module 'sqlalchemy.util' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__init__.py'>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
          │         │              └ <traceback object at 0x7fb3463e5000>
          │         └ <method 'with_traceback' of 'BaseException' objects>
          └ InterfaceError('(sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.')
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4437, in _flush
    flush_context.execute()
    │             └ <function UOWTransaction.execute at 0x7fb34caecb80>
    └ <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7fb3463f99f0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
    rec.execute(self)
    │   │       └ <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7fb3463f99f0>
    │   └ <function SaveUpdateAll.execute at 0x7fb34caed480>
    └ SaveUpdateAll(Mapper[MessageModel(message)])
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
    util.preloaded.orm_persistence.save_obj(
    │    │         │               └ <function save_obj at 0x7fb34ca7ed40>
    │    │         └ <module 'sqlalchemy.orm.persistence' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py'>
    │    └ <module 'sqlalchemy.util.preloaded' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/preloaded.py'>
    └ <module 'sqlalchemy.util' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__init__.py'>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
    _emit_insert_statements(
    └ <function _emit_insert_statements at 0x7fb34cacc310>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py", line 1233, in _emit_insert_statements
    result = connection.execute(
             │          └ <function Connection.execute at 0x7fb34ce0a5f0>
             └ <sqlalchemy.engine.base.Connection object at 0x7fb3463f9c90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
           └ <bound method ClauseElement._execute_on_connection of <sqlalchemy.sql.dml.Insert object at 0x7fb3463f9a20>>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
           │          └ <function Connection._execute_clauseelement at 0x7fb34ce0a8c0>
           └ <sqlalchemy.engine.base.Connection object at 0x7fb3463f9c90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
          │    └ <function Connection._execute_context at 0x7fb34ce0aa70>
          └ <sqlalchemy.engine.base.Connection object at 0x7fb3463f9c90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
           │    └ <function Connection._exec_single_context at 0x7fb34ce0ab00>
           └ <sqlalchemy.engine.base.Connection object at 0x7fb3463f9c90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
    │    └ <function Connection._handle_dbapi_exception at 0x7fb34ce0ad40>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb3463f9c90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
          │                    │              │                 └ InterfaceError('Error binding parameter 3 - probably unsupported type.')
          │                    │              └ (<class 'sqlite3.InterfaceError'>, InterfaceError('Error binding parameter 3 - probably unsupported type.'), <traceback objec...
          │                    └ <method 'with_traceback' of 'BaseException' objects>
          └ InterfaceError('(sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.')
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
    │    │       └ <function DefaultDialect.do_execute at 0x7fb34dc2dcf0>
    │    └ <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7fb34c993df0>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb3463f9c90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
    │      │       │          └ ('bc2375895a6c469b9745c34329777e9d', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(U...
    │      │       └ 'INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_t...
    │      └ <method 'execute' of 'sqlite3.Cursor' objects>
    └ <sqlite3.Cursor object at 0x7fb3484d6b40>

sqlalchemy.exc.InterfaceError: (sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.
[SQL: INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP) RETURNING create_time]
[parameters: ('bc2375895a6c469b9745c34329777e9d', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(TypedDict(TypedDictValidator { fields: [TypedDictField { name: " ... (2519 characters truncated) ... ow, extras_validator: None, strict: false, loc_by_alias: true }), None)], custom_error: None, strict: false, name: "union[typed-dict,typed-dict]" }))), '', '{}', -1, '')]
(Background on this error at: https://sqlalche.me/e/20/rvf5)
2024-07-15 21:42:04,736 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:04,737 openai._base_client 2241653 INFO     Retrying request to /chat/completions in 0.933136 seconds
2024-07-15 21:42:05,691 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:05,692 openai._base_client 2241653 INFO     Retrying request to /chat/completions in 1.982220 seconds
2024-07-15 21:42:07,697 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
INFO:     127.0.0.1:52204 - "POST /chat/chat/completions HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
    response = await func(request)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/chat_routes.py", line 201, in chat_completions
    return await openai_request(
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/openai_routes.py", line 108, in openai_request
    result = await method(**params)
  File "/usr/local/lib/python3.10/dist-packages/openai/resources/chat/completions.py", line 1289, in create
    return await self._post(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1826, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1519, in request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1605, in _request
    return await self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1651, in _retry_request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1605, in _request
    return await self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1651, in _retry_request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1620, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: Error code: 500 - {'detail': '[address=0.0.0.0:38751, pid=972] None: Max retries exceeded with url: /v1/files/YXNzaXN0YW50cy8yMDI0LTA3LTE1L0JBTkQgVU5EXzEucG5n/content (Caused by None)'}
2024-07-15 21:42:07,705 httpx        2241725 INFO     HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:07,705 openai._base_client 2241725 INFO     Retrying request to /chat/completions in 0.960652 seconds
OpenAIChatInput(
    user=None,
    extra_headers=None,
    extra_query=None,
    extra_json=None,
    timeout=None,
    messages=[
        {
            'content': ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(TypedDict(TypedDictValidator { fields: [TypedDictField { name: "text", lookup_key: Simple { key: "text", py_key: 
Py(0x7fb3488d6330), path: LookupPath([S("text", Py(0x7fb3488d6970))]) }, name_py: Py(0x7fb3b0568b70), required: true, validator: Str(StrValidator { strict: false, coerce_numbers_to_str: false }) }, TypedDictField { name: "type", 
lookup_key: Simple { key: "type", py_key: Py(0x7fb3488d65f0), path: LookupPath([S("type", Py(0x7fb3488d4b30))]) }, name_py: Py(0x7fb3b0548d70), required: true, validator: Literal(LiteralValidator { lookup: LiteralLookup { expected_bool:
None, expected_int: None, expected_str: Some({"text": 0}), expected_py_dict: None, expected_py_values: None, values: [Py(0x7fb3b0568b70)] }, expected_repr: "'text'", name: "literal['text']" }) }], extra_behavior: Allow, 
extras_validator: None, strict: false, loc_by_alias: true }), None), (TypedDict(TypedDictValidator { fields: [TypedDictField { name: "image_url", lookup_key: Simple { key: "image_url", py_key: Py(0x7fb3488d6130), path: 
LookupPath([S("image_url", Py(0x7fb3488d4ef0))]) }, name_py: Py(0x7fb34b2d4730), required: true, validator: TypedDict(TypedDictValidator { fields: [TypedDictField { name: "url", lookup_key: Simple { key: "url", py_key: 
Py(0x7fb3488d4e70), path: LookupPath([S("url", Py(0x7fb3488d4c70))]) }, name_py: Py(0x7fb3b01048f0), required: true, validator: Str(StrValidator { strict: false, coerce_numbers_to_str: false }) }, TypedDictField { name: "detail", 
lookup_key: Simple { key: "detail", py_key: Py(0x7fb3488d6230), path: LookupPath([S("detail", Py(0x7fb3488d60b0))]) }, name_py: Py(0x7fb35eaa8bf0), required: false, validator: Literal(LiteralValidator { lookup: LiteralLookup { 
expected_bool: None, expected_int: None, expected_str: Some({"auto": 0, "low": 1, "high": 2}), expected_py_dict: None, expected_py_values: None, values: [Py(0x7fb3b02ca470), Py(0x7fb3af923b70), Py(0x7fb3af923b30)] }, expected_repr: 
"'auto', 'low' or 'high'", name: "literal['auto','low','high']" }) }], extra_behavior: Allow, extras_validator: None, strict: false, loc_by_alias: true }) }, TypedDictField { name: "type", lookup_key: Simple { key: "type", py_key: 
Py(0x7fb3488d6530), path: LookupPath([S("type", Py(0x7fb3488d6570))]) }, name_py: Py(0x7fb3b0548d70), required: true, validator: Literal(LiteralValidator { lookup: LiteralLookup { expected_bool: None, expected_int: None, expected_str: 
Some({"image_url": 0}), expected_py_dict: None, expected_py_values: None, values: [Py(0x7fb34b2d4730)] }, expected_repr: "'image_url'", name: "literal['image_url']" }) }], extra_behavior: Allow, extras_validator: None, strict: false, 
loc_by_alias: true }), None)], custom_error: None, strict: false, name: "union[typed-dict,typed-dict]" }))),
            'role': 'user'
        }
    ],
    model='internvl-local',
    frequency_penalty=None,
    function_call=None,
    functions=None,
    logit_bias=None,
    logprobs=None,
    max_tokens=None,
    n=None,
    presence_penalty=None,
    response_format=None,
    seed=None,
    stop=None,
    stream=False,
    temperature=0.7,
    tool_choice=None,
    tools=None,
    top_logprobs=None,
    top_p=None,
    metadata=None,
    chat_model_config={
        'preprocess_model': {'glm4-chat': {'model': '', 'temperature': 0.05, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'default', 'callbacks': False}},
        'llm_model': {'glm4-chat': {'model': '', 'temperature': 0.9, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'default', 'callbacks': True}, 'internvl-local': {}},
        'action_model': {'glm4-chat': {'model': '', 'temperature': 0.01, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'ChatGLM3', 'callbacks': True}},
        'postprocess_model': {'glm4-chat': {'model': '', 'temperature': 0.01, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'default', 'callbacks': True}},
        'image_model': {'sd-turbo': {'model': 'sd-turbo', 'size': '256*256'}}
    },
    conversation_id='fa9d40f2a5494d4d8b886dfe2aac66d8',
    tool_input={},
    upload_image={'id': 'YXNzaXN0YW50cy8yMDI0LTA3LTE1L0JBTkQgVU5EXzEucG5n', 'bytes': 630766, 'created_at': 1721050914, 'filename': 'BAND UND_1.png', 'object': 'file', 'purpose': 'assistants'}
)
2024-07-15 21:42:08.879 | ERROR    | chatchat.server.api_server.chat_routes:chat_completions:194 - failed to add message to db
Traceback (most recent call last):

  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
    │    │       └ <function DefaultDialect.do_execute at 0x7fb34dc2dcf0>
    │    └ <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7fb34c993df0>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb3457921a0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
    │      │       │          └ ('6331db9ee177429db3f906091b32341b', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(U...
    │      │       └ 'INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_t...
    │      └ <method 'execute' of 'sqlite3.Cursor' objects>
    └ <sqlite3.Cursor object at 0x7fb34616bc40>

sqlite3.InterfaceError: Error binding parameter 3 - probably unsupported type.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               │     │   └ 3
               │     └ 20
               └ <function _main at 0x7fb3b015eef0>
  File "/usr/lib/python3.10/multiprocessing/spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
           │    │          └ 3
           │    └ <function BaseProcess._bootstrap at 0x7fb3b02e20e0>
           └ <Process name='API Server' parent=2241537 started>
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
    │    └ <function BaseProcess.run at 0x7fb3b02e1750>
    └ <Process name='API Server' parent=2241537 started>
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    │    │        │    │        │    └ {'started_event': <EventProxy object, typeid 'Event' at 0x7fb3b019a3b0>, 'run_mode': None}
    │    │        │    │        └ <Process name='API Server' parent=2241537 started>
    │    │        │    └ ()
    │    │        └ <Process name='API Server' parent=2241537 started>
    │    └ <function run_api_server at 0x7fb34d303130>
    └ <Process name='API Server' parent=2241537 started>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/startup.py", line 70, in run_api_server
    uvicorn.run(app, host=host, port=port)
    │       │   │         │          └ 7861
    │       │   │         └ '127.0.0.1'
    │       │   └ <fastapi.applications.FastAPI object at 0x7fb348a3ca00>
    │       └ <function run at 0x7fb34a772200>
    └ <module 'uvicorn' from '/usr/local/lib/python3.10/dist-packages/uvicorn/__init__.py'>

  File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 575, in run
    server.run()
    │      └ <function Server.run at 0x7fb34a771b40>
    └ <uvicorn.server.Server object at 0x7fb3487e1930>
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x7fb34a771bd0>
           │       │   └ <uvicorn.server.Server object at 0x7fb3487e1930>
           │       └ <function run at 0x7fb3b008d1b0>
           └ <module 'asyncio' from '/usr/lib/python3.10/asyncio/__init__.py'>
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x7fb34887f680>
           │    └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           └ <uvloop.Loop running=True closed=False debug=False>
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
                   └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7fb34847d090>
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
                 │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460f78...
                 │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
                 │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
                 │    └ <fastapi.applications.FastAPI object at 0x7fb348a3ca00>
                 └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7fb34847d090>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460f78...
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
  File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460f78...
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7fb3484eb820>
          └ <fastapi.applications.FastAPI object at 0x7fb348a3ca00>
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
          │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fb34615b2e0>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7fb3484eb850>
          └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7fb3484eb820>
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
          │                            │    │    │     │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fb34615b2e0>
          │                            │    │    │     │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │                            │    │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │                            │    │    └ <starlette.requests.Request object at 0x7fb3460f7940>
          │                            │    └ <fastapi.routing.APIRouter object at 0x7fb348806980>
          │                            └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7fb3484eb850>
          └ <function wrap_app_handling_exceptions at 0x7fb34d9a30a0>
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34615b370>
          │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          └ <fastapi.routing.APIRouter object at 0x7fb348806980>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34615b370>
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7fb348806980>>
          └ <fastapi.routing.APIRouter object at 0x7fb348806980>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34615b370>
          │     │      │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │     └ <function Route.handle at 0x7fb34d9e84c0>
          └ APIRoute(path='/chat/chat/completions', name='chat_completions', methods=['POST'])
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34615b370>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <function request_response.<locals>.app at 0x7fb3489f0d30>
          └ APIRoute(path='/chat/chat/completions', name='chat_completions', methods=['POST'])
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
          │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34615b370>
          │                            │    │        │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │                            │    └ <starlette.requests.Request object at 0x7fb3460f7af0>
          │                            └ <function request_response.<locals>.app.<locals>.app at 0x7fb34615b400>
          └ <function wrap_app_handling_exceptions at 0x7fb34d9a30a0>
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb34615b490>
          │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3460...
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          └ <function request_response.<locals>.app.<locals>.app at 0x7fb34615b400>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
    response = await func(request)
                     │    └ <starlette.requests.Request object at 0x7fb3460f7af0>
                     └ <function get_request_handler.<locals>.app at 0x7fb3489f3250>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
                         └ <function run_endpoint_function at 0x7fb34d9e9360>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
                 │         │      └ {'body': OpenAIChatInput(user=None, extra_headers=None, extra_query=None, extra_json=None, timeout=None, messages=[{'content'...
                 │         └ <function chat_completions at 0x7fb348be13f0>
                 └ <fastapi.dependencies.models.Dependant object at 0x7fb348885f60>

> File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/chat_routes.py", line 185, in chat_completions
    add_message_to_db(
    └ <function add_message_to_db at 0x7fb34a88b250>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/db/session.py", line 28, in wrapper
    result = f(session, *args, **kwargs)
             │ │         │       └ {'chat_type': 'llm_chat', 'query': ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(Type...
             │ │         └ ()
             │ └ <sqlalchemy.orm.session.Session object at 0x7fb345791de0>
             └ <function add_message_to_db at 0x7fb34a88b1c0>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/db/repository/message_repository.py", line 32, in add_message_to_db
    session.commit()
    │       └ <function Session.commit at 0x7fb34cafcaf0>
    └ <sqlalchemy.orm.session.Session object at 0x7fb345791de0>

  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 2017, in commit
    trans.commit(_to_root=True)
    │     └ <function SessionTransaction.commit at 0x7fb34caefd00>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3457e03c0>
  File "<string>", line 2, in commit
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                │  │      │      └ {'_to_root': True}
                │  │      └ ()
                │  └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3457e03c0>
                └ <function SessionTransaction.commit at 0x7fb34caefc70>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 1302, in commit
    self._prepare_impl()
    │    └ <function SessionTransaction._prepare_impl at 0x7fb34caefbe0>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3457e03c0>
  File "<string>", line 2, in _prepare_impl
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                │  │      │      └ {}
                │  │      └ ()
                │  └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3457e03c0>
                └ <function SessionTransaction._prepare_impl at 0x7fb34caefac0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 1277, in _prepare_impl
    self.session.flush()
    │    │       └ <function Session.flush at 0x7fb34cafe830>
    │    └ <sqlalchemy.orm.session.Session object at 0x7fb345791de0>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3457e03c0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4341, in flush
    self._flush(objects)
    │    │      └ None
    │    └ <function Session._flush at 0x7fb34cafe9e0>
    └ <sqlalchemy.orm.session.Session object at 0x7fb345791de0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4476, in _flush
    with util.safe_reraise():
         │    └ <class 'sqlalchemy.util.langhelpers.safe_reraise'>
         └ <module 'sqlalchemy.util' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__init__.py'>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
          │         │              └ <traceback object at 0x7fb345798c00>
          │         └ <method 'with_traceback' of 'BaseException' objects>
          └ InterfaceError('(sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.')
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4437, in _flush
    flush_context.execute()
    │             └ <function UOWTransaction.execute at 0x7fb34caecb80>
    └ <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7fb3457920b0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
    rec.execute(self)
    │   │       └ <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7fb3457920b0>
    │   └ <function SaveUpdateAll.execute at 0x7fb34caed480>
    └ SaveUpdateAll(Mapper[MessageModel(message)])
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
    util.preloaded.orm_persistence.save_obj(
    │    │         │               └ <function save_obj at 0x7fb34ca7ed40>
    │    │         └ <module 'sqlalchemy.orm.persistence' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py'>
    │    └ <module 'sqlalchemy.util.preloaded' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/preloaded.py'>
    └ <module 'sqlalchemy.util' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__init__.py'>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
    _emit_insert_statements(
    └ <function _emit_insert_statements at 0x7fb34cacc310>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py", line 1233, in _emit_insert_statements
    result = connection.execute(
             │          └ <function Connection.execute at 0x7fb34ce0a5f0>
             └ <sqlalchemy.engine.base.Connection object at 0x7fb3457921a0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
           └ <bound method ClauseElement._execute_on_connection of <sqlalchemy.sql.dml.Insert object at 0x7fb345792350>>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
           │          └ <function Connection._execute_clauseelement at 0x7fb34ce0a8c0>
           └ <sqlalchemy.engine.base.Connection object at 0x7fb3457921a0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
          │    └ <function Connection._execute_context at 0x7fb34ce0aa70>
          └ <sqlalchemy.engine.base.Connection object at 0x7fb3457921a0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
           │    └ <function Connection._exec_single_context at 0x7fb34ce0ab00>
           └ <sqlalchemy.engine.base.Connection object at 0x7fb3457921a0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
    │    └ <function Connection._handle_dbapi_exception at 0x7fb34ce0ad40>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb3457921a0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
          │                    │              │                 └ InterfaceError('Error binding parameter 3 - probably unsupported type.')
          │                    │              └ (<class 'sqlite3.InterfaceError'>, InterfaceError('Error binding parameter 3 - probably unsupported type.'), <traceback objec...
          │                    └ <method 'with_traceback' of 'BaseException' objects>
          └ InterfaceError('(sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.')
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
    │    │       └ <function DefaultDialect.do_execute at 0x7fb34dc2dcf0>
    │    └ <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7fb34c993df0>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb3457921a0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
    │      │       │          └ ('6331db9ee177429db3f906091b32341b', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(U...
    │      │       └ 'INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_t...
    │      └ <method 'execute' of 'sqlite3.Cursor' objects>
    └ <sqlite3.Cursor object at 0x7fb34616bc40>

sqlalchemy.exc.InterfaceError: (sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.
[SQL: INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP) RETURNING create_time]
[parameters: ('6331db9ee177429db3f906091b32341b', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(TypedDict(TypedDictValidator { fields: [TypedDictField { name: " ... (2519 characters truncated) ... ow, extras_validator: None, strict: false, loc_by_alias: true }), None)], custom_error: None, strict: false, name: "union[typed-dict,typed-dict]" }))), '', '{}', -1, '')]
(Background on this error at: https://sqlalche.me/e/20/rvf5)
2024-07-15 21:42:09,019 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:09,019 openai._base_client 2241653 INFO     Retrying request to /chat/completions in 0.986725 seconds
2024-07-15 21:42:10,030 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:10,032 openai._base_client 2241653 INFO     Retrying request to /chat/completions in 1.832630 seconds
2024-07-15 21:42:11,886 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
INFO:     127.0.0.1:43198 - "POST /chat/chat/completions HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
    response = await func(request)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/chat_routes.py", line 201, in chat_completions
    return await openai_request(
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/openai_routes.py", line 108, in openai_request
    result = await method(**params)
  File "/usr/local/lib/python3.10/dist-packages/openai/resources/chat/completions.py", line 1289, in create
    return await self._post(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1826, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1519, in request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1605, in _request
    return await self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1651, in _retry_request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1605, in _request
    return await self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1651, in _retry_request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1620, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: Error code: 500 - {'detail': '[address=0.0.0.0:38751, pid=972] None: Max retries exceeded with url: /v1/files/YXNzaXN0YW50cy8yMDI0LTA3LTE1L0JBTkQgVU5EXzEucG5n/content (Caused by None)'}
2024-07-15 21:42:11,890 httpx        2241725 INFO     HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:11,890 openai._base_client 2241725 INFO     Retrying request to /chat/completions in 1.806832 seconds
OpenAIChatInput(
    user=None,
    extra_headers=None,
    extra_query=None,
    extra_json=None,
    timeout=None,
    messages=[
        {
            'content': ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(TypedDict(TypedDictValidator { fields: [TypedDictField { name: "text", lookup_key: Simple { key: "text", py_key: 
Py(0x7fb3488d6330), path: LookupPath([S("text", Py(0x7fb3488d6970))]) }, name_py: Py(0x7fb3b0568b70), required: true, validator: Str(StrValidator { strict: false, coerce_numbers_to_str: false }) }, TypedDictField { name: "type", 
lookup_key: Simple { key: "type", py_key: Py(0x7fb3488d65f0), path: LookupPath([S("type", Py(0x7fb3488d4b30))]) }, name_py: Py(0x7fb3b0548d70), required: true, validator: Literal(LiteralValidator { lookup: LiteralLookup { expected_bool:
None, expected_int: None, expected_str: Some({"text": 0}), expected_py_dict: None, expected_py_values: None, values: [Py(0x7fb3b0568b70)] }, expected_repr: "'text'", name: "literal['text']" }) }], extra_behavior: Allow, 
extras_validator: None, strict: false, loc_by_alias: true }), None), (TypedDict(TypedDictValidator { fields: [TypedDictField { name: "image_url", lookup_key: Simple { key: "image_url", py_key: Py(0x7fb3488d6130), path: 
LookupPath([S("image_url", Py(0x7fb3488d4ef0))]) }, name_py: Py(0x7fb34b2d4730), required: true, validator: TypedDict(TypedDictValidator { fields: [TypedDictField { name: "url", lookup_key: Simple { key: "url", py_key: 
Py(0x7fb3488d4e70), path: LookupPath([S("url", Py(0x7fb3488d4c70))]) }, name_py: Py(0x7fb3b01048f0), required: true, validator: Str(StrValidator { strict: false, coerce_numbers_to_str: false }) }, TypedDictField { name: "detail", 
lookup_key: Simple { key: "detail", py_key: Py(0x7fb3488d6230), path: LookupPath([S("detail", Py(0x7fb3488d60b0))]) }, name_py: Py(0x7fb35eaa8bf0), required: false, validator: Literal(LiteralValidator { lookup: LiteralLookup { 
expected_bool: None, expected_int: None, expected_str: Some({"auto": 0, "low": 1, "high": 2}), expected_py_dict: None, expected_py_values: None, values: [Py(0x7fb3b02ca470), Py(0x7fb3af923b70), Py(0x7fb3af923b30)] }, expected_repr: 
"'auto', 'low' or 'high'", name: "literal['auto','low','high']" }) }], extra_behavior: Allow, extras_validator: None, strict: false, loc_by_alias: true }) }, TypedDictField { name: "type", lookup_key: Simple { key: "type", py_key: 
Py(0x7fb3488d6530), path: LookupPath([S("type", Py(0x7fb3488d6570))]) }, name_py: Py(0x7fb3b0548d70), required: true, validator: Literal(LiteralValidator { lookup: LiteralLookup { expected_bool: None, expected_int: None, expected_str: 
Some({"image_url": 0}), expected_py_dict: None, expected_py_values: None, values: [Py(0x7fb34b2d4730)] }, expected_repr: "'image_url'", name: "literal['image_url']" }) }], extra_behavior: Allow, extras_validator: None, strict: false, 
loc_by_alias: true }), None)], custom_error: None, strict: false, name: "union[typed-dict,typed-dict]" }))),
            'role': 'user'
        }
    ],
    model='internvl-local',
    frequency_penalty=None,
    function_call=None,
    functions=None,
    logit_bias=None,
    logprobs=None,
    max_tokens=None,
    n=None,
    presence_penalty=None,
    response_format=None,
    seed=None,
    stop=None,
    stream=False,
    temperature=0.7,
    tool_choice=None,
    tools=None,
    top_logprobs=None,
    top_p=None,
    metadata=None,
    chat_model_config={
        'preprocess_model': {'glm4-chat': {'model': '', 'temperature': 0.05, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'default', 'callbacks': False}},
        'llm_model': {'glm4-chat': {'model': '', 'temperature': 0.9, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'default', 'callbacks': True}, 'internvl-local': {}},
        'action_model': {'glm4-chat': {'model': '', 'temperature': 0.01, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'ChatGLM3', 'callbacks': True}},
        'postprocess_model': {'glm4-chat': {'model': '', 'temperature': 0.01, 'max_tokens': 4096, 'history_len': 10, 'prompt_name': 'default', 'callbacks': True}},
        'image_model': {'sd-turbo': {'model': 'sd-turbo', 'size': '256*256'}}
    },
    conversation_id='fa9d40f2a5494d4d8b886dfe2aac66d8',
    tool_input={},
    upload_image={'id': 'YXNzaXN0YW50cy8yMDI0LTA3LTE1L0JBTkQgVU5EXzEucG5n', 'bytes': 630766, 'created_at': 1721050914, 'filename': 'BAND UND_1.png', 'object': 'file', 'purpose': 'assistants'}
)
2024-07-15 21:42:13.918 | ERROR    | chatchat.server.api_server.chat_routes:chat_completions:194 - failed to add message to db
Traceback (most recent call last):

  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
    │    │       └ <function DefaultDialect.do_execute at 0x7fb34dc2dcf0>
    │    └ <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7fb34c993df0>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb349a5ab90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
    │      │       │          └ ('0e22c3e7428a4ea58a779ec8644d6ce3', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(U...
    │      │       └ 'INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_t...
    │      └ <method 'execute' of 'sqlite3.Cursor' objects>
    └ <sqlite3.Cursor object at 0x7fb34616b9c0>

sqlite3.InterfaceError: Error binding parameter 3 - probably unsupported type.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               │     │   └ 3
               │     └ 20
               └ <function _main at 0x7fb3b015eef0>
  File "/usr/lib/python3.10/multiprocessing/spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
           │    │          └ 3
           │    └ <function BaseProcess._bootstrap at 0x7fb3b02e20e0>
           └ <Process name='API Server' parent=2241537 started>
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
    │    └ <function BaseProcess.run at 0x7fb3b02e1750>
    └ <Process name='API Server' parent=2241537 started>
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    │    │        │    │        │    └ {'started_event': <EventProxy object, typeid 'Event' at 0x7fb3b019a3b0>, 'run_mode': None}
    │    │        │    │        └ <Process name='API Server' parent=2241537 started>
    │    │        │    └ ()
    │    │        └ <Process name='API Server' parent=2241537 started>
    │    └ <function run_api_server at 0x7fb34d303130>
    └ <Process name='API Server' parent=2241537 started>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/startup.py", line 70, in run_api_server
    uvicorn.run(app, host=host, port=port)
    │       │   │         │          └ 7861
    │       │   │         └ '127.0.0.1'
    │       │   └ <fastapi.applications.FastAPI object at 0x7fb348a3ca00>
    │       └ <function run at 0x7fb34a772200>
    └ <module 'uvicorn' from '/usr/local/lib/python3.10/dist-packages/uvicorn/__init__.py'>

  File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 575, in run
    server.run()
    │      └ <function Server.run at 0x7fb34a771b40>
    └ <uvicorn.server.Server object at 0x7fb3487e1930>
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x7fb34a771bd0>
           │       │   └ <uvicorn.server.Server object at 0x7fb3487e1930>
           │       └ <function run at 0x7fb3b008d1b0>
           └ <module 'asyncio' from '/usr/lib/python3.10/asyncio/__init__.py'>
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x7fb34887f680>
           │    └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           └ <uvloop.Loop running=True closed=False debug=False>
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
                   └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7fb34847d090>
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
                 │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457b66...
                 │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
                 │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
                 │    └ <fastapi.applications.FastAPI object at 0x7fb348a3ca00>
                 └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7fb34847d090>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457b66...
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
  File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457b66...
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7fb3484eb820>
          └ <fastapi.applications.FastAPI object at 0x7fb348a3ca00>
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
          │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fb3457ecd30>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7fb3484eb850>
          └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7fb3484eb820>
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
          │                            │    │    │     │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fb3457ecd30>
          │                            │    │    │     │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │                            │    │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │                            │    │    └ <starlette.requests.Request object at 0x7fb3457b6770>
          │                            │    └ <fastapi.routing.APIRouter object at 0x7fb348806980>
          │                            └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7fb3484eb850>
          └ <function wrap_app_handling_exceptions at 0x7fb34d9a30a0>
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb3457ece50>
          │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          └ <fastapi.routing.APIRouter object at 0x7fb348806980>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb3457ece50>
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7fb348806980>>
          └ <fastapi.routing.APIRouter object at 0x7fb348806980>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb3457ece50>
          │     │      │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │     └ <function Route.handle at 0x7fb34d9e84c0>
          └ APIRoute(path='/chat/chat/completions', name='chat_completions', methods=['POST'])
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb3457ece50>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │    └ <function request_response.<locals>.app at 0x7fb3489f0d30>
          └ APIRoute(path='/chat/chat/completions', name='chat_completions', methods=['POST'])
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
          │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb3457ece50>
          │                            │    │        │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          │                            │    └ <starlette.requests.Request object at 0x7fb3457b6920>
          │                            └ <function request_response.<locals>.app.<locals>.app at 0x7fb3457ecaf0>
          └ <function wrap_app_handling_exceptions at 0x7fb34d9a30a0>
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7fb3457ecdc0>
          │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7fb3457...
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('127.0.0.1', 7861), 'cl...
          └ <function request_response.<locals>.app.<locals>.app at 0x7fb3457ecaf0>
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
    response = await func(request)
                     │    └ <starlette.requests.Request object at 0x7fb3457b6920>
                     └ <function get_request_handler.<locals>.app at 0x7fb3489f3250>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
                         └ <function run_endpoint_function at 0x7fb34d9e9360>
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
                 │         │      └ {'body': OpenAIChatInput(user=None, extra_headers=None, extra_query=None, extra_json=None, timeout=None, messages=[{'content'...
                 │         └ <function chat_completions at 0x7fb348be13f0>
                 └ <fastapi.dependencies.models.Dependant object at 0x7fb348885f60>

> File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/chat_routes.py", line 185, in chat_completions
    add_message_to_db(
    └ <function add_message_to_db at 0x7fb34a88b250>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/db/session.py", line 28, in wrapper
    result = f(session, *args, **kwargs)
             │ │         │       └ {'chat_type': 'llm_chat', 'query': ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(Type...
             │ │         └ ()
             │ └ <sqlalchemy.orm.session.Session object at 0x7fb3457901f0>
             └ <function add_message_to_db at 0x7fb34a88b1c0>

  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/db/repository/message_repository.py", line 32, in add_message_to_db
    session.commit()
    │       └ <function Session.commit at 0x7fb34cafcaf0>
    └ <sqlalchemy.orm.session.Session object at 0x7fb3457901f0>

  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 2017, in commit
    trans.commit(_to_root=True)
    │     └ <function SessionTransaction.commit at 0x7fb34caefd00>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3460b9280>
  File "<string>", line 2, in commit
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                │  │      │      └ {'_to_root': True}
                │  │      └ ()
                │  └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3460b9280>
                └ <function SessionTransaction.commit at 0x7fb34caefc70>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 1302, in commit
    self._prepare_impl()
    │    └ <function SessionTransaction._prepare_impl at 0x7fb34caefbe0>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3460b9280>
  File "<string>", line 2, in _prepare_impl
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                │  │      │      └ {}
                │  │      └ ()
                │  └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3460b9280>
                └ <function SessionTransaction._prepare_impl at 0x7fb34caefac0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 1277, in _prepare_impl
    self.session.flush()
    │    │       └ <function Session.flush at 0x7fb34cafe830>
    │    └ <sqlalchemy.orm.session.Session object at 0x7fb3457901f0>
    └ <sqlalchemy.orm.session.SessionTransaction object at 0x7fb3460b9280>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4341, in flush
    self._flush(objects)
    │    │      └ None
    │    └ <function Session._flush at 0x7fb34cafe9e0>
    └ <sqlalchemy.orm.session.Session object at 0x7fb3457901f0>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4476, in _flush
    with util.safe_reraise():
         │    └ <class 'sqlalchemy.util.langhelpers.safe_reraise'>
         └ <module 'sqlalchemy.util' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__init__.py'>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
          │         │              └ <traceback object at 0x7fb3457e3340>
          │         └ <method 'with_traceback' of 'BaseException' objects>
          └ InterfaceError('(sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.')
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 4437, in _flush
    flush_context.execute()
    │             └ <function UOWTransaction.execute at 0x7fb34caecb80>
    └ <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7fb345791e70>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
    rec.execute(self)
    │   │       └ <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7fb345791e70>
    │   └ <function SaveUpdateAll.execute at 0x7fb34caed480>
    └ SaveUpdateAll(Mapper[MessageModel(message)])
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
    util.preloaded.orm_persistence.save_obj(
    │    │         │               └ <function save_obj at 0x7fb34ca7ed40>
    │    │         └ <module 'sqlalchemy.orm.persistence' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py'>
    │    └ <module 'sqlalchemy.util.preloaded' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/preloaded.py'>
    └ <module 'sqlalchemy.util' from '/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__init__.py'>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
    _emit_insert_statements(
    └ <function _emit_insert_statements at 0x7fb34cacc310>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/persistence.py", line 1233, in _emit_insert_statements
    result = connection.execute(
             │          └ <function Connection.execute at 0x7fb34ce0a5f0>
             └ <sqlalchemy.engine.base.Connection object at 0x7fb349a5ab90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
           └ <bound method ClauseElement._execute_on_connection of <sqlalchemy.sql.dml.Insert object at 0x7fb3460f7430>>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
           │          └ <function Connection._execute_clauseelement at 0x7fb34ce0a8c0>
           └ <sqlalchemy.engine.base.Connection object at 0x7fb349a5ab90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
          │    └ <function Connection._execute_context at 0x7fb34ce0aa70>
          └ <sqlalchemy.engine.base.Connection object at 0x7fb349a5ab90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
           │    └ <function Connection._exec_single_context at 0x7fb34ce0ab00>
           └ <sqlalchemy.engine.base.Connection object at 0x7fb349a5ab90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
    │    └ <function Connection._handle_dbapi_exception at 0x7fb34ce0ad40>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb349a5ab90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
          │                    │              │                 └ InterfaceError('Error binding parameter 3 - probably unsupported type.')
          │                    │              └ (<class 'sqlite3.InterfaceError'>, InterfaceError('Error binding parameter 3 - probably unsupported type.'), <traceback objec...
          │                    └ <method 'with_traceback' of 'BaseException' objects>
          └ InterfaceError('(sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.')
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
    │    │       └ <function DefaultDialect.do_execute at 0x7fb34dc2dcf0>
    │    └ <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7fb34c993df0>
    └ <sqlalchemy.engine.base.Connection object at 0x7fb349a5ab90>
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
    │      │       │          └ ('0e22c3e7428a4ea58a779ec8644d6ce3', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(U...
    │      │       └ 'INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_t...
    │      └ <method 'execute' of 'sqlite3.Cursor' objects>
    └ <sqlite3.Cursor object at 0x7fb34616b9c0>

sqlalchemy.exc.InterfaceError: (sqlite3.InterfaceError) Error binding parameter 3 - probably unsupported type.
[SQL: INSERT INTO message (id, conversation_id, chat_type, "query", response, meta_data, feedback_score, feedback_reason, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP) RETURNING create_time]
[parameters: ('0e22c3e7428a4ea58a779ec8644d6ce3', 'fa9d40f2a5494d4d8b886dfe2aac66d8', 'llm_chat', ValidatorIterator(index=0, schema=Some(Union(UnionValidator { mode: Smart, choices: [(TypedDict(TypedDictValidator { fields: [TypedDictField { name: " ... (2519 characters truncated) ... ow, extras_validator: None, strict: false, loc_by_alias: true }), None)], custom_error: None, strict: false, name: "union[typed-dict,typed-dict]" }))), '', '{}', -1, '')]
(Background on this error at: https://sqlalche.me/e/20/rvf5)
2024-07-15 21:42:14,059 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:14,060 openai._base_client 2241653 INFO     Retrying request to /chat/completions in 0.998926 seconds
2024-07-15 21:42:15,080 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:15,081 openai._base_client 2241653 INFO     Retrying request to /chat/completions in 1.523645 seconds
2024-07-15 21:42:16,626 httpx        2241653 INFO     HTTP Request: POST http://127.0.0.1:9997/v1/chat/completions "HTTP/1.1 500 Internal Server Error"
INFO:     127.0.0.1:43242 - "POST /chat/chat/completions HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
    response = await func(request)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/chat_routes.py", line 201, in chat_completions
    return await openai_request(
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/server/api_server/openai_routes.py", line 108, in openai_request
    result = await method(**params)
  File "/usr/local/lib/python3.10/dist-packages/openai/resources/chat/completions.py", line 1289, in create
    return await self._post(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1826, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1519, in request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1605, in _request
    return await self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1651, in _retry_request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1605, in _request
    return await self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1651, in _retry_request
    return await self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1620, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: Error code: 500 - {'detail': '[address=0.0.0.0:38751, pid=972] None: Max retries exceeded with url: /v1/files/YXNzaXN0YW50cy8yMDI0LTA3LTE1L0JBTkQgVU5EXzEucG5n/content (Caused by None)'}
2024-07-15 21:42:16,630 httpx        2241725 INFO     HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error"
2024-07-15 21:42:16.632 Uncaught app exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
    exec(code, module.__dict__)
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/webui.py", line 73, in <module>
    dialogue_page(api=api, is_lite=is_lite)
  File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/webui_pages/dialogue/dialogue.py", line 528, in dialogue_page
    d =client.chat.completions.create(
  File "/usr/local/lib/python3.10/dist-packages/openai/_utils/_utils.py", line 277, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/openai/resources/chat/completions.py", line 643, in create
    return self._post(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1266, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 942, in request
    return self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1031, in _request
    return self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1079, in _retry_request
    return self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1031, in _request
    return self._retry_request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1079, in _retry_request
    return self._request(
  File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1046, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: Internal Server Error
liunux4odoo commented 4 months ago

你能不能更新到最新版试一下?图片对话无法存入 history database的问题之前已经处理过,我这边用 qwen-vl-chat 试了一下,后台还是会提醒这个错误,但不影响正常功能。

skywalkerfmc commented 4 months ago

我这里后台也会提示这个错误,但是前端页面能正常输出

zx1159652666 commented 4 months ago

不支持cogvlm2么,会报错openai.InternalServerError: Error code: 500 - {'error': {'message': ' (request id: 2024071610002832401115326319614)', 'type': 'upstream_error', 'param': '500', 'code': 'bad_response_status_code'}}

是因为输入需要是base64格式的字符串么

seallijian commented 4 months ago

我用的是昨晚最新更新的版本,提示如下 return await self._request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1605, in _request return await self._retry_request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1651, in _retry_request return await self._request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1620, in _request raise self._make_status_error_from_response(err.response) from None openai.InternalServerError: Error code: 500 - {'detail': '[address=0.0.0.0:42269, pid=1241] None: Max retries exceeded with url: /v1/files/YXNzaXN0YW50cy8yMDI0LTA3LTE2L0JBTkQgVU5EXzEucG5n/content (Caused by None)'} 2024-07-16 10:34:39,623 httpx 2338612 INFO HTTP Request: POST http://127.0.0.1:7861/chat/chat/completions "HTTP/1.1 500 Internal Server Error" 2024-07-16 10:34:39.625 Uncaught app exception Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script exec(code, module.dict) File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/webui.py", line 73, in dialogue_page(api=api, is_lite=is_lite) File "/usr/share/nginx/html/glm5/libs/chatchat-server/chatchat/webui_pages/dialogue/dialogue.py", line 528, in dialogue_page d =client.chat.completions.create( File "/usr/local/lib/python3.10/dist-packages/openai/_utils/_utils.py", line 277, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/openai/resources/chat/completions.py", line 643, in create return self._post( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1266, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 942, in request return self._request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1031, in _request return self._retry_request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1079, in _retry_request return self._request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1031, in _request return self._retry_request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1079, in _retry_request return self._request( File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1046, in _request raise self._make_status_error_from_response(err.response) from None openai.InternalServerError: Internal Server Error

seallijian commented 4 months ago

发现这个跟图片的那个网址有关,如果访问一个外部图片网址,没问题,但如果按代码访问本机临时生成的那个图片网址,则会报错,即使浏览器能正常打开那个图片网址,不知道openai访问本机网址是不是被屏蔽了,还是什么其他原因,感觉跟nginx可能有点关系,但还没有头绪该怎么修改

seallijian commented 4 months ago

为了验证,我做了一个测试程序,我把下面的图片地址换成百度,bing搜到公网图片网址都没问题,但只要换成chatchat代码get_image_file_url生成的那个临时网址就出错。

import openai

client=openai.Client(api_key="None",base_url=f"http://127.0.0.1:9997/v1")

resp=client.chat.completions.create(model="internvl2-local",messages=[{"role":"user","content":[{"type":"text","text":"这个图片是什么?"},{"type":"image_url","image_url":{"url":"https://chatchat服务器:port/image/图片.jpg"}}]}]) print(resp)

seallijian commented 4 months ago

出错提示为openai.InternalServerError: Error code: 500 - {'detail': '[address=0.0.0.0:39547, pid=1845] None: Max retries exceeded with url: /v1/files/YXNzaXN0YW50cy8yMDI0LTA3LTIxLzNXQS5wbmc=/content (Caused by None)'}

Bo-LiangD commented 3 months ago

我无法正常使用 他出现了 RuntimeError: Failed to generate chat completion, detail: [address=127.0.0.1:37257, pid=50009] Invalid prompt style: 但是我设置了 默认 default 也没有效果 是需要额外在配置什么嘛

sy960923 commented 3 months ago

修改 dialogue.py 这个方法 get_image_file_url 重新运行了项目也没反应为啥?

jiusi9 commented 3 months ago

遇到了同样的问题,求解

None: Max retries exceeded with url: /v1/files/zEucGn/content (Caused by None)'}
2024-08-15 21:42:16,630 httpx        2241725 INFO     HTTP Request: POST http://127.0.0.1:6565/chat/chat/completions "HTTP/1.1 500 Internal Server Error"