Skip to content

Commit bbf5c7b

Browse files
authored
Increase max text length (#2436)
1 parent 9039070 commit bbf5c7b

2 files changed

Lines changed: 59 additions & 4 deletions

File tree

chatterbot/constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
'''
77
The maximum length of characters that the text of a statement can contain.
8-
The number 255 is used because that is the maximum length of a char field
9-
in most databases. This value should be enforced on a per-model basis by
10-
the data model for each storage adapter.
8+
The number 1100 is used to support longer conversational statements while
9+
remaining within VARCHAR limits for most databases. This value should be
10+
enforced on a per-model basis by the data model for each storage adapter.
1111
'''
12-
STATEMENT_TEXT_MAX_LENGTH = 255
12+
STATEMENT_TEXT_MAX_LENGTH = 1100
1313

1414
'''
1515
The maximum length of characters that the text label of a conversation can contain.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""
2+
Django migration to increase text field max_length from 255 to 1100.
3+
4+
This migration alters all text-related fields in the Statement model:
5+
- text
6+
- search_text
7+
- in_response_to
8+
- search_in_response_to
9+
10+
This change supports longer conversational statements while remaining
11+
within VARCHAR limits for most databases.
12+
"""
13+
from django.db import migrations, models
14+
15+
16+
class Migration(migrations.Migration):
17+
18+
dependencies = [
19+
('django_chatterbot', '0020_alter_statement_conversation_and_more'),
20+
]
21+
22+
operations = [
23+
migrations.AlterField(
24+
model_name='statement',
25+
name='text',
26+
field=models.CharField(max_length=1100, help_text='The text of the statement.'),
27+
),
28+
migrations.AlterField(
29+
model_name='statement',
30+
name='search_text',
31+
field=models.CharField(
32+
blank=True,
33+
max_length=1100,
34+
help_text='A modified version of the statement text optimized for searching.'
35+
),
36+
),
37+
migrations.AlterField(
38+
model_name='statement',
39+
name='in_response_to',
40+
field=models.CharField(
41+
max_length=1100,
42+
null=True,
43+
help_text='The text of the statement that this statement is in response to.'
44+
),
45+
),
46+
migrations.AlterField(
47+
model_name='statement',
48+
name='search_in_response_to',
49+
field=models.CharField(
50+
blank=True,
51+
max_length=1100,
52+
help_text='A modified version of the in_response_to text optimized for searching.'
53+
),
54+
),
55+
]

0 commit comments

Comments
 (0)