MaxKB
MaxKB copied to clipboard
[BUG]value too long for type character varying(1024)
联系方式
No response
MaxKB 版本
4月16日docker安装的最新版本
问题描述
在chat中输如较长内容进行分析,会在生成输出的过程中报错:django.db.utils.DataError: value too long for type character varying(1024)。
重现步骤
重现步骤同问题描述
期待的正确结果
从日志报错的情况看,应该对应保存结果内容的字段上限为1024,导致出错。希望能提高该字段长度,以适应长上下文分析的场景。
相关日志输出
2024-04-17 14:12:09 [base_chat_step ERROR] value too long for type character varying(1024)
:Traceback (most recent call last):
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.StringDataRightTruncation: value too long for type character varying(1024)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/maxkb/app/apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py", line 69, in event_content
post_response_handler.handler(chat_id, chat_record_id, paragraph_list, problem_text,
File "/opt/maxkb/app/apps/application/serializers/chat_message_serializers.py", line 125, in handler
chat_info.append_chat_record(chat_record, client_id)
File "/opt/maxkb/app/apps/application/serializers/chat_message_serializers.py", line 99, in append_chat_record
chat_record.save()
File "/opt/py3/lib/python3.11/site-packages/django/db/models/base.py", line 812, in save
self.save_base(
File "/opt/py3/lib/python3.11/site-packages/django/db/models/base.py", line 863, in save_base
updated = self._save_table(
^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/models/base.py", line 1006, in _save_table
results = self._do_insert(
^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/models/base.py", line 1047, in _do_insert
return manager._insert(
^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/models/query.py", line 1791, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1660, in execute_sql
cursor.execute(sql, params)
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/py3/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.DataError: value too long for type character varying(1024)
附加信息
No response
感谢反馈,确认为bug,后面版本优化处理限制用户问题长度1024超过无法提问。
该问题已在 v1.0.3解决。