Skip to content

Commit 499fc90

Browse files
committed
fix: 修复在线知识库爬取文档名超过128个字符报错 #706 (#778)
(cherry picked from commit 3249811)
1 parent 56a7b7b commit 499fc90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/dataset/serializers/document_serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,13 @@ def handler(source_url: str, selector, response: Fork.Response):
656656
paragraphs = get_split_model('web.md').parse(response.content)
657657
# 插入
658658
DocumentSerializers.Create(data={'dataset_id': dataset_id}).save(
659-
{'name': source_url, 'paragraphs': paragraphs,
659+
{'name': source_url[0:128], 'paragraphs': paragraphs,
660660
'meta': {'source_url': source_url, 'selector': selector},
661661
'type': Type.web}, with_valid=True)
662662
except Exception as e:
663663
logging.getLogger("max_kb_error").error(f'{str(e)}:{traceback.format_exc()}')
664664
else:
665-
Document(name=source_url,
665+
Document(name=source_url[0:128],
666666
meta={'source_url': source_url, 'selector': selector},
667667
type=Type.web,
668668
char_length=0,

0 commit comments

Comments
 (0)